"Which app made that last beep?" came in as a feature request for Stat Space, and I assumed it would take an afternoon. The Volume tab already knew which apps were playing audio, so I'd just keep a short list of who started playing and when.
Then I triggered a beep and Core Audio told me, with complete confidence, that it came from systemsoundserverd . It always does. This post is the investigation that followed, what actually works, and what I left out.
The obvious approach, and why it's wrong
Core Audio exposes every audio client as a process object ( kAudioHardwarePropertyProcessObjectList ), each with a PID, a bundle id and whether it's outputting right now. No permission needed. Watch those for output starting and you have a "who played a sound" log.
I wrote a small spike, spike-sounds , that registers listeners on the process list and on each process object, then logs PID, bundle id, executable path and the frontmost app whenever output starts or stops.…