# NOT RUN {
s = soundgen(sylLen = 200, ampl = c(0,-10),
pitch = c(250, 350), rolloff = c(-9, -15),
noise = -40,
formants = 'aii', addSilence = 50)
# playme(s)
s1 = shiftPitch(s, samplingRate = 16000, freqWindow = 400,
multPitch = 1.25, multFormants = .8)
# playme(s1)
# }
# NOT RUN {
## Dynamic manipulations
# Add a chevron-shaped pitch contour
s2 = shiftPitch(s, samplingRate = 16000, multPitch = c(1.1, 1.3, .8))
playme(s2)
# Time-stretch only the middle
s3 = shiftPitch(s, samplingRate = 16000, timeStretch = list(
time = c(0, .25, .31, .5, .55, 1),
value = c(1, 1, 3, 3, 1, 1))
)
playme(s3)
## Various combinations of 3 manipulations
data(sheep, package = 'seewave') # import a recording from seewave
playme(sheep)
spectrogram(sheep)
# Raise pitch and formants by 3 semitones, shorten by half
sheep1 = shiftPitch(sheep, multPitch = 2 ^ (3 / 12), timeStretch = 0.5)
playme(sheep1, sheep@samp.rate)
spectrogram(sheep1, sheep@samp.rate)
# Just shorten
shiftPitch(sheep, multPitch = 1, timeStretch = 0.25, play = TRUE)
# Raise pitch preserving formants
sheep2 = shiftPitch(sheep, multPitch = 1.2, multFormants = 1, freqWindow = 150)
playme(sheep2, sheep@samp.rate)
spectrogram(sheep2, sheep@samp.rate)
# }
Run the code above in your browser using DataLab