Skip to main content
The Faseeh API supports streaming audio output for real-time text-to-speech generation. When streaming: true is set in your request, the API returns audio data in chunks as it’s generated.

Audio Format

Streaming responses return raw PCM audio data:
  • Format: PCM (Pulse Code Modulation)
  • Sample Rate: 24000 Hz
  • Channels: Mono
  • Bit Depth: 16-bit

How It Works

When streaming is enabled:
  1. The API starts generating audio immediately
  2. Audio chunks are sent as they become available
  3. You can begin playback before generation completes
  4. Lower latency compared to non-streaming requests

Example

curl -X POST "https://api.faseeh.ai/api/v1/text-to-speech/faseeh-v1-preview" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "voice_id": "ar-najdi-male-2",
    "text": "مرحبا بك في فصيح",
    "streaming": true,
    "stability": 0.5,
    "speed": 1
  }' \
  --output audio.pcm

Handling Streaming Responses

Process the streaming PCM data in your application:
  • Save chunks to a buffer
  • Play audio chunks as they arrive
  • Convert PCM to your desired format (WAV, MP3, etc.) if needed