方法"/>
python变声方法
通过调整采样频率和移动音调变声,这里的librosa可以更新到最新版本,保存使用soundfile库
import librosa
import soundfile as sf
import librosa.display
import matplotlib.pyplot as pltdef adjust_tone(spk_id):out_path=f"yyy.wav"input_audio =f'xxx.wav'y, sr = librosa.load(input_audio) # 22050# 通过移动音调变声 ,14是上移14个半步, 如果是 -14 下移14个半步b = librosa.effects.pitch_shift(y, sr, n_steps=3)sf.write(out_path, b, sr)def adjust_tone_2(spk_id):out_path=f"yyy.wav"input_audio =f'xxx.wav'y, sr = librosa.load(input_audio) # 22050# 提高采样率,语速变快,音调变高,变小孩声音sr= 29000sf.write(out_path, b, sr)
更多推荐
python变声方法
发布评论