I Added 150ms of Latency on Purpose. It Fixed the Start Sound.
The recording start sound played before the system muted. The fix: delay the mute by 150ms. Not 50ms, not 300ms. Here's how I found the number.
Building a voice input app on macOS — what broke, how we fixed it, and what we learned.
The recording start sound played before the system muted. The fix: delay the mute by 150ms. Not 50ms, not 300ms. Here's how I found the number.
macOS Secure Input swallows keyUp events during screen lock. Your pressingKeys map fills with ghost keys. Exact-set shortcut matching fails silently. CGEventSource.keyState reads hardware truth—even when Secure Input is active.
SwiftData's default ModelContainer stores at ~/Library/Application Support/default.store. It's shared by any non-sandboxed app. Another app triggered a migration. All 207 records gone.
CGEventTap callbacks are C function pointers. Swift ARC can eat the objects they capture. The fix: module-level globals, not instance properties.