# NOT RUN {
# synthesize a sound 1 s long, with gradually increasing hissing noise
sound = soundgen(sylLen = 1000, temperature = 0, noiseAnchors = list(
time = c(0, 1300), value = c(-120, 0)), formantsNoise = list(
f1 = list(time = 0, freq = 5000, width = 10000, amp = 0)))
# playme(sound, samplingRate = 16000)
# basic spectrogram
spectrogram(sound, samplingRate = 16000)
# }
# NOT RUN {
# add an oscillogram
spectrogram(sound, samplingRate = 16000, osc = TRUE)
# broad-band instead of narrow-band
spectrogram(sound, samplingRate = 16000, windowLength = 5)
# spectral derivatives
spectrogram(sound, samplingRate = 16000, method = 'spectralDerivative')
# focus only on values in the upper 5% for each frequency bin
spectrogram(sound, samplingRate = 16000, qTime = 0.95)
# detect 10% of the noisiest frames based on entropy and remove the pattern
# found in those frames (in this cases, breathing)
spectrogram(sound, samplingRate = 16000, noiseReduction = 1.1,
brightness = -2) # white noise almost gone
# apply median smoothing in both time and frequency domains
spectrogram(sound, samplingRate = 16000, smoothFreq = 5,
smoothTime = 5)
# increase contrast, reduce brightness
spectrogram(sound, samplingRate = 16000, contrast = 1, brightness = -1)
# add bells and whistles
spectrogram(sound, samplingRate = 16000, osc = TRUE, noiseReduction = 1.1,
brightness = -1, colorTheme = 'heat.colors', xlab = 'Time, ms',
ylab = 'Frequency, kHz', ylim = c(0,5))
# }
Run the code above in your browser using DataLab