{"id":9267,"library":"pyworld","title":"PyWorld: Python Wrapper for WORLD Vocoder","description":"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]","status":"active","version":"0.3.5","language":"python","source_language":"en","source_url":"https://github.com/JeremyCCHsu/Python-Wrapper-for-World-Vocoder","tags":["speech processing","vocoder","audio analysis","audio synthesis"],"install":[{"cmd":"pip install pyworld","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Required for numerical array operations (audio waveforms, features).","package":"numpy","optional":false},{"reason":"Recommended for audio input/output operations. Can be replaced by scipy or librosa with careful data type handling.","package":"pysoundfile","optional":true}],"imports":[{"wrong":"import pyworld","symbol":"pyworld","correct":"import pyworld"}],"quickstart":{"code":"import numpy as np\nimport pyworld as pw\n\n# Simulate a mono audio waveform (e.g., 2 seconds at 44.1 kHz)\nfs = 44100 # Sampling frequency\nt = np.arange(0, 2.0, 1.0/fs) # Time vector\nf0_val = 200 # Hz\nx = 0.5 * np.sin(2 * np.pi * f0_val * t).astype(np.float64)\n\n# Ensure the waveform is float64 as expected by pyworld\n# Extract WORLD features\nf0, sp, ap = pw.wav2world(x, fs)\n\nprint(f\"Extracted f0 shape: {f0.shape}\")\nprint(f\"Extracted spectral envelope shape: {sp.shape}\")\nprint(f\"Extracted aperiodicity shape: {ap.shape}\")\n\n# Synthesize speech back (optional, requires additional components like 'y')\ny_synthesized = pw.synthesize(f0, sp, ap, fs)\nprint(f\"Synthesized audio shape: {y_synthesized.shape}\")","lang":"python","description":"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]"},"warnings":[{"fix":"Ensure input audio has a sampling frequency of 16 kHz or greater. Resample lower frequency audio before processing with PyWorld.","message":"WORLD 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]","severity":"breaking","affected_versions":"All versions"},{"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)`.","message":"When 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]","severity":"gotcha","affected_versions":"All versions"},{"fix":"Consider using `f0, t = pw.harvest(x, fs)` instead of `pw.dio(x, fs)` for noisy audio segments.","message":"For 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]","severity":"gotcha","affected_versions":"All versions"},{"fix":"Upgrade Cython to a sufficiently recent version, e.g., `pip install --upgrade Cython>=0.24`.","message":"When installing `pyworld` from source, especially if encountering build errors, an outdated `Cython` version can be the cause. [1]","severity":"gotcha","affected_versions":"<=0.3.5"}],"env_vars":null,"search_vec":"'0.3.5':61 '1':72 '11':75 '7':73 '9':74 'activ':64 'allow':30 'analysi':24,80 'ap':45 'aperiod':42 'audio':79,81 'current':58 'effici':18 'envelop':39,44 'extract':33 'f0':36 'frequenc':35 'fundament':34 'harmon':37 'high':17,21 'high-qual':20 'infrequ':71 'librari':56 'maintain':65 'major':67 'manipul':25 'paramet':54 'process':77 'python':2,10 'pyworld':1,7 'qualiti':22 'releas':68 'sp':40 'spectral':38,43 'speech':23,47,51,76 'subsequ':49 'synthes':50 'synthesi':27,82 'system':28 'though':66 'user':31 'version':60 'vocod':6,15,78 'world':5,14 'wrapper':3,11","created_at":"2026-04-16T18:49:19.594806+00:00","updated_at":"2026-04-16T18:49:19.594806+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\n  File \"/tmp/tmpa39spvqe/venv/lib/python3.12/site-packages/pyworld/__init__.py\", line 13, in <module>\n    import pkg_resources\nModuleNotFoundError: No module named 'pkg_resources'"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.3.5","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/JeremyCCHsu/Python-Wrapper-for-World-Vocoder","docs":null,"changelog":null,"pypi":"https://pypi.org/project/pyworld/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}