tuanad121 / Python-WORLD

Other
150 stars 31 forks source link
manifold-learning manifold-vocoder pitch pycharm python vae variational-autoencoder world-vocoder

PYTHON WORLD VOCODER:


This is a line-by-line implementation of WORLD vocoder (Matlab, C++) in python. It supports python 3.0 and later.

For technical detail, please check the website.

INSTALATION


Python WORLD uses the following dependencies:

Install python dependencies:

pip install -r requirements.txt

Or import the project with PyCharm and open requirements.txt in PyCharm. It will ask to install the missing libraries by itself.

EXAMPLE


The easiest way to run those examples is to import the Python-WORLD folder into PyCharm.

In example/prodosy.py, there is an example of analysis/modification/synthesis with WORLD vocoder. It has some examples of pitch, duration, spectrum modification.

First, we read an audio file:

from scipy.io.wavfile import read as wavread
fs, x_int16 = wavread(wav_path)
x = x_int16 / (2 ** 15 - 1) # to float

Then, we declare a vocoder and encode the audio file:

from world import main
vocoder = main.World()
# analysis
dat = vocoder.encode(fs, x, f0_method='harvest')

in which, fs is sampling frequency and x is the speech signal.

The dat is a dictionary object that contains pitch, magnitude spectrum, and aperiodicity.

We can scale the pitch:

dat = vocoder.scale_pitch(dat, 1.5)

Be careful when you scale the pich because there is upper limit and lower limit.

We can make speech faster or slower:

dat = vocoder.scale_duration(dat, 2)

In test/speed.py, we estimate the time of analysis.

To use d4c_requiem analysis and requiem_synthesis in WORLD version 0.2.2, set the variable is_requiem=True:

# requiem analysis
dat = vocoder.encode(fs, x, f0_method='harvest', is_requiem=True)

To extract log-filterbanks, MCEP-40, VAE-12 as described in the paper Using a Manifold Vocoder for Spectral Voice and Style Conversion, check test/spectralFeatures.py. You need Keras 2.2.4 and TensorFlow 1.14.0 to extract VAE-12. Check out speech samples

NOTE:


CITATION:

If you find the code helpful and want to cite it, please use:

Dinh, T., Kain, A., & Tjaden, K. (2019). Using a manifold vocoder for spectral voice and style conversion. Proceedings of the Annual Conference of the International Speech Communication Association, INTERSPEECH, 2019-September, 1388-1392.

CONTACT US


Post your questions, suggestions, and discussions to GitHub Issues.