I’ve been building a meeting-notes app for my own use since March, mostly through coding-agent sessions, and I wanted to write down what it took, since the parts I expected to be hard (the models) turned out to be the easy ones, and the parts I hadn’t thought about at all (getting audio out of macOS, permissions, the App Sandbox) are where nearly all of the time went.
The idea is simple enough. It records a call without a bot joining it, transcribes it with whisper.cpp, works out who spoke when, and writes a summary with a local model through Ollama, and none of it leaves the machine. Meeting audio, transcripts and the names of the people in them are about the most private things on my laptop, and I didn’t want them in anyone’s cloud, mine included, and for notes an 8B model and Whisper are good enough, which I mentioned in passing in the VRAM post. The people on the calls I recorded while building it knew they were being recorded, which matters for the numbers below, since a few of them come from real meetings.
This is the overview, and a few parts have their own posts, so I’ll keep those short here and link them: capturing system audio with a Core Audio process tap, what “nothing leaves the Mac” means in code, and writing checks that can fail on the bug they guard against.
Getting system audio out of macOS
To record a call without joining it, we need what the Mac is playing (the other people) and the microphone (us). For system audio, macOS 14.2 added Core Audio process taps, and my first attempt with one in March delivered nothing at all, with every call returning noErr and the IOProc never firing. After five fixes that changed nothing, I concluded it was a permission I couldn’t get, and moved capture to ScreenCaptureKit, with a display filter and a tiny throwaway video stream next to the audio.
That worked for seven months, until a banner I added in October was delivered and never shown. Notification Center logged muted by display state (displayShared), because the video stream made macOS treat every recording as screen sharing, so every banner from every app was muted for as long as a meeting was being recorded. Going back to the tap with a small spike showed the March symptom again while the permission daemon logged the access as allowed, and the likely cause was one key on the aggregate device, kAudioAggregateDeviceTapAutoStartKey, which keeps the device idle on a quiet Mac. Whether the March CLI also lacked the permission, the spike can’t tell, but with auto-start off and a global tap that excludes our own process, capture worked inside the sandbox and the banners came back. The details, including what a denied permission looks like (exact zeros, with no error anywhere), are in the tap post.
The microphone that was never recorded
Back when capture still ran on ScreenCaptureKit, I noticed that the microphone never seemed to show up in transcripts, and the database agreed, since every one of 25 real meetings was about 32,000 bytes per second, which is mono 16 kHz, where stereo would be 64,000. My first guess was the microphone permission (the first test recording failed 13 ms after I clicked Allow), but a second recording in the same process logged the permission as granted and still dropped the mic, and AVFAudio’s own log line named the real cause:
required condition is false: ... (inputNode != nullptr || outputNode != nullptr)
A fresh AVAudioEngine has no input or output node until one is accessed, and calling prepare() on that empty graph raises an Objective-C exception. The setup code called prepare() first, which would have crashed, except that a commit in March had wrapped it in an exception guard (titled as a sandbox crash fix), and the start path handled the caught error by recording mono instead. The warning was logged with the default privacy level, so the unified log showed <private> and named nothing, and a later change called “Fix microphone capture path” added diagnostics without touching the order. The fix builds the graph first and prepares after:
// catchingObjCExceptions is a small ObjC @try shim, since Swift can't catch an NSException
static func prepareMicEngine(_ engine: AVAudioEngine, buildGraph: (AVAudioEngine) throws -> Void) throws {
try catchingObjCExceptions { try buildGraph(engine) } // touches inputNode, installs the tap
do {
try catchingObjCExceptions { engine.prepare() }
} catch {
// the engine is reused, so leave bus 0 free (touching inputNode can raise too, if the device went away)
try? catchingObjCExceptions { engine.inputNode.removeTap(onBus: 0) }
throw error
}
}
The app also shows a banner that stays up when a requested mic is dropped, so it can’t happen silently again. The tests pin the order without hardware, and against the real framework (without starting IO) an engine with no graph throws, while on a Mac that has granted mic access an engine with a tap prepares.
A guard that turns an assertion into a fallback, plus one <private> log line, can hide a bug that fails every single time. (Also, log is a zsh builtin, so use /usr/bin/log stream when you go looking for it.)
Two clocks, one stereo file
Fixing the mic exposed the next bug. The first three real meetings with the mic on came out 1.92x, 1.92x and 1.89x as long as the meetings themselves, which the mic fix’s own verification (RMS and non-zero samples on the mic channel) couldn’t see, since all the audio was there, with silence inserted between it. Each channel turned out to be about 52% exact zeros, in blocks of about half a second, and the channels took turns. The writer ran on every system-audio callback and wrote min(max(systemFrames, micFrames), 16384) frames, padding the shorter side with zeros, and since system audio and the mic come from two devices with two clocks and different buffer sizes (100 ms on the built-in mic, 256 ms on a Bluetooth headset), interleaving whatever has arrived at each callback never lines up.
The design that shipped places every buffer on one timeline by its capture host time, writes a frame once both sources have it, absorbs the drift between the two clocks by slipping a sample now and then, and has a 250 ms watchdog that pads whichever source has fallen more than a second behind elapsed time, so the file keeps moving even when one source stops. The sample-rate conversion needed care as well, since given a whole 4,800-frame buffer, a 48 to 16 kHz AVAudioConverter kept part of it for the next call, so the output alternated between 1,360, 1,365 and 1,601 frames and its timing wobbled by 12-15 ms, which per-buffer timestamps would read as drift. Feeding it at most the frames it asks for per call, with primeMethod = .none for live input, fixed that.
On a 54-minute call afterwards, the file was 3,213.99 s long against 3,214.3 s between the meeting’s stored start and stop, the two device clocks drifted about 5 ppm apart (245 one-sample slips absorbed it), and no mic chunk was dropped, though one 2.5 s stretch went silent on both channels, probably a mic restart. The check that catches this kind of bug compares the WAV’s duration with a clock the writer doesn’t control, here the stored start and stop times, and counts exact-zero runs per channel, which is what the checks post is about.
The same bug showed up two stages later, and I spent a day in the wrong place before connecting them. An 80-minute file of a 44-minute, four-person meeting was diarized (on-device, with SpeakerKit) as me plus one other speaker, and I went through the dependency upgrade I was in the middle of, the window-stitching code, the clustering threshold and the segmentation model before deciding the recording must have been a double-compressed playback. Reading that WAV directly after the stereo fix showed 45% of the system channel was exact zeros, in 26,456 runs of at least 50 ms, so the diarizer had only ever heard fragments of about 0.2 s separated by digital silence. After the capture fix, a 13-minute call with nine remote people came out as ten, and the issue was closed without changing a line of diarization code (longer calls still split one person into several speakers across the 25-minute windows, which is a separate, open problem).
A prompt that never stops a recording
One rule ended up deciding most of the product design, which is that the app may ask, but it never stops a recording or destroys audio on a classifier’s guess. To notice that a meeting has ended, the app watches for speech with Apple’s on-device SoundAnalysis classifier (a loudness detector counted a fan, typing and music as talking at any threshold I tried), and after a while of nobody speaking it asks whether to stop.
The first design also trimmed the silent tail at Stop, and the review of that design produced several failure sequences that killed it. One was a low-bitrate remote speaker scoring under the threshold while the banner can’t be seen (during a Focus mode, or while sharing the screen), so nobody clicks Keep and most of a meeting gets cut, and that broke the assumption that a false alarm only costs one click. So the prompt never stops anything on its own, and the trim, when it’s built, will be a recorded decision that can be restored for a week before any bytes are removed.
The other rules (voice vectors stored only while an opt-in setting is on and erased when it goes off, no reading speaker names from Zoom’s window because that would mean dropping the App Sandbox) are in the post about what “nothing leaves the Mac” means.
Checks, and coding agents
The other thing that kept coming back was a check that said “fine” when it had no way to see the problem. The mic’s RMS check was one, and the checks post goes through the rest, from pre-commit gates that used \b in macOS awk and so matched nothing, to tests whose fakes were built the way the code wanted.
A related pattern came from working with coding agents, which were fine at writing the code and went wrong mostly when they stated things from what they read rather than from what they ran. GRDB 7 replaced a record’s static let databaseDateEncodingStrategy with a static func databaseDateEncodingStrategy(for column:) that has a default implementation, so several record types that still declare the old static let get GRDB’s default format with no warning, and agent reviewers twice reasoned from that declaration to the wrong stored format (once marking a correct query as a P0 bug) until a raw row from a fresh store settled it. The March conclusion about taps did something similar, since it went into the agent instructions and a pre-commit gate as a ban, and three months later an agent comparing the app with another open-source recorder described its capture as “ScreenCaptureKit (deliberately not Core Audio Taps)”, repeating the ban back as a design choice. A conclusion in a doc that agents read gets repeated with more confidence each time, so I’d rather keep the evidence (the log line, the measurement) next to the claim, where the next session can re-check it.
With a Bluetooth headset as input, opening an input unit flips the headset between its music and call profiles, which changes the sample rate underneath you, and that produced a crash with no app frames (an AVAudioEngine released after it was freed, inside AVFAudio) and an occasional refused mic tap. The fixes were one engine for the app’s lifetime and, when the tap is refused mid-switch, reading the input format again and rebuilding, up to a few times, until the rate settles.
Summary
The models were the easy part, since Whisper, a local LLM and on-device diarization mostly did what they said, and the one time diarization gave a badly wrong answer, the cause was in what it was fed. The time went into audio capture, permissions and the sandbox, where a failure rarely throws and usually shows up as silence, a mono file, a muted banner or a file twice as long as the meeting. If you’re building something that records audio on a Mac, verify a recording by its length against a clock the writer doesn’t control and by its exact-zero runs rather than by how loud it is, and when something “can’t be done on macOS”, re-test that with a small spike before building around it, since in my case the conclusion had pushed capture onto an API that muted every notification for seven months.