Text to Speech MP3 Generator
Operator: Abdulla Al Fahad. How tools are built and checked
A chapter read by a flat, robotic voice is tiring after a minute, and the voices that sound human are usually sold by the character or by the month. This page runs Kokoro, a neural voice model with 82 million parameters, inside your browser tab, so a script, a handout or a book chapter becomes an MP3 or WAV without a subscription and without a character quota.
The limit is 25,000 characters per run, about half an hour of speech. Longer texts go in as several runs, and any text with chapter headings comes out as one file per chapter.
Key features
- Twelve English voices, eight American and four British, with speed from 0.6x to 1.6x
- Pasted text, or a .txt, .md, .docx or text-layer PDF file, up to 25,000 characters
- A new file at every "# Heading" or "Chapter 3" line, with a ZIP when there is more than one
- [pause 1s] and [pause 500ms] tags up to 10 seconds, plus automatic pauses after paragraphs and headings
- A pronunciation dictionary that takes a respelling in ordinary words or raw phonemes between slashes
- After every run, the list of words the lexicon did not contain and that were sounded out by letter rules
How the script is split, phonemised and spoken
Text counts without the pause tags. A .txt or .md file may be up to 10 MB, a .docx up to 25 MB and a PDF up to 50 MB, and a PDF must have a text layer: a scan holds only pictures and gives no text. Markdown marks are removed before speaking: heading hashes, bold and italic marks, link targets (the link text stays, a bare web address is spoken as the word "link") and images.
Headings are lines that start with one to three # signs, or that read Chapter, Part or Book followed by a number or a number word, up to 90 characters long. The heading is spoken as its own sentence and followed by 0.8 seconds of silence. Each paragraph break adds 0.45 seconds. Output is mono at 24,000 Hz: 16-bit WAV, or MP3 at 64 to 160 kbps, which is the most MP3 allows at that sample rate. Files are named 01-the-lighthouse.mp3 from the chapter number and the first 40 letters of its heading.
The Standard engine runs 8-bit weights on the CPU and downloads about 92 MB; the Fast engine runs full-precision weights on the GPU through WebGPU, about 326 MB, and is offered only when the browser reports WebGPU. If no GPU adapter can be opened, the page falls back to the Standard build. Two pronunciation lists of about 3 MB each and a voice file of about 0.5 MB come from jsDelivr and Hugging Face at fixed versions, and the browser keeps all of them for next time.
How it works
The text is cut at sentence ends into chunks of at most 260 characters. A full stop after Dr., St., Mr. and similar abbreviations does not end a sentence, and a sentence that is too long is cut at a comma, semicolon or colon, then at a space. Each chunk is one call to the model, which reads at most 510 phoneme tokens at a time.
Kokoro was trained on one phoneme alphabet, so each word is looked up in the Misaki lexicons: 90,201 entries in the gold list and 93,361 in the silver list for American voices, with a matching pair for the British voices. Endings such as -s, -ed and -ing are added by rule, and words with two readings, such as read, are chosen from the neighbouring words because the page has no part-of-speech tagger.
Numbers, dates, money and abbreviations are turned into words by code written for this page before the lookup. A word that is in neither list goes to letter-to-sound rules, and the page lists it so you can correct it in the dictionary.
Each chunk's waveform comes back from a worker as it is finished. Identical chunks are spoken once. Silences for pauses and paragraph breaks are inserted at the 24,000 Hz rate when the files are made, so changing the file type or bit rate does not need a new run of the model.
Common use cases
- A 3,800-word essay is about 22,000 characters, which the page estimates at 26 minutes of speech, so it fits in one run and comes out as an MP3 of about 25 MB at 128 kbps.
- A teacher pastes a 1,200-character listening exercise and puts [pause 2s] after every question so students have time to write before the next one is read.
- A course creator marks five lessons with "Chapter 1" to "Chapter 5" and downloads one ZIP with five numbered MP3 files, ready to upload as a playlist.
- A volunteer converts a 14,000-character .docx newsletter, which the page estimates at 16:40 of speech, for members who prefer to listen while driving.
How to use this tool
- Paste text into the box, or drop a .txt, .md, .docx or PDF file.
- Choose a voice and a speed, add dictionary lines for names, and press Generate speech.
- Press Make the file, or Make N files for a script with chapters, and listen to each one.
- Download one file, or the ZIP.
Example
The lighthouse sample text, with the dictionary line Dunmore = dun more and the Standard engine at 128 kbps
# The lighthouse
The lamp at Dunmore Point was lit on 14 March 1871, and it has not gone dark since. [pause 1s]
Keepers were paid $40.50 a month, plus a ration of oil.
# The storm
On the night of the 3rd of December, the wind reached 90 mph. Dr. Hale logged every hour until dawn.Files and how the page read the text
01-the-lighthouse.mp3: 0:16, 256 KB
02-the-storm.mp3: 0:10, 161 KB
"14 March 1871" is read fourteen March eighteen seventy-one, "$40.50" forty dollars and fifty cents, "3rd" third, "90 mph" ninety miles per hour and "Dr." doctor
Without the dictionary line, Dunmore is sounded out by letter rules as dˌʌnmˌɔɹ and listed as a word missing from the lexicon; with it, the phonemes are dˈʌn mˈɔɹEdge cases to watch
The voices speak English only. Text in another language is sounded out with English letter rules and is not understandable.
A word with two readings follows its neighbours: "I will read it" is spoken as present tense, and "read" is spoken as past only after words such as had, was or got, or when the sentence contains yesterday, ago or last week. Other past-tense uses of read or lead need a dictionary line.
A four-digit number is read as a year (1500 becomes fifteen hundred) unless the word before it is one of a short list such as over, about, than or only. Write "1,500" with a comma when you mean a quantity.
A PDF made from scanned pages has no text layer. The page reports that no text was found rather than guessing, so run it through OCR first.
- In raw phonemes, ˈ marks primary stress and the capitals A, I, O, W and Y stand for the vowels in say, my, go, now and boy. When a respelling gives the wrong stress, write the word as /dˈʌnmɔɹ/ with the stress where you want it.
- Put a [pause 1s] before a list of items. A paragraph break alone adds 0.45 seconds, which is too short for the voice to separate an introduction from the first item.
Common errors and how to fix them
- This text has 26,410 characters; the limit is 25,000
- Split the text at a chapter or section break and run each part. Pause tags do not count towards the limit.
- A model or lexicon file could not be downloaded
- Check that huggingface.co and cdn.jsdelivr.net are reachable and not blocked by an extension; files already downloaded are kept, so a retry continues where it stopped.
- Line 3 of the dictionary is not in the form word = spoken form
- Write one word, an equals sign and the spoken form. The word cannot contain spaces and the spoken form is limited to 120 characters.
Best practices
- Settle the dictionary and the pauses before pressing Generate speech. Any change to the text, voice, speed or dictionary clears the finished speech, and the model has to run again.
- Choose the Fast engine only for long texts. For a minute of speech the 326 MB download takes longer than the CPU build would take to read it.
Where the pronunciations come from
Many speech tools get pronunciations from espeak-ng, a rule-based engine released under GPL-3.0. This page does not use it. Words are looked up in Misaki, the word lists published with Kokoro under Apache-2.0 and pinned to one commit, and the rules for numbers, dates, abbreviations and unknown words are original code in this site. Kokoro itself is Apache-2.0.
The practical effect is that the voice is as good as the word list. Common words and many names are right; a rare surname or a brand name is not in the list and is sounded out from its spelling, which is the usual cause of an odd result and the reason for the dictionary box.
How numbers, dates and money are read
These rules apply before any word is looked up:
- Four-digit numbers are read as years, in pairs: 1871 is eighteen seventy-one, 2023 is twenty twenty-three and 1990s is nineteen nineties
- Ordinals such as 3rd and 21st become third and twenty-first
- $ £ and € amounts give units and subunits: $40.50 is forty dollars and fifty cents
- A number with a leading zero, and a US phone number such as 555 0142, is read digit by digit
- % & + @ = and # are read as percent, and, plus, at, equals and number; mph, kph, rpm and similar units after a number are spelled out
Frequently asked questions
Why does a name or brand come out wrong?
It is probably missing from the word list, and the page lists such words after each run. Add a line such as Okafor = oh kah for, or paste raw phonemes between slashes, then generate again.
Can the audio go into a video or a podcast?
The page adds no watermark, and the Kokoro model and the Misaki word lists are both published under Apache-2.0, a licence that permits commercial use.
Can it read a language other than English?
No; both lexicons and the letter rules are English. To go the other way and turn recorded speech into text, Audio to Text does that.