Neuphonic
The NeuphonicTTSService provides ultra-low latency, high-fidelity text-to-speech using Neuphonic's WebSocket and HTTP APIs. It is designed for human-like conversational AI.
Installation
pip install "piopiy-ai[neuphonic]"
Prerequisites
- A Neuphonic API key (Get yours here).
- Set your API key in your environment:
export NEUPHONIC_API_KEY="your_api_key_here"
Configuration
NeuphonicTTSService Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | str | Required | Your Neuphonic API key. |
voice_id | str | None | ID of the voice to use. |
sample_rate | int | 22050 | Audio sample rate (default 22050Hz). |
params | InputParams | InputParams() | Synthesis settings. |
InputParams
| Parameter | Type | Default | Description |
|---|---|---|---|
language | Language | Language.EN | Language for synthesis. |
speed | float | 1.0 | Speech speed multiplier. |
Usage
Basic Setup (Streaming)
import os
from piopiy.services.neuphonic.tts import NeuphonicTTSService
tts = NeuphonicTTSService(
api_key=os.getenv("NEUPHONIC_API_KEY"),
voice_id="your_voice_id"
)
Notes
- High Fidelity: Default sample rate is 22.05kHz, providing crisp and clear audio.
- Stop Control: Supports the
<STOP>tag to gracefully finish/flush synthesis segments. - SSE Support: An alternative
NeuphonicHttpTTSServiceis available if you prefer Server-Sent Events over WebSockets.