import torchaudio.sox_effects as sox_effects
wav, sr = sox_effects.apply_effects_file(
[[‘speed’, str(speed)],[‘pitch’, ‘0’], [‘rate’, str(sample_rate)]])

This method apply_effects_file is used to change the speed of speech, but the pitch is changed even I set the pitch shift is zero. I want to know how to change the speed of audio but not change the pitch.
In addition, I found another method “torchaudio.transforms.TimeStretch” to stretch on the stft and keep the pitch unchanged. If the “torchaudio.transforms.TimeStretch” can make the speed change but the pitch unchanged?

Thanks very much for your help.

Hi @Alva-2020, you can apply tempo argument for changing the speed while keeping the pitch. As described in sox document.
Yes, torchaudio.transforms.TimeStretch can change the speech while keeping the pitch. Note that the method applied is different from sox, the values may not be fully identical.