Book an info sessionInfo session

How computers hear: sound and speech

AI Explorers · lesson 6 of 24 · 25 min

You say “play my workout playlist” and a speaker across the room starts your music. Between your voice and that song, a lot happened in about a second.

Sound is vibration

Sound is air shaking. When you talk, your vocal cords make air vibrate, and those vibrations travel as sound waves. Fast vibrations sound high, like a whistle. Slow vibrations sound low, like a bass drum.

A microphone senses these vibrations. It measures the air pressure many thousands of times per second and stores each measurement as a number. Each measurement is called a sample. A common rate for music is 44,100 samples every second. So one second of sound becomes tens of thousands of numbers.

Seeing sound

To find patterns, AI systems often turn sound into a picture called a spectrogram. It shows time from left to right, pitch from bottom to top, and loudness as brightness. A whistle shows up as a thin line high up. A drum hit shows up as a burst near the bottom.

Turning sound into a picture is clever because it lets AI use the same kind of pattern-finding it uses for images. You will see this for yourself if you build a sound model in Unit 5.

From sound to words to meaning

A voice assistant does several jobs in a row:

  1. Wake word: listen for one special word or phrase that means “I’m talking to you.”
  2. Speech recognition: turn the sound of your speech into text.
  3. Understanding: figure out what you want. “Play my workout playlist” is a request to play music, and “workout” names which list.
  4. Action and reply: do the task and maybe answer with a computer voice.

Each step can go wrong. Background noise, a crowded room, fast talking or slang can trip up speech recognition. Systems also tend to do better with accents and ways of speaking they heard a lot of in training, and worse with ones they heard less. That is a real fairness issue: your voice deserves to be understood as well as anyone’s.

Sound AI is not only about words. Some phones can notice sounds like a smoke alarm, a doorbell or a baby crying and send an alert, which helps people who are deaf or hard of hearing. Music apps can recognize a song from a few seconds of audio by matching its sound pattern. Each of these turns sound into numbers, finds a pattern, and decides what the sound is.

Try it

  1. Find a quiet spot. With a family member or friend, take turns saying the same short sentence, like “Turn on the kitchen light,” in different ways: whispering, fast, slow, with a cold, from across the room.
  2. For each version, the listener writes what they heard.
  3. Now make it harder: turn on music or a fan and repeat.
  4. Make a short list: which versions were hardest to understand, and why?
  5. Write two sentences: if a computer had to understand all these versions, what kinds of examples would it need to learn from?

Check yourself

What is a sound sample?

One measurement of air pressure taken by a microphone at one instant. Thousands of samples per second make a digital sound.

What does a spectrogram show?

Sound as a picture: time across, pitch up and down, and loudness as brightness.

Why might speech recognition work worse for some accents?

It may have learned from fewer recordings of those accents, so it knows their patterns less well.

Key words

  • Sound wave: vibrations traveling through the air.
  • Sample: one measurement of sound at one moment.
  • Spectrogram: a picture of sound over time.
  • Speech recognition: turning spoken words into text.
  • Wake word: a word that tells a device to start listening.

Previous lesson: How computers see: from pixels to patterns
Back to AI Explorers
Next lesson: Turning the world into data