Skip to main content

PyWorld: a Python wrapper for WORLD vocoder

Project description

PyWORLD - A Python wrapper of WORLD Vocoder

Linux Windows
Build Status Build Status

WORLD Vocoder is a fast and high-quality vocoder which parameterizes speech into three components:

  1. f0: Pitch contour
  2. sp: Harmonic spectral envelope
  3. ap: 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 of dio is a better option.

Troubleshooting

  1. 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, and python setup.py install it.
    (I tried pip install Cython but the upgrade didn't seem correct)
    (Again, add --user if you don't have root access.)
  2. 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')
  1. If you encounter library not found: sndfile error upon executing demo.py, you might have to install it by apt-get install libsoundfile1. You can also replace pysoundfile with scipy or librosa, 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 a double.
    • 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
  2. 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

  1. Use pip install . is safer and you can easily uninstall pyworld by pip uninstall pyworld
  • For Mac users: You might need to do MACOSX_DEPLOYMENT_TARGET=10.9 pip install . See issue.
  1. 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
  2. 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, sabonerune) for making this repo better and sotelo whose world.py inspired this repo.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyworld-0.3.5.tar.gz (261.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyworld-0.3.5-cp313-cp313-win_amd64.whl (222.4 kB view details)

Uploaded CPython 3.13Windows x86-64

pyworld-0.3.5-cp312-cp312-win_amd64.whl (222.7 kB view details)

Uploaded CPython 3.12Windows x86-64

pyworld-0.3.5-cp311-cp311-win_amd64.whl (225.2 kB view details)

Uploaded CPython 3.11Windows x86-64

pyworld-0.3.5-cp310-cp310-win_amd64.whl (224.2 kB view details)

Uploaded CPython 3.10Windows x86-64

pyworld-0.3.5-cp39-cp39-win_amd64.whl (224.6 kB view details)

Uploaded CPython 3.9Windows x86-64

pyworld-0.3.5-cp38-cp38-win_amd64.whl (224.5 kB view details)

Uploaded CPython 3.8Windows x86-64

pyworld-0.3.5-cp37-cp37m-win_amd64.whl (224.8 kB view details)

Uploaded CPython 3.7mWindows x86-64

pyworld-0.3.5-cp37-cp37m-win32.whl (174.5 kB view details)

Uploaded CPython 3.7mWindows x86

pyworld-0.3.5-cp36-cp36m-win_amd64.whl (235.2 kB view details)

Uploaded CPython 3.6mWindows x86-64

pyworld-0.3.5-cp36-cp36m-win32.whl (180.1 kB view details)

Uploaded CPython 3.6mWindows x86

File details

Details for the file pyworld-0.3.5.tar.gz.

File metadata

  • Download URL: pyworld-0.3.5.tar.gz
  • Upload date:
  • Size: 261.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pyworld-0.3.5.tar.gz
Algorithm Hash digest
SHA256 1b93e53cddb67a0e4faa34d6cf919ac6c662feb1c8c0ed901d71b595ab396aa3
MD5 e93b6483ef4e26a65f26bc406d718170
BLAKE2b-256 a50fc78d631ffbb4c1aaebf80ff2bf9e791213b381dbe404f9ce1a3eb3672931

See more details on using hashes here.

File details

Details for the file pyworld-0.3.5-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pyworld-0.3.5-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 222.4 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pyworld-0.3.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 860c5c3528f1dbc5c68fa71a16e3bb6990244619e5b9baf62952f3a6bfc6131c
MD5 00eda16d325731f8e9e0032c8fb36d23
BLAKE2b-256 6f5c7e8fb5417ef96cbeca125b5ee507ec5568ce4bde7b576d20db2d2d4a80fc

See more details on using hashes here.

File details

Details for the file pyworld-0.3.5-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pyworld-0.3.5-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 222.7 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pyworld-0.3.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 59b48961c2ac34fb01efeb1a77d3eda69c41b676858cbc3a82dfb7602c0c762b
MD5 057272f3b777256aeb37e1a8ee69556e
BLAKE2b-256 b6299c9c0dad7575faea3dbc3cbc8b69e0365b35912332068afd79a2b93d822d

See more details on using hashes here.

File details

Details for the file pyworld-0.3.5-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pyworld-0.3.5-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 225.2 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pyworld-0.3.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 538a359862f4bcfa7a58c019644f78941c94dc66a654be8567054ee9c1fc8f1b
MD5 e4c9480fb9a3cb5f37106394ba405806
BLAKE2b-256 0afdde13003de61ae39ce0952158aab502443e822d149d4d35be93e3b466fa12

See more details on using hashes here.

File details

Details for the file pyworld-0.3.5-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pyworld-0.3.5-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 224.2 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pyworld-0.3.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 829876828de51c7f5fdd06efa0283d69f9897b592e034db9ded857e378bf625c
MD5 5f8a783f26a8fde7b0d7e04ecb152f37
BLAKE2b-256 7ffe761706a26807c703e6c4e4f47b2d36e644214f6392e8bc20e79845a55808

See more details on using hashes here.

File details

Details for the file pyworld-0.3.5-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pyworld-0.3.5-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 224.6 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pyworld-0.3.5-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 3fb2b64482b569301ba333d7fb5bcf79ff99ed65b9768106d518eb9b3545bedb
MD5 08ffeff01e03c70041b10bba9421bec8
BLAKE2b-256 f028c061ac49a50adfadbf340c2c6725cd9a824659b5c46533616229a8f68c8d

See more details on using hashes here.

File details

Details for the file pyworld-0.3.5-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: pyworld-0.3.5-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 224.5 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pyworld-0.3.5-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 2cf35c0d4a13aff30287c49f8db6cefea6777402f558dd831502cd22949e570a
MD5 0d4a80053862f725908a54a99b72ac39
BLAKE2b-256 74aa07e43d89a04752ac46cd91bcfe92603da29a1fdded3f5a76f3f09b338a35

See more details on using hashes here.

File details

Details for the file pyworld-0.3.5-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: pyworld-0.3.5-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 224.8 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pyworld-0.3.5-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 cca7c6ad175b48665cd777183d72ab25c1372ec8b827af4748596ca43e7ed21d
MD5 abb5ac6488fa07c4d08fa6225b13e019
BLAKE2b-256 a21e258671f9ea189186d5f64903234bb835b55b955cd92c03c68752d66f78db

See more details on using hashes here.

File details

Details for the file pyworld-0.3.5-cp37-cp37m-win32.whl.

File metadata

  • Download URL: pyworld-0.3.5-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 174.5 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pyworld-0.3.5-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 306bc4397a3863686f261391e544c87cfd0c36f5151cf770d70e6459efb1310e
MD5 7e06fa59a84c9de51d8a1c56062a595d
BLAKE2b-256 d1b3f39f8311f96b48a35ff93dd0aaa16bd2980a339796309589af0502d7d8c9

See more details on using hashes here.

File details

Details for the file pyworld-0.3.5-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: pyworld-0.3.5-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 235.2 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pyworld-0.3.5-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 ae801577269c000c3f8876b7fdc928c1e15c5388f81c83218cc5c5b59cef05d7
MD5 58c44587ba9ddf15c651d11ba133ea26
BLAKE2b-256 734d2f1ae63bf78ada5c3e6c2cda25963808193441d9ce32575d80dbfb0f2d15

See more details on using hashes here.

File details

Details for the file pyworld-0.3.5-cp36-cp36m-win32.whl.

File metadata

  • Download URL: pyworld-0.3.5-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 180.1 kB
  • Tags: CPython 3.6m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pyworld-0.3.5-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 7e96564f93b0a467f980cff385807facc4552b49e0dc6bd79a75480279d0c271
MD5 68cc5e4487e7f56c88029bd4a9189621
BLAKE2b-256 d0c495065cb98b7afeff6e6c22478bca2bd57f48bb4dade22bc601b5895a2b6b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page