# NOT RUN {
# synthesize a sound with gradually increasing hissing noise
sound = soundgen(sylLen = 200, temperature = 0.001,
noise = list(time = c(0, 350), value = c(-40, 0)),
formantsNoise = list(f1 = list(freq = 5000, width = 10000)),
addSilence = 25)
# playme(sound, samplingRate = 16000)
# auditory spectrogram
soundgen:::audSpectrogram(sound, samplingRate = 16000, nFilters = 64)
# compare to an FFT-based spectrogram on log-scale
spectrogram(sound, samplingRate = 16000, yScale = 'log')
# }
# NOT RUN {
# add bells and whistles
soundgen:::audSpectrogram(sound, samplingRate = 16000,
yScale = 'linear',
osc = 'dB', # plot oscillogram in dB
heights = c(2, 1), # spectro/osc height ratio
brightness = -.1, # reduce brightness
colorTheme = 'heat.colors', # pick color theme
cex.lab = .75, cex.axis = .75, # text size and other base graphics pars
grid = 5, # lines per kHz; to customize, add manually with graphics::grid()
ylim = c(0, 5), # always in kHz
main = 'My spectrogram' # title
# + axis labels, etc
)
# change dynamic range
soundgen:::audSpectrogram(sound, samplingRate = 16000, dynamicRange = 40)
soundgen:::audSpectrogram(sound, samplingRate = 16000, dynamicRange = 120)
# remove the oscillogram
soundgen:::audSpectrogram(sound, samplingRate = 16000, osc = 'none')
# }
Run the code above in your browser using DataLab