第一步:安装:pip install pydub
请提前准备好对应的音频文件
第二步:对应的代码编写
from pydub import AudioSegment
sound = AudioSegment.from_file("audio_speed.wav")
print(sound.duration_seconds)
rate=0.75
sound_with_altered_frame_rate = sound._spawn(sound.raw_data, overrides={
"frame_rate": int(sound.frame_rate * rate)
})
sound_slow = sound_with_altered_frame_rate.set_frame_rate(sound.frame_rate)
print(sound_slow.duration_seconds)
对应的jupyter如下图所示:

参考:python - How to change audio playback speed using Pydub? - Stack Overflow
博客介绍了使用Python调节音频语速的方法。首先需用pip install pydub进行安装,并准备好音频文件,接着进行代码编写,还给出了参考链接python - How to change audio playback speed using Pydub? - Stack Overflow 。
565

被折叠的 条评论
为什么被折叠?



