Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert a female to a male voice using librosa?

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.

like image 380
Shawn Plus Avatar asked Oct 27 '25 10:10

Shawn Plus


1 Answers

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.

like image 119
Jon Nordby Avatar answered Oct 28 '25 22:10

Jon Nordby



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!