Audiotap: system audio and mic to stdout from the command line, with ScreenCaptureKit

Hi all. I'm sharing a small tool in case it saves someone time.

audiotap streams the Mac's audio output (or the default microphone) to stdout as raw float32, 16 kHz mono. No virtual audio driver, no kernel extension. One file, swift build -c release, about 100 KB.

How it works:

  • ScreenCaptureKit only gives audio as part of a screen stream, so audiotap requests a 2x2 video at 1 fps and drops the frames. sampleRate = 16000 and channelCount = 1 on the stream configuration mean the audio arrives ready for a speech model, no resampling.
  • The mic side uses AVAudioEngine and an AVAudioConverter from the device rate (often 48 kHz) to 16 kHz.
  • If the stream stops (sleep, display change), it logs to stderr and reattaches once a second.
  • When the reader closes the pipe it exits with status 0, so head -c can act as a timer.

Measured on an M5 with macOS 26.6: 5.0 seconds of audio = 320,000 bytes, about 1% CPU.

I'd love feedback on two things: whether Core Audio process taps (macOS 14.2+) are worth a second backend, and whether anyone has tried it on an Intel Mac or a Mac with no display attached.

Repo: GitHub - GianlucaBave/audiotap: Pipe your Mac's audio or mic to stdout from the command line. ScreenCaptureKit, no virtual audio driver. From Murmury. · GitHub (GPL-3.0). I wrote it for Murmury, an open-source Mac app that transcribes the other side of a call locally with Whisper.

1 Like