Speech AI#
Audio is a data source you can query. Transcribe it, timestamp it, and it becomes searchable text like anything else you scraped.
โฑ ~8 min read ยท ~12 min hands-on ๐ needs: Video Understanding ยท Local LLMs
Podcasts, lectures, earnings calls, support recordings โ enormous amounts of information exist only as speech. Speech-to-text (STT) turns it into text you can search, chunk, and feed to an LLM.
Try it in 5 minutes โ transcribe with timestamps#
faster-whisper runs Whisper on a CTranslate2 backend โ several times quicker than the reference implementation and comfortable on CPU with a small model:
# /// script
# requires-python = ">=3.12"
# dependencies = ["faster-whisper>=1.0"]
# ///
"""Transcribe an audio file with per-segment timestamps.
Run: uv run transcribe.py audio.mp3
"""
import sys
from faster_whisper import WhisperModel
path = sys.argv[1] if len(sys.argv) > 1 else "audio.mp3"
# "base" downloads in seconds; int8 keeps it CPU-friendly.
model = WhisperModel("base", device="cpu", compute_type="int8")
segments, info = model.transcribe(path, vad_filter=True)
print(f"Detected {info.language} ({info.language_probability:.0%})")
for seg in segments:
print(f"[{seg.start:6.1f}s โ {seg.end:6.1f}s] {seg.text.strip()}")โ Timestamps are the valuable part: they let you cite “at 12:43” and link a claim back to the audio.
No audio handy? Pull some with ffmpeg โ see Video Understanding:
ffmpeg -i video.mp4 -vn -acodec libmp3lame audio.mp3Choosing a model#
| Model | Pick it for |
|---|---|
| Whisper large-v3 | The all-rounder: 99+ languages, most versatile |
| faster-whisper | Same Whisper models, substantially faster/cheaper inference |
| NVIDIA Parakeet TDT | Fastest self-hosted English throughput; beats Whisper on English WER, but ~25 languages |
| WhisperX | Adds forced alignment (word-level timing) and speaker diarization |
| Moonshine | On-device and edge deployments |
For Indian-language audio, test before committing โ accuracy varies a lot by language and accent. Whisper’s breadth usually wins outside major European languages.
Text-to-speech is the reverse trip: hosted options (ElevenLabs, OpenAI TTS) sound best; Piper runs locally and free.
โ๏ธ Recordings of people are personal data, and voice is biometric. Transcribing a public lecture is fine; scraping private calls or cloning someone’s voice without consent is not โ Legal & Ethical Scraping.
When it fails#
| Symptom | Cause | Fix |
|---|---|---|
| Invented text in silence | Whisper hallucinates on quiet audio | vad_filter=True; try Parakeet |
| Wrong language | Auto-detect confused by short/mixed audio | Pass language="hi" explicitly |
| Speakers indistinguishable | Plain STT has no speaker labels | Use WhisperX diarization |
| Painfully slow | Large model on CPU | Smaller model, int8, or GPU |
| Names/jargon wrong | Out-of-vocabulary terms | Pass an initial_prompt with expected terms |
Your turn (โ12 min)#
- Extract audio from any short video with
ffmpegand transcribe it. - Run the same file with
vad_filter=Falseand compare โ look for hallucinated text in silences. - Compare
basevssmallon speed and accuracy. - Save segments as JSON (
start,end,text) and write the code that finds which timestamp mentions a keyword.
Checklist#
- I can transcribe audio with per-segment timestamps.
- I know why timestamps matter for citations.
- I can extract audio from video with
ffmpeg. - I know VAD filtering suppresses silence hallucinations.
- I treat voice recordings as personal/biometric data.
Go deeper#
- faster-whisper โ the fast Whisper runtime used above.
- WhisperX โ word-level alignment and diarization.
- Open ASR Leaderboard โ current WER/speed comparisons.