当前位置:   article > 正文

python修改wav文件声音大小_Python更改wav文件的音调

python wav 获取 pitch

I need any python library to change pitch of my wav file without any raw audio data processing.

I spent couple hours to find it, but only found some strange raw data processing code snippets and video, that shows real-time pitch shift, but without source code.

解决方案

Since a wav file basically is raw audio data, you won't be able to change the pitch without "raw audio processing".

Here is what you could do.

You will need the wave (standard library) and numpy modules.

import wave

import numpy as np

Open the files.

wr = wave.open('input.wav', 'r')

# Set the parameters for the output file.

par = list(wr.getparams())

par[3] = 0 # The number of samples will be set by writeframes.

par = tuple(par)

ww = wave.open('pitch1.wav', 'w

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/一键难忘520/article/detail/967062
推荐阅读
相关标签
  

闽ICP备14008679号