Menu

I wrote a small Swift CLI that pipes your Mac's system audio to stdout (ScreenCaptureKit, no BlackHole)

#swift#redditswift#audiotap#macos#system
Reading 0:00
15s threshold

I needed the audio of a call as a raw stream for a speech model, without installing a virtual audio driver.

So I wrote audiotap: one Swift file, about 100 KB once built.

- `audiotap system` streams everything the Mac is playing

- `audiotap mic` streams the default mic (other apps can still use it)

- output is raw float32, 16 kHz mono on stdout, status lines on stderr

The fun part: ScreenCaptureKit has no audio-only mode. So it asks for a 2x2 pixel video at 1 fps, throws the

frames away and keeps the audio, which already comes in at 16 kHz mono. If the stream dies (sleep, monitor

unplugged) it reattaches every second.

Measured on an M5, macOS 26.6: 5 seconds of `say` came out as exactly 320,000 bytes, about 1% CPU, clean exit

when the reader closes the pipe, so `head -c` works as a timer.

```

audiotap system | head -c 320000 | ffmpeg -f f32le -ar 16000 -ac 1 -i - clip.wav

```

Limits: macOS 13+, only tested on Apple Silicon, all system audio (no per-app pick), default mic only.

One question for…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.