Skip to main content

Overview

Real-time streaming lets you generate speech as you type or speak, perfect for chatbots, virtual assistants, and live applications.

When to Use Streaming

Perfect for:
  • Live chat applications
  • Virtual assistants
  • Interactive storytelling
  • Real-time translations
  • Gaming dialogue
Not ideal for:
  • Pre-recorded content
  • Batch processing

Getting Started

Web Playground

Try real-time streaming instantly:
  1. Visit fish.audio
  2. Enable “Streaming Mode”
  3. Start typing and hear voice generation in real-time

Using the SDK

Stream text as it’s being written: Install the Python SDK first: pip install fish-audio-sdk.

Configuration Options

Speed vs Quality

Latency Modes:
  • Normal: Best quality, ~500ms latency
  • Balanced: Good quality, ~300ms latency

Voice Control

On s3-pro the service sets the sampling: temperature and top_p are accepted but don’t change the audio. Steer the delivery with [bracket] directions in the text instead, as in the example above. On older models, pass them in TTSConfig. stream_websocket() has no temperature or top_p argument of its own. Temperature (0.0 - 1.0, default 0.7):
  • Lower: More consistent, predictable
  • Higher: More varied, expressive
Top-p (0.0 - 1.0, default 0.7):
  • Lower: More focused
  • Higher: More diverse

Real-time Applications

Chatbot Integration

Stream responses as they’re generated:

Live Translation

Translate and speak simultaneously:

Best Practices

Text Buffering

Do:
  • Send complete words with spaces
  • Use punctuation for natural pauses
  • Buffer 5-10 words for smoothness
Don’t:
  • Send individual characters
  • Forget spaces between words
  • Send huge chunks at once

Connection Management

  1. Keep connections alive for multiple generations
  2. Handle disconnections gracefully
  3. Implement retry logic for reliability

Audio Playback

For smooth playback:
  • Buffer 2-3 audio chunks
  • Use cross-fading between chunks
  • Handle network delays gracefully

Common Use Cases

Interactive Story

Virtual Assistant

Live Commentary

Troubleshooting

Audio Gaps

Problem: Gaps between audio chunks
Solution:
  • Increase buffer size
  • Use balanced latency mode
  • Check network connection

Delayed Response

Problem: Long wait before audio starts
Solution:
  • Use balanced latency mode
  • Send initial text immediately
  • Reduce chunk size

Choppy Playback

Problem: Audio cuts in and out
Solution:
  • Buffer more chunks before playing
  • Check network stability
  • Use consistent chunk sizes

Advanced Features

Dynamic Voice Switching

The set of voices is fixed when a stream starts: one reference_id, or, in JavaScript (fish-audio 0.5.0), a list of them for a multi-speaker dialogue. The Python SDK (fish-audio-sdk 1.8.1) officially supports one id per stream. To speak in a voice outside that set, start a new stream with its reference_id. These fragments use client from the examples above; play_audio and streamSpeech stand for your own playback and stream functions; streamSpeech returns a promise that resolves when its audio has finished playing, so each turn waits for the one before it.

Emotion Injection

Add emotions dynamically:

Speed Control

Adjust speaking speed:

Performance Tips

  1. Pre-load voices for instant start
  2. Use connection pooling for multiple streams
  3. Monitor latency and adjust settings
  4. Cache common phrases for instant playback

Get Support

Need help with streaming?