EQ

源码

![]( https://img-blog.csdnimg.cn/20210810095004178.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQwOTQ0MzEx,size_16,color_FFFFFF,t_70)

  • seg:AudioSegment音频

  • focus_freq:需要调整的中心频率

  • bandwidth:调整的频率范围

  • channel_mode:调整哪个声道

  • filter_mode::滤波器种类。“peak”带通,“low_shelf”对低频做处理,“high_shelf”对高频做处理

  • gain_dB:处理的增益大小

  • order:暂时没看懂什么意思,保持默认的2就好

其中使用的_eq函数源码

![]( https://img-blog.csdnimg.cn/20210810102151959.png?x-oss-process=image/watermark ,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQwOTQ0MzEx,size_16,color_FFFFFF,t_70)

测试代码

抑制高频和低频,略微拉升中频,模拟电话音色。

from pydub import AudioSegment, scipy_effects
 
sound=AudioSegment.from_file("common_voice_zh-CN_22770707.wav","wav")
 
gain = -1.5
aaa = scipy_effects.eq(sound, 500, filter_mode="low_shelf", gain_dB=gain, order=2)
aaa = scipy_effects.eq(aaa, 500, filter_mode="low_shelf", gain_dB=gain, order=2)
aaa = scipy_effects.eq(aaa, 3500, filter_mode="high_shelf", gain_dB=gain, order=2)
aaa = scipy_effects.eq(aaa, 3500, filter_mode="high_shelf", gain_dB=gain, order=2)
aaa = scipy_effects.eq(aaa, 500, filter_mode="low_shelf", gain_dB=gain, order=2)
aaa = scipy_effects.eq(aaa, 500, filter_mode="low_shelf", gain_dB=gain, order=2)
aaa = scipy_effects.eq(aaa, 3500, filter_mode="high_shelf", gain_dB=gain, order=2)
aaa = scipy_effects.eq(aaa, 3500, filter_mode="high_shelf", gain_dB=gain, order=2)
aaa = scipy_effects.eq(aaa, 2000, 1500, filter_mode="peak", gain_dB=5, order=2)
 
aaa.export("qaq测试语音大小(6).wav","wav")
posted on 2023-01-30 13:07  KAWAKO  阅读(137)  评论(0)    收藏  举报