Sound as numbers
Sound is air pressure going up and down very fast. A microphone measures that pressure many times a second and stores each measurement as a number. How many times a second is the sample rate. How exactly each number is stored is the bit depth: 16 bits allow 65,536 different values.
There is a simple rule: to store a sound, you need more than two measurements for every vibration. So a sample rate can only hold sounds up to half its own value. People hear up to about 20,000 vibrations a second (20,000 hertz), which is why music CDs use 44,100 numbers a second. The sounds that tell words apart lie mostly lower, so most speech models use 16,000 a second. Old telephone lines used 8,000, which loses the high hiss of “s” and “f”.
16,000 × 60 = 960,000numbers from the microphone
960,000 × 2 bytes = 1.92 MBat 16 bits each
about 150 words ≈ 200 tokensthe same minute written down as text (the tokens lesson)
This interactive part needs JavaScript.
Quick check
A picture of sound: the spectrogram
Almost a million numbers a minute is a lot, and single numbers say little on their own. So most speech models first turn sound into a spectrogram. Cut the sound into short, overlapping slices. For each slice, measure how strong each pitch is, from low to high. Line the slices up, and you get a picture: time runs across, pitch runs up, and brightness shows loudness.
The pitches are not measured evenly. Our ears tell low pitches apart finely and high ones roughly, so the bands are narrow at the bottom and wide at the top, following a scale called mel. The result is a mel spectrogram.
slices of 25 ms, one every 10 msso 100 slices a second
80 mel bands per slice128 in Whisper large-v3
30 seconds → 3,000 slicesWhisper always reads 30 seconds at a time
3,000 ÷ 2 = 1,500vectors after the encoder halves the length: 50 a second
Quick check
Speech to text: Whisper and after
In 2022 OpenAI released Whisper with open weights. It is an encoder–decoder transformer (the transformer lesson), trained on 680,000 hours of audio with transcripts found on the web, including 117,000 hours in 96 languages other than English. The encoder reads 30 seconds of mel spectrogram. The decoder then writes the text one token at a time, exactly like a language model (the press-enter lesson). It starts with special tokens that say which language it hears and whether to write it down or translate it into English. Whisper large-v3 (2023) was trained on 1 million hours with transcripts found on the web and 4 million more hours transcribed by an earlier Whisper.
- Microphone16,000 numbers a second
- Mel spectrogram100 slices a second
- Encoder50 vectors a second, 30 seconds at a time
- Decoderwrites text tokens one by one, reading the encoder’s vectors
- Textwith times for each piece
Whisper is still the most used open model: a study published in September 2026 counted about 4.6 million downloads a month of Whisper large-v3 from Hugging Face, eight times more than its nearest open rival. But newer models cover more languages, and many of them come from Chinese labs.
| Model | From | Languages | Worth knowing |
|---|---|---|---|
| Whisper large-v3 | OpenAI, 2023 | About 100 | The most used; sizes from 39 million to 1.55 billion parameters; MIT licence |
| Dolphin | DataoceanAI and Tsinghua University, 2025 | 40 Eastern languages and 22 Chinese dialects | Built on Whisper’s design; small sizes open under Apache 2.0 |
| Omnilingual ASR | Meta, November 2025 | More than 1,600, including over 500 never served before | From 300 million to 7 billion parameters; adds a new language from a few examples; Apache 2.0 |
| Qwen3-ASR | Alibaba, January 2026 | 30 languages and 22 Chinese dialects | Built on a language model; 0.6 and 1.7 billion parameters |
From each model’s report and model card.
Quick check
How good is it? The word error rate
Speech recognition is measured with the word error rate (WER). Take what was really said and what the machine wrote. Find the fewest changes that turn one into the other: words changed, words missing and words added. Divide by the number of words that were said.
WER = (changed + missing + added) ÷ words saidpapers write (S + D + I) ÷ N
“two” → “too”, and “the” added1 changed and 1 added, in “Please take two tablets after food”
2 ÷ 6 = 33 %the word error rate
This interactive part needs JavaScript.
Added words have no limit, so the word error rate can go above 100 %. A machine that hears 6 words and writes 15 has made at least 9 errors. Rates above 100 % usually mean invented text.
Some languages do not put spaces between words, such as Chinese and Thai, so they are measured with the character error rate (CER) instead: the same sum, counted in letters. Spacing is a problem in Urdu too: writers place spaces between word parts differently, so the same sentence can count as a different number of words. The authors of a 2025 Urdu benchmark warned that scores mean little without careful rules for tidying the text first.
Quick check
Your language: real error rates
Accuracy follows data. The Whisper paper showed that the more hours of a language a model is trained on, the fewer errors it makes in that language, and many of the world’s languages had only a few hours. Here are measured results for languages of this course.
| Language and test | Model | Error rate |
|---|---|---|
| Urdu, everyday conversation (2025 benchmark) | Whisper large-v3, as released | 18 % WER |
| Urdu, the same conversations | Whisper small, as released | 56 % WER |
| Urdu, the same conversations | Whisper tiny and base, as released | Over 160 %: invented and repeated words |
| Urdu, read speech | Seamless large (Meta): as released, then trained further | 24 %, then 17 % WER |
| Pashto, Common Voice recordings (2026 study) | Every Whisper size, as released | Over 100 %, written in Arabic, Dari or Urdu script |
| Pashto, the same test | Whisper small, trained further on 113 hours | 25 % WER |
| Pashto, the same test | Whisper large-v3-turbo, trained the same way | 23 % WER |
| More than 1,600 languages | Omnilingual ASR, 7 billion parameters | CER under 10 % in 78 % of them |
From the papers listed at the end. Each test used its own recordings, so compare rows only within the same test.
Script is a trap too. A 2025 study found that Whisper wrote Punjabi in Gurmukhi, the script used in India, although about 94 million people write Punjabi in Shahmukhi, the Perso-Arabic script used in Pakistan. A transcript in the wrong script is useless to its reader, even if every word is right.
Communities can build that data themselves. The Pashto hours came from Mozilla’s Common Voice, which collects recordings that volunteers donate, in more than a hundred languages, and gives them away under a public-domain licence. Pashto is one of its largest collections, because Pashto speakers recorded and checked it. For Omnilingual ASR, Meta paid local partners to record speech in 350 underserved languages and released those recordings too. Every hour recorded and checked by speakers of a language makes the next model better for them.
Quick check
Try it on your own computer
faster-whisper runs Whisper on an ordinary processor, with no graphics card and no internet after the first download. The recording below was made with the English voice built into Windows, reading two sentences a nurse might say.
# Tested together for this lesson. The newest PyAV (19) did not work with faster-whisper 1.2.1.
pip install faster-whisper==1.2.1 av==15.1.0
python transcribe.py speech.wav
- The first run downloads the model: 75 MB for tiny, 142 MB for base, 464 MB for small.
- On the test computer’s processor, the whole run took about five seconds, loading included.
"""transcribe.py: turn speech into text on your own computer.
pip install faster-whisper, then: python transcribe.py speech.wav"""
import sys
from faster_whisper import WhisperModel
# "base" is about 140 MB and is downloaded once. For other languages, try "small" or "large-v3-turbo".
model = WhisperModel("base", device="cpu", compute_type="int8")
# vad_filter skips the parts with no voice, where Whisper is most likely to invent words
segments, info = model.transcribe(sys.argv[1], beam_size=5, vad_filter=True)
print(f"language: {info.language} ({info.language_probability:.0%} sure), {info.duration:.1f} seconds of audio")
for s in segments:
print(f"[{s.start:5.1f} to {s.end:5.1f}] {s.text.strip()}")
compute_type="int8"stores the weights in 8 bits (the quantization lesson), which makes the model smaller and faster on a processor.beam_size=5keeps the five best guesses at each step and picks the best whole sentence at the end (the sampling lesson).vad_filter=Trueruns a small voice detector first and skips the parts without speech.- Add
language="ur"(or"pa","ps","sd","bn","ha"…) totranscribeto choose the language yourself.
language: en (100% sure), 8.9 seconds of audio
[ 0.0 to 4.6] Please take two tablets after food, and drink plenty of water.
[ 4.6 to 8.6] Come back to the clinic on Monday if the fever does not go down.
- Every word is right. That is a clear computer voice in a quiet file; real voices in real rooms are harder.
Now make it harder. The program below adds more and more random noise to the same recording and measures the word error rate of three model sizes. The signal-to-noise ratio says how much louder the voice is than the noise, in decibels: 10 dB means the voice has ten times the noise’s power, 0 dB means they are equally loud, and −5 dB means the noise is about three times stronger.
"""noise_test.py: add more and more noise to a recording and measure the word error rate.
pip install faster-whisper, record yourself reading REF as speech.wav, then: python noise_test.py"""
import re
import numpy as np
from faster_whisper import WhisperModel, decode_audio
REF = ("Please take two tablets after food, and drink plenty of water. "
"Come back to the clinic on Monday if the fever does not go down.")
def words(s):
return re.sub(r"[^\w\s']", " ", s.lower()).split() # small letters, no punctuation
def wer(ref, hyp):
"""Word error rate: the fewest changes, missing and added words that turn ref into hyp."""
r, h = words(ref), words(hyp)
d = list(range(len(h) + 1))
for i in range(1, len(r) + 1):
prev, d[0] = d[0], i
for j in range(1, len(h) + 1):
prev, d[j] = d[j], min(d[j] + 1, d[j - 1] + 1, prev + (r[i - 1] != h[j - 1]))
return d[len(h)] / len(r)
speech = decode_audio("speech.wav") # 16,000 numbers a second, between -1 and 1
power = np.mean(speech[np.abs(speech) > 0.01] ** 2) # how loud the voice is
noise = np.random.default_rng(2).standard_normal(len(speech)).astype(np.float32)
for size in ("tiny", "base", "small"):
model = WhisperModel(size, device="cpu", compute_type="int8")
for snr in (30, 10, 5, 0, -5): # signal-to-noise ratio in decibels: 0 means as loud as the voice
mixed = speech + noise * np.sqrt(power / 10 ** (snr / 10))
segments, _ = model.transcribe(mixed, beam_size=5, language="en", vad_filter=True)
hyp = " ".join(s.text.strip() for s in segments)
print(f"{size:6}{snr:4} dB WER {wer(REF, hyp):4.0%} {hyp}", flush=True)
- Record yourself reading
REF, in any language, and changeREFandlanguageto match. Your own test tells you more than any table. weris the same counting as the demo above, written in eight lines.
tiny 30 dB WER 0% Please take two tablets after food, and drink plenty of water. Come back to the clinic on Monday if the fever does not go down.
tiny 10 dB WER 0% Please take two tablets after food, and drink plenty of water. Come back to the clinic on Monday if the fever does not go down.
tiny 5 dB WER 4% Please take two tablets after food, and drink 20 of water. Come back to the clinic on Monday if the fever does not go down.
tiny 0 dB WER 52% Keep take two hours after two, and then find you a water. Come back to the center of the mandate that the leader does not go down.
tiny -5 dB WER 156% He took two classes out of two, and he's going to find a lot of it. He's going to find out if he's going to find a lot of it. He's going to find out if he's going to find a lot of it.
base 30 dB WER 0% Please take two tablets after food, and drink plenty of water. Come back to the clinic on Monday if the fever does not go down.
base 10 dB WER 0% Please take two tablets after food and drink plenty of water. Come back to the clinic on Monday if the fever does not go down.
base 5 dB WER 8% Please take two tablets after feet, and drink plenty of water. Come back to the cynic on Monday if the fever does not go down.
base 0 dB WER 16% Please take two tablets back to sea and drink plenty of water. Come back to the tent on Monday if the fever does not go down.
base -5 dB WER 64% It should keep happening as it is. You can't find your water. Come back to the center and remember that the river does not go down.
small 30 dB WER 0% Please take two tablets after food, and drink plenty of water. Come back to the clinic on Monday if the fever does not go down.
small 10 dB WER 0% Please take two tablets after food and drink plenty of water. Come back to the clinic on Monday if the fever does not go down.
small 5 dB WER 0% Please take two tablets after food and drink plenty of water. Come back to the clinic on Monday if the fever does not go down.
small 0 dB WER 4% Please take two tablets after tea, and drink plenty of water. Come back to the clinic on Monday if the fever does not go down.
small -5 dB WER 36% She takes two tablets at a time, and drinks twenty of water. Come back to the things on Monday that the fever does not go down.
- The small model stayed almost perfect until the noise was as loud as the voice. At 0 dB it heard “after tea” instead of “after food”: one wrong word, in a sentence that still sounds right.
- The tiny model at 0 dB wrote a fluent sentence that no one said. At −5 dB it invented a sentence and repeated it: 156 % errors.
- None of the mistakes look like mistakes. You cannot find them by reading the transcript; only by listening.
Quick check
When a transcript invents words
In 2023 researchers sent 13,140 short recordings to OpenAI’s Whisper service. About 1 % of the transcripts contained whole phrases or sentences that were not in the audio at all, and 38 % of those invented passages were harmful: violence, false claims about people, or made-up authority. It happened more often for speakers with aphasia, a condition that causes long pauses in speech. Long silences give the decoder room to keep writing.
Silence is the worst case. A study published in September 2026 played 42 clips of pure room noise, with no one speaking, to Whisper large-v3. It wrote words for 62 % of them. Training can reduce this, but every fix the study tested also made the model a little worse in other languages.
One per cent sounds small. But speech recognition now writes doctors’ notes, court records, subtitles and interviews. In a hospital that transcribes a thousand short recordings a day, one per cent is ten a day with words no one said.
Quick check
Sound as tokens: codecs
Writing text from speech is half the job. For a model to speak, sound must become tokens it can predict, and tokens must turn back into sound. A neural codec does both. Its encoder squeezes the sound into a few vectors a second. Each vector is replaced by the number of the closest entry in a list, a codebook, just as pictures were in the images-video lesson. A decoder turns the numbers back into sound.
One codebook is too rough, so codecs use residual vector quantization: the first codebook gives a rough answer, the second codes what the first got wrong, the third what is still left, and so on.
24,000 numbers a second → 12.5 frames a secondone frame for every 80 milliseconds
8 codebooks of 2,048 entrieseach code is 11 bits, because 2¹¹ = 2,048
12.5 × 8 × 11 = 1,100bits a second
24,000 × 16 = 384,000bits a second as plain 16-bit numbers: about 350 times more
Codes can carry two kinds of information. Semantic codes carry what is said; acoustic codes carry how it sounds: the voice, the mood, the room. Mimi trains its first codebook to match a model that understands speech, so the first code of each frame carries mostly meaning and the other seven carry sound. Alibaba’s Qwen3-Omni also reads sound at 12.5 vectors a second.
Quick check
Machines that speak, and copy voices
Text-to-speech (TTS) used to work in two stages: one network drew a spectrogram from the text, and a second, the vocoder, turned it into sound. Today’s models predict codec tokens like a language model, or draw the sound with flow matching (the images-video lesson), or both: Alibaba’s CosyVoice writes speech tokens with a language model and finishes them with flow matching.
These models can also copy a voice. Give them a few seconds of someone speaking, and they continue in that voice. Alibaba’s Qwen3-TTS (January 2026), trained on more than 5 million hours of speech, copies a voice from 3 seconds and starts speaking after about a tenth of a second (97 milliseconds, in its makers’ tests). It is open under Apache 2.0.
But look at the languages. Qwen3-TTS speaks 10: Chinese, English, Japanese, Korean, German, French, Russian, Spanish, Italian and Portuguese. Like most of the best voice models, it speaks none of Urdu, Punjabi, Pashto, Sindhi, Bengali, Hausa or Swahili. Meta’s older MMS models speak more than 1,100 languages, but more simply, and only for non-commercial use. Your phone or computer may already have a voice for your language: this site’s Listen button uses only those built-in voices, so nothing you read is sent anywhere.
Music uses the same tools. YuE, from the Hong Kong University of Science and Technology and the M-A-P community (January 2025, Apache 2.0), writes whole songs, singing and backing, from lyrics. ACE-Step 1.5 (January 2026) makes a full song in under 10 seconds on an RTX 3090 with less than 4 GB of graphics memory, its makers report. In 2024 the biggest record companies took two music services, Suno and Udio, to court, saying they had trained on the companies’ recordings without permission; some of those cases were settled in 2025. The question of who should be paid when a model learns from someone’s work is still open.
Quick check
Talking with a model
The simple way to talk with a model is a chain of three: speech recognition writes down what you said, a language model writes a reply, and text-to-speech reads it out. It is easy to build, and it works in any language you have all three parts for. But each part waits for the one before, and the tone of your voice is lost the moment your words become text.
In conversation, people answer fast: a study of ten languages found an average gap of about 230 milliseconds between one person stopping and the next starting. A chain of three often takes a second or more, which feels like talking on a bad phone line.
Newer models listen and speak in one network. Kyutai’s Moshi (Paris, 2024) hears you and speaks at the same time, so you can interrupt it, as in real talk. Its delay is 160 milliseconds in theory and about 200 in practice. Alibaba’s Qwen3-Omni (September 2025) splits the work in two: a Thinker writes the reply as text, and a Talker turns it into speech tokens at once, reaching the first sound after 234 milliseconds in its makers’ tests. It is a mixture-of-experts model with 30 billion parameters, 3 billion active (the mixture-of-experts lesson).
| Chain of three | One model that listens and speaks | |
|---|---|---|
| Delay | Often a second or more | About 200 to 250 milliseconds in the best open models |
| Tone of voice | Lost when speech becomes text | Can be heard and used |
| Interrupting | Hard: each part waits its turn | Possible in full-duplex models such as Moshi |
| Languages | Any language you have three parts for | Only the languages it was trained to hear and speak |
| Checking | Every step can be read as text | Harder to see what went wrong |
Quick check
Voices and honesty
Three seconds of your voice from a video is enough to copy it. Criminals use this. In December 2024 the US FBI warned that criminals make short clips in the voice of a close relative “in a crisis situation, asking for immediate financial assistance or demanding a ransom”. Its first piece of advice was simple: agree on a secret word or phrase with your family.
- A call asks for money urgently, in a voice you know. Stop: the hurry is the trick.
- Ask for your family’s secret word.
- Hang up and call back on a number you already have for that person.
- Never send money, phone credit, gift cards or crypto because of a voice alone.
Use these tools fairly too. Never copy someone’s voice without their permission. Say when a voice was made by a machine. Ask before you record or transcribe people, and know that the rules for recording differ from country to country.
Is each use fine, or one to avoid or check first?
-
Transcribing your own recorded lecture notes
Answer: Fine
-
Making minutes of a meeting, with everyone’s permission
Answer: Fine
-
Taking a medicine dose from a transcript without listening yourself
Answer: Avoid, or check first
-
Copying a friend’s voice for a prank call
Answer: Avoid, or check first
-
Having your phone’s voice read a web page aloud
Answer: Fine
-
Sending money after a call in your brother’s voice
Answer: Avoid, or check first
-
Subtitling a video in your language, then checking the subtitles
Answer: Fine
-
Using a transcript as proof in a dispute, without the recording
Answer: Avoid, or check first
Remember
- Sound is stored as numbers: 16,000 a second for most speech models. A sample rate holds sounds up to half its value.
- A mel spectrogram shows how strong each pitch is over time. Whisper reads 30 seconds of it at a time and writes text with a language-model decoder.
- The word error rate is (changed + missing + added) ÷ words said. Invented words can push it above 100 %.
- Accuracy follows data. Every Whisper size fails on Pashto as released; trained further on 113 hours of it, they reach 23 to 25 %. Check the script as well as the words.
- Errors in transcripts look fluent and believable. Keep the recording and listen again to what matters.
- Codecs turn sound into a few frames a second of codebook numbers, rough first and finer after. Mimi needs 1,100 bits a second.
- Voice models can copy a voice from 3 seconds, but the best ones speak only about ten languages.
- One model that listens and speaks can answer in about a fifth of a second; a chain of three is slower but works with any parts you have.
- Agree on a family secret word, and never send money because of a voice alone.
Words to know
- Sample rate
- How many numbers a second a recording stores. It can hold sounds up to half that rate.
- Hertz (Hz)
- Vibrations, or measurements, per second.
- Bit depth
- How many bits store each number of a recording: 16 bits give 65,536 levels.
- Mel spectrogram
- A picture of sound: time across, pitch up, with pitch bands spaced the way our ears hear.
- Speech recognition (ASR)
- Turning speech into text. ASR stands for automatic speech recognition.
- Word error rate (WER)
- Words changed, missing and added, divided by the words that were said.
- Character error rate (CER)
- The same count in letters, for languages without spaces between words.
- Voice detector (VAD)
- A small model that finds the parts of a recording where someone speaks.
- Signal-to-noise ratio
- How much stronger the voice is than the noise, in decibels. 0 dB means equally loud.
- Neural codec
- A network that turns sound into a few codebook numbers a second, and back into sound.
- Residual vector quantization
- Coding a vector in steps: each codebook codes what the earlier ones got wrong.
- Text-to-speech (TTS)
- Turning text into spoken sound.
- Voice cloning
- Making a model speak in a particular person’s voice from a short sample of it.
- Full duplex
- Listening and speaking at the same time, so either side can interrupt.
Go to the source
This lesson is built on these papers and documents. Paper links open arxiv.org, a separate site.
-
Robust Speech Recognition via Large-Scale Weak Supervision
Whisper: 680,000 hours from the web, one model for many languages, and how errors fall as data grows.
-
Dolphin: A Large-Scale Automatic Speech Recognition Model for Eastern Languages
DataoceanAI and Tsinghua University extend Whisper’s design to 40 Eastern languages and 22 Chinese dialects.
-
Omnilingual ASR: Open-Source Multilingual Speech Recognition for 1600+ Languages
More than 1,600 languages, new ones from a few examples, and recordings made with paid local partners.
-
Qwen3-ASR Technical Report
Speech recognition built on a language model, with Chinese dialects and language identification.
-
WER We Stand: Benchmarking Urdu ASR Models
Whisper, MMS and Seamless on read and conversational Urdu, and why text normalisation matters.
-
Benchmarking Whisper for Low-Resource Speech Recognition: An N-Shot Evaluation on Pashto, Punjabi, and Urdu
Including Whisper writing Punjabi in Gurmukhi instead of Shahmukhi.
-
Fine-tuning Whisper for Pashto ASR: strategies and scale
From over 100 % errors to about 23 % with 113 hours of Pashto.
-
Careless Whisper: Speech-to-Text Hallucination Harms
Invented phrases in about 1 % of transcripts, and who is hurt most.
-
How to Reduce Whisper Hallucination
Whisper large-v3 wrote words on 62 % of clips of silent room noise; every fix tested cost some accuracy in other languages.
-
Moshi: a speech-text foundation model for real-time dialogue
Kyutai’s full-duplex model and the Mimi codec at 12.5 frames a second.
-
Qwen3-Omni Technical Report
Thinker and Talker, an audio encoder trained on 20 million hours, and 234 milliseconds to the first sound.
-
Qwen3-TTS Technical Report
Voice copying from 3 seconds, voices described in words, and two speech tokenizers.
-
CosyVoice 3: Towards In-the-wild Speech Generation via Scaling-up and Post-training
Alibaba’s speech tokens from a language model, finished with flow matching; 1 million hours in 9 languages and 18 Chinese dialects.
-
YuE: Scaling Open Foundation Models for Long-Form Music Generation
Whole songs from lyrics, open under Apache 2.0.
-
ACE-Step 1.5: Pushing the Boundaries of Open-Source Music Generation
A full song in seconds on a home graphics card.
-
FBI: Criminals Use Generative Artificial Intelligence to Facilitate Financial Fraud
Cloned voices in fake emergencies, and the family secret word.
Check yourself
6 questions. Tap the answer you think is right.
0 of 6 answered
Lesson complete
Answer every question above to complete this lesson.
Your progress is saved on this device only.
Next lessonRobots and world models: AI that acts in the real world