aifree.dev

How does it turn text into a voice that sounds human?

Text-to-speech: phonemes, prosody and the waveform · Beginner · 5 min · tokens, transformer · after Speech-to-text: spectrograms and audio tokens (Whisper)

A text-to-speech model rewrites your text as sounds (phonemes), predicts how long each sound lasts and where the pitch goes, then writes the waveform: tens of thousands of numbers a second, almost none of them spelled out in the text.

Before you start: could you explain this to a friend?

1 = not at all · 5 = easily

  1. 1 Guess first

    Kokoro, a small open voice model, reads “It’s raining.” aloud: 13 characters. How many numbers are in the audio it writes?
  2. 2 Look

    From your text to a voice

    1 / 4

    It’s raining.

    ↓ rewritten as sounds (IPA phonemes; ˈ marks the stressed syllable)

    ɪts ɹˈeɪnɪŋ.

    12 symbols → 14 numbers the model reads (one per symbol, plus a start and an end).

    Measured with Kokoro-82M v1.0 (kokoro-js 1.2.1, eSpeak NG phonemes) · 2026-10-23

    Spelling is not sound: the first step rewrites your text as phonemes, numbers and all.

    The text only says which sounds to make. How long each one lasts, the melody and the voice are predicted by the model, then written out as 24,000 numbers a second.

  3. Three things get added. First phonemes, the sounds a word is made of, because spelling is not sound. Then prosody, the timing and melody of speech. Then the voice. Kokoro learned prosody from a few hundred hours of recorded speech: it repeats patterns it heard, not grammar rules.

  4. 4 You are the model

    You are the first step. For five bits of text, choose how each is said, then compare with the sounds Kokoro actually made.

    you are the first step · turn the text into sounds · then see what Kokoro said

    Dr. Lee lives on Main St.

    How is “Dr.” said?

    Measured with Kokoro-82M v1.0 (kokoro-js 1.2.1, eSpeak NG phonemes) · 2026-10-23

    You are the first step. How should this be said?
  5. 5 Check

    “The wind was too strong to wind the sail.” What makes this hard for a voice model?
  6. It is speech-to-text in reverse. Whisper squeezes 16,000 numbers a second down to a few words; a voice model grows 13 characters into 37,200 numbers, and each added number is a guess learned from recordings. Kokoro is small: 82 million parameters. Commercial voices do not publish their size, so test them yourself.

  7. 7 Say it back

  8. 8 Mission · 5 min

    On ElevenLabs’ free plan, generate “It’s raining.” and then “It’s raining?” with the same voice, and listen to the last word. Then generate “I read it yesterday.” Does the question rise, and do you hear “red” or “reed”?

Three quick ones

Drawn at random from this lesson's pool; different next time.

Done?

Now: could you explain this to a friend?

1 = not at all · 5 = easily

Answer the three quick ones first.

Sources

  • Measured 2026-10-23 with scripts/explain-data/text-to-speech.ts: Kokoro-82M v1.0 (onnx-community/Kokoro-82M-v1.0-ONNX, fp32, CPU) through kokoro-js 1.2.1, voice af_heart unless named. “It’s raining.” → phonemes ɪts ɹˈeɪnɪŋ., 14 input ids, 37,200 samples (1.55 s at 24,000 Hz); “It’s raining?” 37,200; “Is it raining?” 39,000; speed 1.5 → 23,400; voice am_michael → 40,200
  • Same run: pitch tracked by the script (normalised autocorrelation, one value every 10 ms): middle pitch 231 Hz (Heart), 128 Hz (Michael), 211 Hz (Heart at 1.5×); last voiced value 179 Hz for “It’s raining.” and 178 Hz for “It’s raining?”
  • Same run, phonemes from kokoro-js’s normaliser and eSpeak NG: “Dr.” → dˈɑːktɚ, “$5.50” → fˈaɪv dˈɑːlɚz ænd fˈɪfti sˈɛnts, “1999” → nˈaɪntiːn nˈaɪndi nˈaɪn, “lives” (Dr. Lee lives on Main St.) → lˈaɪvz, “read” (I read it yesterday.) → ɹˈiːd, “10:30” → tˈɛn θˈɜːɾi; voice files 510 × 256 floats (522,240 bytes), one row of 256 used per input
  • https://huggingface.co/hexgrad/Kokoro-82M (checked 2026-10-23): 82 million parameters, Apache-2.0, v1.0 of 2025-01-27 trained on a few hundred hours of permissive audio with IPA phoneme labels; architecture StyleTTS 2 and ISTFTNet; 24,000 Hz output
  • https://arxiv.org/abs/2306.07691 (Li et al. 2023, StyleTTS 2): style diffusion and adversarial training; Whisper’s 16,000 Hz input from the speech-to-text lesson (openai/whisper audio.py SAMPLE_RATE 16000)
  • aifree.dev catalog elevenlabs-free-plan (verified 2026-10-12) and /learn/free-text-to-speech-api (ElevenLabs pricing checked 2026-10-19): Free plan 10,000 credits a month, no card, Multilingual v2 1 credit per character; every provider in that guide meters text-to-speech by text length

Published Oct 23, 2026 · updated Oct 23, 2026

Embed this

Paste this into a blog post or course page: the lesson's main picture in an iframe, with a link back to the full lesson.

<iframe src="https://aifree.dev/embed/explain/text-to-speech" width="100%" height="620" style="border:0;max-width:720px" title="How does it turn text into a voice that sounds human? (aifree.dev Explain)" loading="lazy"></iframe>
<p><a href="https://aifree.dev/explain/text-to-speech">How does it turn text into a voice that sounds human? Interactive lesson on aifree.dev</a></p>

Never miss new offers and news

New tools, credits, and AI news are added regularly. Pick how you want to hear about them.

Telegram channel
Join @aifree_dev and get new free AI offers and news right in your Telegram feed.
Browser notifications
Turn on push notifications and get an alert on this device whenever something new is posted. No account needed.
Email newsletter
A weekly digest of new, changed and expiring free AI offers. Double opt-in, one-click unsubscribe.

Unsubscribe anytime. Privacy

Frequently asked questions

What is aifree.dev?

aifree.dev helps everyone access AI through a curated directory of free AI tools, API credits, free tiers, and startup programs for coding, image, voice, video, and students - verified regularly.

How are offers presented?

Each offer includes its access details, free models when available, and expiration information when provided. Limited-time deals stay visible so they are easy to compare.

Do education and startup programs need verification?

Yes. Providers usually ask students to verify their status with a school email, student ID, or a program like the GitHub Student Pack, and ask startups to verify company details such as age, funding, or website. Check each offer’s claim page for the exact requirements.

What kinds of free AI offers are listed?

Free tiers and free trials from AI providers, free API credits, startup and student programs, and free tools for coding, image generation, voice, and video.

How can I suggest a tool or report a broken link?

Use the submit form: paste the offer page URL and a short note. A person checks every submission before anything is listed. Broken links and changed terms go through the same form.

+

Know a good one?

Tell us about an AI tool worth knowing. Found a broken link? We want to hear that too.

Submit an offer