Text to Speech
Emotion and sound tags
Direct how a line is spoken by writing tags inline in the text: an emotion, a delivery such as whispering, or a human sound such as a laugh or a sigh.
Overview
Tags are part of the text you send. They work the same way in one-shot requests, streaming and jobs, and on both Waffle models.
<happy>I'm so glad you came!</happy> [laughing] <whispering>Let me tell you a secret.</whispering>| Type | Syntax | Tags | Effect |
|---|---|---|---|
| Emotion | <tag>…</tag> | happy, sad, angry, afraid, disgusted, surprised, embarrassed, aroused | Colors the tone of the wrapped text. |
| Delivery | <tag>…</tag> | whispering, shouting | Changes how loudly the wrapped text is spoken. |
| Human sound | [tag] | sighing, gasping, panting, sniffing, laughing, groaning, crying, coughing, licking | Inserts one sound at that point. |
| Position | <tag>…</tag> | center, left:near, left:far, right:near, right:far | Places the wrapped text in the stereo field. Waffle Stereo only. |
Send tagged text
curl https://aniwaffle.com/v1/tts \
--header "Authorization: Bearer $ANIWAFFLE_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"text": "<happy>I am so glad you came.</happy> [laughing] <whispering>Let me tell you a secret.</whispering>",
"voice_id": "'"$ANIWAFFLE_VOICE_ID"'",
"output_format": "aac_44100_128"
}' \
--output tagged.aacSyntax rules
Wrap spans with paired tags
Emotion, delivery and position tags open and close around the text they affect:
<sad>I waited all day.</sad> <surprised>And then you called!</surprised>Nest in a fixed order
You can combine one tag from each type. Nest them in this order, from outside to inside: position, emotion, delivery.
<happy><whispering>Don't tell anyone.</whispering></happy><whispering><happy>…</happy></whispering> is rejected, as are two emotions nested inside each other.
Insert sounds with brackets
Human sounds use square brackets and take effect at that point in the text. A request can contain only sounds:
{ "text": "[sighing] [laughing]" }Bracket cues
As an alternative to paired tags, a bracket cue such as [happy] or [whispering] applies until the next cue of the same type:
[happy] Good morning! [sad] Oh, it's raining.Use either paired tags or bracket cues for emotion and delivery in one request, not both.
Escape literal characters
To speak a literal [, < or \, put a backslash before it. In JSON, the backslash itself is escaped: "text": "Press \\[Enter\\]" is spoken as "Press [Enter]".
Tags in streaming requests
Send tags inside text events with the same syntax. Close every paired span before you send flush or stop.
{ "event": "text", "text": "<whispering>Come closer.</whispering> [sighing]" }Validation
- Unknown tags, unclosed spans and nesting in the wrong order are rejected:
400 invalid_requeston HTTP, or anerrorevent with the codeinvalid_requeston a stream. - Position tags are accepted only by Waffle Stereo.
- If a voice does not list
voice_tagsin itscapabilities, tags are removed and the remaining text is spoken.
Tag text in Studio
In Studio's Text to speech page, type [ or < to search tags, or open the Tags menu. Select text before choosing a tag to wrap it.
Auto Tag adds tags that fit your text. Each run that adds tags uses 100 credits; a run that adds none is free.
Tips
- Start with one tag per sentence and listen with the exact voice you will ship. The strength of each effect varies by voice.
- Put a human sound where it would happen naturally, for example
[laughing]after the funny line, not in the middle of a word. - Match the words to the emotion. A tag colors the delivery; it doesn't change what is said.