{"library":"piper-tts","title":"Piper TTS","description":"Piper TTS is a fast, local, and neural text-to-speech engine optimized for CPU performance, allowing speech synthesis directly on device. It is currently at version 1.4.2 and receives frequent minor updates with occasional major version changes that introduce new features and API adjustments.","language":"python","status":"active","last_verified":"Sun May 17","install":{"commands":["pip install piper-tts"],"cli":null},"imports":["from piper import PiperVoice","from piper.voices import SynthesisConfig"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import piper\nimport os\n\n# NOTE: Model files (.onnx and .json) are NOT included with the pip package.\n# You MUST download them separately, e.g., from huggingface.co/rhasspy/piper-voices\n# Example: 'en_US-lessac-medium.onnx' and 'en_US-lessac-medium.json'\n\n# Provide paths to your downloaded model files\nmodel_path = os.environ.get('PIPER_MODEL_PATH', 'path/to/your_downloaded_model.onnx')\nconfig_path = os.environ.get('PIPER_CONFIG_PATH', 'path/to/your_downloaded_model.json')\n\nif not os.path.exists(model_path) or not os.path.exists(config_path):\n    print(f\"Error: Model files not found. Please download '.onnx' and '.json' files.\")\n    print(f\"  Expected model at: {model_path}\")\n    print(f\"  Expected config at: {config_path}\")\n    print(f\"  Download example: https://huggingface.co/rhasspy/piper-voices/tree/main\")\nelse:\n    try:\n        # Load the voice model\n        voice = piper.PiperVoice.load(model_path, config_path=config_path)\n\n        # Get default synthesis configuration\n        synthesis_config = voice.config.synthesis\n        text = \"Hello, this is a test from Piper TTS.\"\n\n        print(f\"Synthesizing: '{text}'\")\n        audio_chunks_generator = voice.synthesize(text, synthesis_config)\n\n        num_chunks = 0\n        for audio_bytes in audio_chunks_generator:\n            num_chunks += 1\n            # In a real application, you would save audio_bytes to a file\n            # or stream it for real-time playback (e.g., using 'sounddevice').\n            # Example: print(f\"Received chunk of {len(audio_bytes)} bytes.\")\n            pass # Just iterate to demonstrate generation\n\n        print(f\"Successfully generated {num_chunks} audio chunks.\")\n        print(\"Audio can be saved to a WAV file using Python's 'wave' module or 'soundfile'.\")\n\n    except Exception as e:\n        print(f\"An unexpected error occurred: {e}\")\n","lang":"python","description":"This quickstart demonstrates how to load a Piper TTS voice model and synthesize speech. Remember that model files (`.onnx` and `.json`) must be downloaded separately. The `synthesize` method yields audio chunks (bytes) that can then be processed, saved, or played back.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-17","installed_version":"1.4.2","pypi_latest":"1.4.2","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":50,"avg_install_s":7.5,"avg_import_s":0.34,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"piper-tts","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"piper-tts","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":9.7,"import_time_s":0.27,"mem_mb":9.1,"disk_size":"226M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"piper-tts","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"piper-tts","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":5.4,"import_time_s":0.4,"mem_mb":9.5,"disk_size":"176M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"piper-tts","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"piper-tts","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":5.3,"import_time_s":0.37,"mem_mb":9.1,"disk_size":"164M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"piper-tts","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"piper-tts","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":5.3,"import_time_s":0.36,"mem_mb":9.4,"disk_size":"163M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"piper-tts","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"piper-tts","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":11.7,"import_time_s":0.28,"mem_mb":8.6,"disk_size":"223M"}]}}