The long write-up of the same mechanism: Core Audio process taps. The interactive version: the Auricle lab.
The problem: one knob
macOS runs sound through one knob. To keep a video call going while turning the music down a little, or to send notification sounds to your headphones and the call to the speakers, you need the system to give you a lane per app; it does not. For years this was done by apps that installed a virtual audio device or a HAL plug-in. The process tap API that arrived in macOS 14.2 made it possible without a driver.
Catching one app’s audio
For every app you control, Auricle creates a process tap (AudioHardwareCreateProcessTap). The tap is set to .mutedWhenTapped: the app’s audio no longer goes straight to the speakers, it only flows into the tap. The tap is attached to a private aggregate device together with the real output device, with drift compensation between the two clocks. Because it is private, that aggregate device does not show up in other apps’ device lists.
An IOProc on the HAL realtime thread then takes the tapped audio and plays it back to the output. Everything in between is your settings:
- ramped gain (so volume changes do not click),
- a 10-band EQ (a vDSP biquad cascade; peaking filters from 32 Hz to 16 kHz, ±12 dB per band),
- boost from 0 to +12 dB,
- a hard clip: samples above full scale are cut to it.
+12 dB is roughly four times the amplitude. There is no limiter in between: on a quiet app you will not hear it, but boost an already loud app too far and you hear distortion. Auricle does not hide that.
The rules of the realtime thread
The audio thread works to a budget of a few milliseconds, and any wait there is heard as a click. So:
- buffers are allocated up front; nothing is allocated while rendering;
- new settings from the UI wait to one side, and the audio thread only tries the lock (
os_unfair_lock_trylock); if it cannot take it, it carries on with the previous settings;
- EQ coefficients are staged the same way and swapped in on the realtime thread.
The master chain without double processing
The system-wide Boost and EQ work the same way through a global tap. That global tap excludes Auricle itself and every app that already has its own tap, so nothing is heard twice. The trade-off, stated plainly: an app with its own settings bypasses the master chain, so master EQ does not stack on top of per-app EQ.
Which process is the app?
Browsers often play audio from separate helper processes. Auricle finds the processes that play audio by listening to Core Audio’s process objects (no polling). To fold a helper into its parent app it optionally calls a private libsystem symbol (responsibility_get_pid_responsible_for_pid); if the symbol is missing it falls back to the process’s own ID. That detail matters in the App Store section below.
Permission and signature
Process taps sit behind macOS’s “System Audio Recording” permission. Without it per-app control and meters cannot work. macOS ties that grant to the app’s code signature. Today’s releases are ad-hoc signed, so updating to a new build may ask again. A Developer ID signed, notarized build keeps a stable signature: the grant survives updates and Gatekeeper does not block the first launch.
Why direct, and why not the Mac App Store yet
There are mixers in the Mac App Store that use the same process-tap approach, so the door is not shut. The concrete reasons Auricle does not go there today:
- A private API. App Review Guideline 2.5.1: “Apps may only use public APIs”. The helper-process mapping above uses a private symbol. A Mac App Store build has to drop that call and do the mapping through public means.
- Sandbox not tested. Guideline 2.4.5(i) requires the sandbox. The entitlement set Auricle needs to work fully inside it has not yet been tested in a real sandboxed build.
- Packaging with Xcode. Guideline 2.4.5(ii) requires packaging with Xcode technologies; Auricle is packaged today with SwiftPM and a build script.
Decision: direct distribution first, signed with Developer ID and notarized. The Mac App Store only after the private API is removed and a real sandboxed build has been tested. The rules: App Review Guidelines.
Honest limits
- macOS 14.4 and later only; the tap API does not exist before 14.2.
- Audio from an app with its own settings bypasses the master chain (above).
- With today’s ad-hoc signed builds, launch at login is best-effort; if it fails, move the app to
/Applications.
- No limiter after boost, only a hard clip.