November 25, 2026 · 3 min read
record: recording the microphone from the terminal and transcribing it when you stop
A Bash script that records the microphone with a live meter and offers to transcribe when you stop. Why it left transcribe to become its own project, SoX's digital silence, and how to test a microphone in a container with no microphone.
In this post
There’s a command I use almost every day: record. I type it, talk, press Ctrl+C and it asks whether I want to transcribe what I said. It’s handy for loose ideas, for recording a class or for dictating something long without typing it.

It started as a personal script, then shipped inside transcribe, my offline audio transcriber,, and this week it became its own project: ross_record.
What it does
- Live meter while you record, so you know the microphone is actually hearing you.
- Ctrl+C and done: when you stop, it offers to transcribe on screen, save a
.txtwith timestamps, or nothing. - Hands-free (
-s): it starts saving when you speak and stops after a few seconds of silence. - Clean-up (
-c): removes low rumble and normalizes the volume at the end. - For scripts (
-n): records without asking anything, for keyboard shortcuts.
It all happens on the computer: no accounts, no uploads. The transcript comes from transcribe, which runs locally.
Why a separate project
record lived inside transcribe as one more command. That made sense to me, but not to someone who only wants to record: they had to install a 125 MB package with a speech recognition model to use a Bash script.
Now they’re two packages. record is a single script that depends on SoX, pactl and Perl. transcribe depends on record, so anyone who already had it doesn’t lose the command when they update. And anyone who just wants to record gets a few KB.
Digital silence
The first trap was SoX, the program that does the recording. Its “default” device doesn’t always see PipeWire’s default microphone, and on some machines it recorded digital silence: a valid file, with the right length, full of zeros.
The fix was not to trust “default”: record asks pactl which source is the default and passes it to SoX by name. -l lists the sources and -i picks one.
A meter with Perl
SoX already shows a level meter while recording, but mixed with other status lines. record pipes its output through a short Perl filter that keeps only the meter and redraws it in place. Perl because it’s installed on almost any Linux and processes the stream character by character without waiting for the line to end.
Hands-free mode uses SoX’s silence effect: it saves nothing until the level crosses a threshold, and stops when it stays below it for the seconds you choose.
Testing a microphone without a microphone
The install test runs in containers on six distros, and a container has no microphone and no sound server. To test that record really records:
- I start a PulseAudio of its own inside the container;
- create a null sink called
mic, a fake audio output; - play a 440 Hz tone into that output;
- and record listens to its monitor, as if it were a microphone.
The test records with a five-second limit and clean-up on, and checks the file exists and lasts as long as it should (between 3.5 and 6 seconds).
That test found something odd: on Arch, SoX uses the libebur128 library but its package doesn’t declare it as a dependency, so it failed on a clean Arch. record’s Arch package now asks for it.
What I learned
- If a command is useful on its own, it deserves its own package: nobody should install 125 MB to use a script.
- “Default” doesn’t mean the same thing at every layer of Linux audio; asking for the source by name avoids surprises.
- A container can fake a microphone with its own sound server and a fake output.
- Install tests on clean distros find missing dependencies, even in other people’s packages.