macos-audio-tap
Reads the volume level of whatever is playing on a Mac, from Swift or from any language that can read lines from a command.
We wrote this for the Mac version of the Firedance app, so the lights could react to whatever was playing on the computer. It uses Core Audio process taps, which arrived in macOS 14.4, and prints the level as JSON lines.
Two things cost us time and are handled for you. Without the System Audio Recording permission nothing errors, you just get perfect silence. And an aggregate device with an empty sub-device list failed to start on our machines until we backed it with the real output device.
Get started
swift build -c release
.build/release/audio-tap --emit-interval-ms 100 Full instructions are in the README on GitHub.
Read the announcement: Our first open source release.