Registry / ai-ml / pyworld

pyworld

JSON →
library0.3.5pypypiunverified

PyWorld is a Python wrapper for the WORLD vocoder, a highly efficient and high-quality speech analysis, manipulation, and synthesis system. It allows users to extract fundamental frequency (f0), harmonic spectral envelope (sp), and aperiodic spectral envelope (ap) from speech, and subsequently synthesize speech from these parameters. The library is currently at version 0.3.5 and is actively maintained, though major releases have been infrequent. [1, 7, 9, 11]

pip install pyworld
INSTALL
IMPORT
SIG · PYWORLD
P
pyworld
ai-mlpythonv0.3.5
Install
—
Import
—
Disk
—
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.910 runs
build_error
glibc
py 3.10–3.910 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pyworld
✓ import pyworld
✗ import pyworld

This quickstart demonstrates how to simulate a basic audio waveform and then use `pyworld.wav2world` to extract the fundamental frequency (f0), spectral envelope (sp), and aperiodicity (ap). It also shows how to synthesize audio back from these features. [1, 7, 9]

import numpy as np import pyworld as pw # Simulate a mono audio waveform (e.g., 2 seconds at 44.1 kHz) fs = 44100 # Sampling frequency t = np.arange(0, 2.0, 1.0/fs) # Time vector f0_val = 200 # Hz x = 0.5 * np.sin(2 * np.pi * f0_val * t).astype(np.float64) # Ensure the waveform is float64 as expected by pyworld # Extract WORLD features f0, sp, ap = pw.wav2world(x, fs) print(f"Extracted f0 shape: {f0.shape}") print(f"Extracted spectral envelope shape: {sp.shape}") print(f"Extracted aperiodicity shape: {ap.shape}") # Synthesize speech back (optional, requires additional components like 'y') y_synthesized = pw.synthesize(f0, sp, ap, fs) print(f"Synthesized audio shape: {y_synthesized.shape}")
Debug
Known issues
breakingWORLD vocoder, and thus PyWorld, is designed for speech sampled at 16 kHz or higher. Applying it to audio with a sampling rate below 16 kHz will result in failure or incorrect output. [1, 7]
fix
Ensure input audio has a sampling frequency of 16 kHz or greater. Resample lower frequency audio before processing with PyWorld.
affects: All versions
gotchaWhen loading audio with libraries like `scipy` or `librosa` for PyWorld processing, ensure the audio data is converted to `numpy.float64` (double precision). PyWorld's C backend expects this data type, and incorrect types can lead to errors or unexpected behavior. [1]
fix
When loading audio, explicitly cast the array: `audio_data = librosa.load(filename, sr=fs, dtype=np.float64)[0]` or `audio_data = scipy.io.wavfile.read(filename)[1].astype(np.float64)`.
affects: All versions
gotchaFor audio with a low Signal-to-Noise Ratio (SNR), the `pyworld.dio` pitch extractor may perform poorly. The `pyworld.harvest` extractor is often a better alternative in such conditions. [1]
fix
Consider using `f0, t = pw.harvest(x, fs)` instead of `pw.dio(x, fs)` for noisy audio segments.
affects: All versions
gotchaWhen installing `pyworld` from source, especially if encountering build errors, an outdated `Cython` version can be the cause. [1]
fix
Upgrade Cython to a sufficiently recent version, e.g., `pip install --upgrade Cython>=0.24`.
affects: <=0.3.5
Upgrade
Version history
0.3.5latest on PyPI · released Jan 21, 2025
Audit
Dependencies
numpyrequiredRequired for numerical array operations (audio waveforms, features).
pysoundfileoptionalRecommended for audio input/output operations. Can be replaced by scipy or librosa with careful data type handling.
Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
pyworld — pip install pyworld · libregistry