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

本文介绍如何使用Python的wave和numpy库来修改wav文件的音调。通过读取wav文件,应用快速傅里叶变换(FFT),进行频率滚动和逆FFT,实现音调的改变,同时处理了回声和重叠问题。
摘要由CSDN通过智能技术生成

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值