Overview
Neuphonic provides high-quality text-to-speech synthesis with two implementations:NeuphonicTTSService
: WebSocket-based with real-time streaming and interruption supportNeuphonicHttpTTSService
: HTTP-based with server-sent events.
NeuphonicTTSService
is the recommended option for interactive applications
requiring low latency.API Reference
Complete API documentation and method details
Neuphonic Docs
Official Neuphonic TTS API documentation
Example Code
Working example with WebSocket streaming
Installation
To use Neuphonic services, install the required dependencies:NEUPHONIC_API_KEY
.
Get your API key from the Neuphonic Console.
Frames
Input
TextFrame
- Text content to synthesize into speechTTSSpeakFrame
- Text that should be spoken immediatelyTTSUpdateSettingsFrame
- Runtime configuration updates (voice, speed, etc.)LLMFullResponseStartFrame
/LLMFullResponseEndFrame
- LLM response boundaries
Output
TTSStartedFrame
- Signals start of synthesisTTSAudioRawFrame
- Generated audio data chunks (streaming)TTSStoppedFrame
- Signals completion of synthesisErrorFrame
- API or processing errors
Service Comparison
Feature | NeuphonicTTSService (WebSocket) | NeuphonicHttpTTSService (HTTP) |
---|---|---|
Streaming | ✅ Real-time chunks | ✅ Server-sent events |
Interruption | ✅ Advanced handling | ❌ Limited support |
Latency | 🚀 Ultra-low | 📈 Moderate |
Language Support
Neuphonic supports multiple languages with automatic base language detection:Language Code | Description | Service Code |
---|---|---|
Language.EN | English | en |
Language.ES | Spanish | es |
Language.DE | German | de |
Language.NL | Dutch | nl |
Language.AR | Arabic | ar |
Language.FR | French | fr |
Language.PT | Portuguese | pt |
Language.RU | Russian | ru |
Language.HI | Hindi | hi |
Language.ZH | Chinese | zh |
Regional variants (e.g.,
EN_US
, ES_ES
) are automatically mapped to their
base language.Usage Example
WebSocket Service (Recommended)
Initialize theNeuphonicTTSService
and use it in a pipeline:
HTTP Service
Initialize theNeuphonicHttpTTSService
and use it in a pipeline:
Dynamic Voice Switching
Metrics
Both services provide comprehensive metrics:- Time to First Byte (TTFB) - Latency from text input to first audio
- Processing Duration - Total synthesis time
- Character Usage - Text processed for billing
Learn how to enable Metrics in your Pipeline.
Additional Notes
- WebSocket Recommended: Use
NeuphonicTTSService
for real-time applications requiring low latency and interruption support