Pydub-如何在不更改播放速度的情况下更改帧速率 [英] Pydub - How to change frame rate without changing playback speed

查看:269
本文介绍了Pydub-如何在不更改播放速度的情况下更改帧速率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个音频文件,是使用AudioSegment在Pydub中打开的.

I have a couple audio files that I open in Pydub with AudioSegment.

我想将音频质量从帧速率22050降低到16000 Hz. (一个频道文件)

I want to decrease the audio quality from frame rate 22050 to 16000 Hz. (One channel files)

如果仅更改AudioSegment的帧频,我得到的就是在较低速度下播放的完全相同的波形.好吧,很公平.

If I simply change the frame rate of AudioSegment, what I get is the exact same wave played in slower speed. Well, fair enough.

但是我如何真正改变波形以适应较低质量,相同速度的播放?

But how do I actually change the waves to fit a lower quality, same speed playback?

(我只能想到手动插值,但我不想遇到麻烦)

(Manual interpolation is the only thing I can think of, but I don't want to get into that trouble)

推荐答案

您可以使用:

sound = AudioSegment.from_file(…)
sound = sound.set_frame_rate(16000)

这篇关于Pydub-如何在不更改播放速度的情况下更改帧速率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆