🎤 Machines That Hear · Day 12

Is Anyone Talking?

Before an assistant can understand you, it has to answer a simpler question: are you even speaking right now? It listens to the loudness and decides "talking" or "silence" — and figures out when your sentence ends so it can reply. Let's build that detector.

↓ let's detect speech
🏷️ The pro wordEngineers call this a Voice Activity Detector (VAD). Deciding when your sentence has finished is called endpointing. If you build a voice app, you'll use a VAD to know when to start and stop recording — it's step one of every assistant.
🎚️ Lab · The Speech Gate

Talking, or silence?

The green line is how loud it is right now. The yellow line is your threshold: louder than it = "talking", quieter = "silence". After enough silence, the VAD decides your sentence ended. Tune the two sliders!

off
⚪ silence
18

threshold — too low → triggers on noise; too high → misses quiet talking

0.8

silence timer (the "hangover") — how long of quiet = end of sentence

🎯 Goal: tune it so the demo's 3 sentences are each detected cleanly (green while talking, "END" after each). Sentences detected: 0 / 3
💡 Why It Matters

The trade-offs a real builder tunes

📉

Threshold too low

It thinks the fan or your breathing is "talking" — false triggers. Wastes battery, records noise.

📈

Threshold too high

It misses your quiet words — clipping the start of your sentence.

Silence timer

Too short → it cuts you off during a pause. Too long → it feels slow to reply. This is endpointing.

🛡️ A good VAD is also great for privacy — the assistant only really "wakes up" and records when it detects real speech, not all the time.
🚀 Beyond the Basics

How the pros really do it

The loudness threshold you built is the idea — simple enough to see how VAD works. But it's easily fooled by loud rooms and music. Real products use smarter methods:

🟢

Energy threshold (what you built)

✅ Tiny, instant, runs anywhere. ⚠️ Picks a fixed loudness line — noise, music, or a fan can fool it.

📈

Smarter signal VAD

Checks the frequencies of speech, not just loudness (e.g. WebRTC VAD in browsers/calls). ✅ Still light & fast. ⚠️ Struggles in very noisy places.

🧠

Neural VAD (AI)

A small deep-learning model that spots speech even inside loud noise or music. ✅ Very accurate. ⚠️ Needs a model (a bit heavier).

🏷️ Pro names to look upWebRTC VAD (classic, lightweight) · Silero VAD (tiny neural model) — both are open-source and free to use in your projects.

🎉 Day 12 Complete!

You built a Voice Activity Detector — the first thing every voice assistant runs: knowing when you're talking, and when your sentence has ended (endpointing).

Day 13: Stop the Echo →
Tomorrow: on a video call, your own voice bounces back as an echo. How do phones erase it? Meet echo cancellation. 🔊
AI Adventure · Machines That Hear · Day 12 — made for young inventors 🚀