Reputation: 477
how to convert man voice to women voice using librosa?
I tried to convert the male voice into a female voice. I first read the wav file with librosa and then processed the audio time series with STFT,I hope that I can adjust the spectrum (increasing the low frequency part) to achieve the goal.
import matplotlib
matplotlib.use('TkAgg')
import librosa.display
y, sr = librosa.load("/Users/wu4mac/PycharmProjects/SpeechRecognition/weather.wav")
a = librosa.stft(y)
length = len(a)
r_a = a[10:length-10]
b = librosa.istft(r_a)
librosa.output.write_wav("stft.wav", b, sr)
I hope that the male voice can be converted a female voice, but this seems to only be achieved into a strange voice.
Upvotes: 4
Views: 4257
Reputation: 6289
Using a naive pitch-shifting approach to convert male speech to female (or reverse) will always sound quite awkward. What is needed is a speech-aware approach, often called speech resynthesis.
Praat is a great free and open-source library for working with speech. It can be used from Python, using a library called Parselmouth. One of their examples shows how to do pitch manipulation, including some sample audio.
Upvotes: 5