DEV Community

VoiceDeveloper
VoiceDeveloper

Posted on

How to Write Text That Sounds Great When Spoken by AI

Why Writing for a Machine Voice Is Different

If you’ve ever listened to a TTS demo, you’ve probably noticed that the same paragraph that reads naturally on a page can sound stiff or robotic when spoken by an AI. The difference isn’t in the engine—it’s in the text you feed it.

When you write for a synthetic voice, you’re essentially writing a script for a performer who has no intuition about sarcasm, emphasis, or breath. Your job is to give the model the cues it needs to sound human‑like, and the best way to do that is to treat the text as a spoken script from the start.


The Core Things TTS Engines Care About

Feature What the engine “hears” How to help it
Punctuation Determines pauses and intonation. Use commas, periods, and ellipses deliberately.
Sentence length Long runs can cause monotone delivery. Break up complex ideas into bite‑size sentences.
Pronunciation Some words have ambiguous phonemes. Add phonetic hints with SSML or simple spelling tweaks.
Emphasis No built‑in sense of drama. Use capitalisation, asterisks, or SSML <emphasis> tags.
Breathing AI never “inhales” unless you tell it to. Insert short pauses (<break time="200ms"/>) where a human would breathe.

Understanding these quirks is the first step to writing text that sounds great when spoken.


Practical Tips for Writing Voice‑Ready Copy

  1. Write Like You Speak

    Read your draft out loud. If you stumble over a phrase, the AI will too. Aim for conversational cadence: short clauses, natural filler words (“you know”, “actually”) where appropriate.

  2. Use Simple Punctuation

    • Commas create brief pauses.
    • Periods signal a full stop and a natural breath.
    • Ellipses (…) suggest a thoughtful pause.

Example:

   Our new API is fast, reliable, and easy to integrate… you’ll be up and running in minutes.
Enter fullscreen mode Exit fullscreen mode
  1. Add Explicit Breaks with SSML Most modern TTS services support SSML (Speech Synthesis Markup Language). A <break> tag is the cleanest way to insert a breath without cluttering the text.
   <speak>
     Welcome to the future of voice AI.<break time="300ms"/>Let’s get started.
   </speak>
Enter fullscreen mode Exit fullscreen mode
  1. Guide Pronunciation For tricky names or acronyms, spell them out phonetically or use the <phoneme> tag.
   <phoneme alphabet="ipa" ph="ˈkɒnˌtɛkst">Context</phoneme>
Enter fullscreen mode Exit fullscreen mode
  1. Emphasize Key Words Use <emphasis level="strong"> to make a word stand out.
   <emphasis level="strong">Important</emphasis>
Enter fullscreen mode Exit fullscreen mode

Leveraging Voice Cloning with ElevenLabs

If you need a consistent brand voice or want to clone a speaker’s tone, ElevenLabs offers one of the most realistic voice‑cloning APIs on the market. Their service lets you upload a few minutes of reference audio and generate speech that sounds remarkably human.

You can sign up for a free trial and start experimenting right away: https://try.elevenlabs.io/kr07zfuqn1bp

Quick Python Example

Below is a minimal Python script that sends SSML to ElevenLabs and saves the resulting audio file. Install the requests library first:

pip install requests
Enter fullscreen mode Exit fullscreen mode
import requests

API_KEY = "YOUR_ELEVENLABS_API_KEY"
VOICE_ID = "YOUR_VOICE_ID"   # Grab this from the ElevenLabs dashboard

ssml = """
<speak>
  Hello, developers! <break time="200ms"/> 
  Today we’ll explore how to write text that sounds great when spoken by AI.
</speak>
"""

url = f"https://api.elevenlabs.io/v1/text-to-speech/{VOICE_ID}"
headers = {
    "xi-api-key": API_KEY,
    "Content-Type": "application/json"
}
payload = {
    "model_id": "eleven_monolingual_v1",
    "ssml": ssml,
    "voice_settings": {"stability": 0.75, "similarity_boost": 0.85}
}

response = requests.post(url, json=payload, headers=headers)

if response.status_code == 200:
    with open("output.wav", "wb") as f:
        f.write(response.content)
    print("Audio saved as output.wav")
else:
    print("Error:", response.status_code, response.text)
Enter fullscreen mode Exit fullscreen mode

What’s happening?

  • We send SSML, not plain text, so the <break> tag is honored.
  • stability and similarity_boost let you tweak how “steady” the voice sounds and how closely it matches the cloned voice.

Curl Alternative

If you prefer the command line, here’s a curl command that does the same thing:

curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/${VOICE_ID}" \
  -H "xi-api-key: YOUR_ELEVENLABS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
        "model_id": "eleven_monolingual_v1",
        "ssml": "<speak>Hello, world! <break time=\"300ms\"/>Enjoy your AI voice.</speak>",
        "voice_settings": {"stability":0.7,"similarity_boost":0.9}
      }' \
  --output voice_output.wav
Enter fullscreen mode Exit fullscreen mode

Both snippets illustrate how easy it is to feed carefully crafted SSML into a high‑quality voice model.


Iterating on Your Script

  1. Generate a Sample – Run the code above with a short paragraph.
  2. Listen Critically – Does the AI sound natural? Are there any “robotic” spots?
  3. Adjust Punctuation & Breaks – Add or remove commas, tweak <break> durations.
  4. Re‑run – A couple of iterations usually get you a polished result.

Because ElevenLabs returns a raw audio file, you can also run it through audio‑editing tools (Audacity, FFmpeg) if you need to splice or normalize volume.


Common Pitfalls & How to Avoid Them

Pitfall Symptom Fix
Over‑long sentences Monotone delivery, no breath points. Break into shorter sentences or insert <break> tags.
Missing punctuation AI runs words together. Add commas, periods, or ellipses where a human would pause.
Unclear pronunciation Mispronounced brand names or acronyms. Use <phoneme> or spell the word out phonetically.
Too much emphasis Speech sounds shouting. Reserve <emphasis> for truly important words.
Ignoring voice style settings Voice sounds flat or too “robotic”. Tweak stability and similarity_boost in the API request.

Wrap‑Up

Writing for AI‑driven speech isn’t a magic trick—it’s a disciplined form of copywriting that respects the constraints of the medium. By:

  • treating your text as a spoken script,
  • leveraging punctuation and SSML for natural rhythm,
  • testing iteratively with a robust voice‑cloning platform,

you can produce audio that feels genuinely human, even when generated by a machine.

Ready to put these tips into practice? Sign up for ElevenLabs, clone a voice that matches your brand, and start feeding it the carefully crafted SSML you’ve just learned to write. The link below gets you straight to the signup page:

Try ElevenLabs now: https://try.elevenlabs.io/kr07zfuqn1bp

Happy coding, and enjoy the sound of your own words coming to life!

Top comments (0)