# NOT RUN {
sound_aii = soundgen(formants = 'aii')
# playme(sound_aii, 16000)
seewave::meanspec(sound_aii, f = 16000, dB = 'max0')
sound_flat = flatSpectrum(sound_aii, freqWindow = 150, samplingRate = 16000)
# playme(sound_flat, 16000)
seewave::meanspec(sound_flat, f = 16000, dB = 'max0')
# harmonics are still there, but formants are gone and can be replaced
# }
# NOT RUN {
# Now let's make a sheep say "aii"
data(sheep, package = 'seewave') # import a recording from seewave
sheep_orig = as.numeric(scale(sheep@left))
samplingRate = sheep@samp.rate
playme(sheep_orig, samplingRate)
# spectrogram(sheep_orig, samplingRate)
# seewave::spec(sheep_orig, f = samplingRate, dB = 'max0')
sheep_flat = flatSpectrum(sheep_orig, freqWindow = 150, # freqWindow ~f0
samplingRate = samplingRate)
# playme(sheep_flat, samplingRate)
# spectrogram(sheep_flat, samplingRate)
# seewave::spec(sheep_flat, f = samplingRate, dB = 'max0')
# So far we have a sheep bleating with a flat spectrum;
# now let's add new formants
sheep_aii = addFormants(sheep_flat,
samplingRate = samplingRate,
formants = 'aii',
lipRad = -3) # negative lipRad to counter unnatural flat source
playme(sheep_aii, samplingRate)
# spectrogram(sheep_aii, samplingRate)
# seewave::spec(sheep_aii, f = samplingRate, dB = 'max0')
# }
Run the code above in your browser using DataLab