Skip to main content
Lesson 6 of 14 · Text-to-Speech API

Wrapping tags

Lesson 6 of 14 Updated November 3, 2026 Developer
On this page
  1. Change the speaking style of a stretch of text
  2. Wrapping tag syntax
  3. Volume and intensity
  4. Pitch and speed
  5. Vocal style
  6. Nesting rules
  7. Practical examples by use case
  8. Key takeaways

Updated November 3, 2026, based on the xAI Text to Speech page: the twelve official wrapping tags, in xAI’s three families. Source: Text to Speech.

Change the speaking style of a stretch of text

Unlike inline tags, which produce a one-off effect, wrapping tags change how a whole stretch of text is spoken. They use an XML syntax with an opening tag and a closing tag.

Wrapping tag syntax

Wrapping tags surround the text you want to change with <tag> and </tag>:

Here's some normal text, then <whisper>a whispered passage</whisper>, then back to normal.

The text inside the tags is spoken in the style you specify. The rest of the text keeps its normal prosody.

Volume and intensity

These tags control the intensity of speech:

  • <soft>: a soft, intimate voice, as if you were talking to someone close
  • <whisper>: a whisper, like a shared secret
  • <loud>: a loud voice, as if you were projecting across a large room
  • <build-intensity>: intensity that rises over the passage
  • <decrease-intensity>: intensity that falls off over the passage
<soft>I'm going to tell you a secret.</soft> [pause] <loud>Here it is!</loud>
<build-intensity>Three, two, one… let's go!</build-intensity>

The contrast between <soft> and <loud> is very effective for dramatic effects or for underlining important points.

Pitch and speed

These tags change the pitch of the voice and its pace:

  • <higher-pitch>: a higher voice, which can suggest surprise or excitement
  • <lower-pitch>: a lower voice, which suggests authority or seriousness
  • <fast>: faster speech, useful for legal disclaimers or secondary information
  • <slow>: slower speech, ideal for important instructions or dictation
<higher-pitch>Really? That's amazing!</higher-pitch>
Here's the main point. <fast>Terms and conditions are available on our website.</fast>
<slow>Repeat after me: hello, how are you?</slow>

To set the speed of a whole text rather than a passage, use the request’s speed parameter instead (lesson 2).

Vocal style

  • <sing-song>: a lilting, melodic delivery
  • <singing>: a singing style, for jingles or melodies
  • <emphasis>: emphasis, to highlight a word or a phrase
<singing>Happy birthday!</singing>
<emphasis>This is absolutely essential.</emphasis>

xAI recommends wrapping complete sentences rather than isolated words: <whisper>It's a secret.</whisper> sounds more natural than a single whispered word.

Nesting rules

You can combine wrapping tags, but make sure you nest them correctly:

<soft><slow>Listen carefully to this passage.</slow></soft>

Nesting must follow LIFO order (last opened, first closed), as in HTML. Avoid invalid overlaps:

<!-- Correct -->
<soft><slow>text</slow></soft>

<!-- Incorrect: overlap -->
<soft><slow>text</soft></slow>

Practical examples by use case

Podcast narration

[breath] <soft>Welcome to this episode.</soft> [pause]
Today, we're exploring a fascinating topic.
<emphasis>Generative artificial intelligence.</emphasis> [long-pause]
<slow>Take a moment to think about it.</slow>

Phone greeting

Hello, and thank you for calling Corsen AI. [pause]
<slow>For sales, press 1.</slow> [pause]
<slow>For technical support, press 2.</slow> [pause]
<fast>This call may be recorded to help us improve our service.</fast>

Educational content

Here's the key point to remember. [pause]
<emphasis><slow>The API returns audio bytes, not JSON.</slow></emphasis>
[long-pause] Make sure you handle the response as binary data.

Key takeaways

  • Wrapping tags use the <tag>text</tag> syntax
  • xAI publishes twelve of them: volume and intensity (<soft>, <whisper>, <loud>, <build-intensity>, <decrease-intensity>), pitch and speed (<higher-pitch>, <lower-pitch>, <slow>, <fast>), and vocal style (<sing-song>, <singing>, <emphasis>)
  • Wrap complete sentences rather than isolated words
  • Nesting is possible but must follow LIFO order
  • Combine inline and wrapping tags for an expressive result