AniwaffleDocsHomeStudio

Text to Speech

Stereo and positioning

Waffle Stereo generates native two-channel speech and places each line in the stereo field: in the center, or near or far on the left or right.

Overview

Waffle Stereo (waffle:0.1-stereo-beta) produces speech in two channels, with the voice placed in space by the model itself rather than panned afterwards. Use it for:

  • headphone listening, where a voice can lean in close to one ear or speak from across the room,
  • dialogue and audio drama, with each line placed where the character stands,
  • games and interactive scenes, where speech follows a position you choose.

It works with every Waffle voice. You don't need a separate clone: send the same voice_id with model: "waffle:0.1-stereo-beta".

Generate stereo speech

Set model to Waffle Stereo, request a PCM format, and wrap the text in a position tag.

curl https://aniwaffle.com/v1/tts \
  --fail-with-body \
  --header "Authorization: Bearer $ANIWAFFLE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "text": "<left:near>Psst. Over here.</left:near> <right:far>Who said that?</right:far>",
    "voice_id": "'"$ANIWAFFLE_VOICE_ID"'",
    "model": "waffle:0.1-stereo-beta",
    "output_format": "pcm_48000"
  }' \
  --output stereo.pcm

The response is raw 16-bit PCM with two interleaved channels. Save it as WAV to play it.

Position tags

TagPlacement
<center>…</center>In front of the listener, balanced between both channels.
<left:near>…</left:near>Close to the listener, on the left.
<left:far>…</left:far>At a distance, on the left.
<right:near>…</right:near>Close to the listener, on the right.
<right:far>…</right:far>At a distance, on the right.

Wrap every span in a position tag so placement is explicit. A position applies to everything inside it, including human sounds:

text
<right:near>[gasping] You scared me!</right:near>

Move the voice between lines by closing one position and opening the next:

text
<left:far>Hello? Is anyone there?</left:far> <center>I'm right here.</center> <right:near>And so am I.</right:near>

Combine position with emotion and delivery

Position is the outermost tag. Nest emotion inside it, and delivery inside the emotion:

text
<left:near><happy><whispering>I have a surprise for you.</whispering></happy></left:near>

Bracket cues work too, and apply until the next cue of the same type:

text
[left:near] [whispering] Can you hear me? [right:far] [shouting] Over here!

Use one style per request. See Emotion and sound tags for the full syntax.

Stereo audio format

Waffle Stereo returns PCM only: pcm_24000, pcm_44100 or pcm_48000. Compressed formats such as aac_44100_128 are rejected.

  • Samples are signed 16-bit little-endian.
  • Channels are interleaved by frame: L0 R0 L1 R1 …. Each frame is 4 bytes.
  • There is no file header.
  • Duration in seconds is bytes / (sample_rate × 4).

The response identifies the layout:

WhereValue
HTTP Content-Typeaudio/pcm;rate=48000;channels=2
HTTP X-Audio-Channels2
WebSocket audio event"channels": 2

Keep both channels when you resample, mix or play the audio. Downmixing to mono removes the positioning.

Save as WAV

Add a WAV header to play the audio in any player:

import wave

with wave.open("stereo.wav", "wb") as wav:
    wav.setnchannels(2)
    wav.setsampwidth(2)       # 16-bit samples
    wav.setframerate(48000)   # match output_format
    wav.writeframes(pcm)

Stream stereo

Set model in the start event of a streaming request. Each audio event carries "channels": 2, and chunks concatenated in seq order form one interleaved stream.

json
{
  "event": "start",
  "request": {
    "voice_id": "YOUR_VOICE_ID",
    "model": "waffle:0.1-stereo-beta",
    "output_format": "pcm_48000"
  }
}

Limits

  • PCM only. Request pcm_24000, pcm_44100 or pcm_48000.
  • No realtime tier. A stereo request with realtime: true is rejected before synthesis and is not charged.
  • Position tags need Waffle Stereo. Waffle Mono rejects them with invalid_request.
  • Availability. GET /v1/models lists Waffle Stereo on each host that serves it. Check the host you call.

Contact our team

Tell us about your character and what you’d like to build.