PyWorld: a Python wrapper for WORLD vocoder
Project description
PyWORLD - A Python wrapper of WORLD Vocoder
Linux |
Windows |
---|---|
WORLD Vocoder is a fast and high-quality vocoder which parameterizes speech into three components:
f0
: Pitch contoursp
: Harmonic spectral envelopeap
: Aperiodic spectral envelope (relative to the harmonic spectral envelope)
It can also (re)synthesize speech using these features (see examples below).
For more information, please visit Dr. Morise's WORLD repository and the official website of WORLD Vocoder
APIs
Vocoder Functions
import pyworld as pw
_f0, t = pw.dio(x, fs) # raw pitch extractor
f0 = pw.stonemask(x, _f0, t, fs) # pitch refinement
sp = pw.cheaptrick(x, f0, t, fs) # extract smoothed spectrogram
ap = pw.d4c(x, f0, t, fs) # extract aperiodicity
y = pw.synthesize(f0, sp, ap, fs) # synthesize an utterance using the parameters
Utility
# Convert speech into features (using default arguments)
f0, sp, ap = pw.wav2world(x, fs)
You can change the default arguments of the function, too.
See more info using help
.
Installation
Using Pip
pip install pyworld
Building from Source
git clone https://github.com/JeremyCCHsu/Python-Wrapper-for-World-Vocoder.git
cd Python-Wrapper-for-World-Vocoder
git submodule update --init
pip install -U pip
pip install -r requirements.txt
pip install .
It will automatically git clone
Morise's World Vocoder (C++ version).
(It seems to me that using virtualenv
or conda
is the best practice.)
Installation Validation
You can validate installation by running
cd demo
python demo.py
to see if you get results in test/
direcotry.
(Please avoid writing and executing codes in the Python-Wrapper-for-World-Vocoder
folder for now.)
Environment/Dependencies
- Operating systems
- Linux Ubuntu 14.04+
- Windows (thanks to wuaalb)
- WSL
- Python
- 3.7+
You can install dependencies these by pip install -r requirements.txt
Notice
- WORLD vocoder is designed for speech sampled ≥ 16 kHz. Applying WORLD to 8 kHz speech will fail. See a possible workaround here.
- When the SNR is low, extracting pitch using
harvest
instead ofdio
is a better option.
Troubleshooting
- Upgrade your Cython version to 0.24.
(I failed to build it on Cython 0.20.1post0)
It'll require you to download Cython form http://cython.org/
Unzip it, andpython setup.py install
it.
(I triedpip install Cython
but the upgrade didn't seem correct)
(Again, add--user
if you don't have root access.) - Upon executing
demo/demo.py
, the following code might be needed in some environments (e.g. when you're working on a remote Linux server):
import matplotlib
matplotlib.use('Agg')
-
If you encounter
library not found: sndfile
error upon executingdemo.py
, you might have to install it byapt-get install libsoundfile1
. You can also replacepysoundfile
withscipy
orlibrosa
, but some modification is needed:- librosa:
- load(fiilename, dtype=np.float64)
- output.write_wav(filename, wav, fs)
- remember to pass
dtype
argument to ensure that the method gives you adouble
.
- scipy:
- You'll have to write a customized utility function based on the following methods
- scipy.io.wavfile.read (but this gives you
short
) - scipy.io.wavfile.write
- librosa:
-
If you have installation issue on Windows, I probably could not provide much help because my development environment is Ubuntu and Windows Subsystem for Linux (read this if you are interested in installing it).
Other Installation Suggestions
- Use
pip install .
is safer and you can easily uninstall pyworld bypip uninstall pyworld
- For Mac users: You might need to do
MACOSX_DEPLOYMENT_TARGET=10.9 pip install .
See issue.
- Another way to install pyworld is via
python setup.py install
- Add
--user
if you don't have root access - Add
--record install.txt
to track the installation dir
- Add
- If you just want to try out some experiments, execute
python setup.py build_ext --inplace
Then you can use PyWorld from this directory.
You can also copy the resulting pyworld.so (pyworld.{arch}.pyd on Windows) file to~/.local/lib/python2.7/site-packages
(or corresponding Windows directory) so that you can use it everywhere like an installed package.
Alternatively you can copy/symlink the compiled files using pip, e.g.pip install -e .
Acknowledgement
Thank all contributors (tats-u, wuaalb, r9y9, rikrd, kudan2510) for making this repo better and sotelo whose world.py inspired this repo.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file pyworld-0.3.4.tar.gz
.
File metadata
- Download URL: pyworld-0.3.4.tar.gz
- Upload date:
- Size: 252.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 106c70ee7a7d8c9ba488d8022f2033706929a40f0264256b8e87da5aab98303a |
|
MD5 | f3fb39699227cdfaabab2b45a6834962 |
|
BLAKE2b-256 | 1fa094bef26b6e270cf8a0c795c906fcb6dddf6095b48f390b4729185d7c1eeb |
File details
Details for the file pyworld-0.3.4-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: pyworld-0.3.4-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 226.0 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61292a4dced5f4a0677aa7afdd5c601df79e70771aa63bbdd8279e6a1d0f5d7a |
|
MD5 | dfc88df5be04cf8b7d5728d5ddc71c3d |
|
BLAKE2b-256 | b757383c3f32da87f41d2d1bab739e2926a3c7accde71f006d64486d2d5064de |
File details
Details for the file pyworld-0.3.4-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: pyworld-0.3.4-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 224.5 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 699d2478b31215893152f67bb3eef244ed77fd3b8ac6757428fbcf7f8e1a057c |
|
MD5 | 46a421b87e64f4fdc154e78b28868a65 |
|
BLAKE2b-256 | ca0574b6d5dc70a812e1cd62929d58894042d7963c9b1fd809e37f04ffc0deea |
File details
Details for the file pyworld-0.3.4-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: pyworld-0.3.4-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 225.0 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fddbbb9aec3f2341279237a907b8b625fa099086205b24aa740008becbd7e3d4 |
|
MD5 | 53ac267cad3cc63f48b8cc66edc785e5 |
|
BLAKE2b-256 | fefec9f98cfb6136519f6f2ff3f1adb2b9c95175068f918a97c7d5d2e9e43552 |
File details
Details for the file pyworld-0.3.4-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: pyworld-0.3.4-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 224.9 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1aa7ec78e4575c231bc374c825a3c5c1fefdff5c83932dcf90b7d333c156c2e |
|
MD5 | 41ee703f044733ce04814d832725a3dc |
|
BLAKE2b-256 | 3726f5d1c0f52acda4b69ab8ea1c3493fc5bcb92b38b1f95267297f09d5e2204 |
File details
Details for the file pyworld-0.3.4-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: pyworld-0.3.4-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 224.9 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 235ce1c9b97986897cf60544c6d46a5eef814688b1aa0ea9d88e9877e6df015f |
|
MD5 | 8cc7ac114259a3508919c296f09afa55 |
|
BLAKE2b-256 | 5012fe87126a1bf833adb3b862fab1c4f13f8af0f0bd33f69e3a6e59f794f31c |
File details
Details for the file pyworld-0.3.4-cp37-cp37m-win32.whl
.
File metadata
- Download URL: pyworld-0.3.4-cp37-cp37m-win32.whl
- Upload date:
- Size: 174.6 kB
- Tags: CPython 3.7m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c0a4c6ef1d3ba7742b4cf773c2733743392ce525d75efda4b832abb623d8689 |
|
MD5 | 33cb3ac5d283ad54b41856bf4a6b1f8d |
|
BLAKE2b-256 | 19ea1bfca6081a452f5b60195290551335215e079f6e79cb31282c387a6a7b20 |
File details
Details for the file pyworld-0.3.4-cp36-cp36m-win_amd64.whl
.
File metadata
- Download URL: pyworld-0.3.4-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 235.3 kB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.6 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34db25abde77cc231605d0f3748742cf9535156ee239fd861241a66d43c5134c |
|
MD5 | ff586a0b7c58ded68b9644530592b0d5 |
|
BLAKE2b-256 | 799970bf2c6d88259f87018b3d759d78dc35af41100da2bf8ab50dfc6d43d396 |
File details
Details for the file pyworld-0.3.4-cp36-cp36m-win32.whl
.
File metadata
- Download URL: pyworld-0.3.4-cp36-cp36m-win32.whl
- Upload date:
- Size: 180.2 kB
- Tags: CPython 3.6m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.6 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebd9f918f54fb5dd6a16059635d904b56a5165e7e5207ab1b4fa0fb839b4efa7 |
|
MD5 | 866f9244ebda2f9c5d1fa4b1890f4f86 |
|
BLAKE2b-256 | 98a116c9e76aba0765799f72469db8aad01818f588e04014595935c71bfa6d96 |