data(speechEx, package = 'soundgen') # import a recording
# playme(speechEx)
# spectrogram(speechEx)
s1 = timeStretch(speechEx, stretch = c(1, 3))
# playme(s1, [email protected])
# spectrogram(s1, [email protected])
# compare to a similar effect achieved with a phase vocoder in shiftPitch():
s2 = shiftPitch(
speechEx,
timeStretch = c(1, 3), # from 1 (original) to mult
multPitch = c(1, 1/3), # also drop pitch
multFormants = c(1, 1/3) # also drop formants (by the same proportion)
)
# playme(s2, [email protected])
# spectrogram(s2, [email protected])
# NB: because the two algorithms calculate transitions between stretch
# factors in different ways, the duration is not identical, even though the
# range of pitch change is the same
Run the code above in your browser using DataLab