Inspiration

A few days ago, I came across a Hacker News post benchmarking Apple’s new SpeechAnalyzer API against Whisper. The results were insane: Across 5,559 LibriSpeech utterances, Apple's new SpeechAnalyzer reached a 2.12% word error rate. That beat Whisper Small at 3.74%, Whisper Base at 5.42%, and Apple's older SFSpeechRecognizer at 9.02%. It also ran roughly three times faster than Whisper Small, completely on-device.

Apple had shipped an excellent speech-recognition system as part of macOS, yet no popular dictation app adopted it and still charged recurring subscriptions to upload recordings to cloud-hosted models.

Now, that felt unnecessary.

I wanted a dictation app that was fast, native, private by architecture, free to use, and open source. But since I've never written Swift and just switched to mac - I also wanted to test a different question during OpenAI Build Week: could I use Codex CLI to take a brand-new Apple API all the way from an idea to a polished, distributed native application ?

Turns out, you really can, and that became Megaphone.

What it does

Megaphone is a free, open-source dictation app for Apple silicon Macs running macOS 26 Tahoe - it initially started from Zach Latta's Freeflow, then rebuilt fully native with SpeechAnalyzer for transcription and on-device Foundation Models for cleanup.

Hold Fn to speak, release and Megaphone types the result into whichever app you are using, formatting it cleanly with screen-awareness. At my normal speaking pace of roughly 120 words per minute, it keeps up without making me slow down. Because transcription runs while I am still talking, the transcript is usually ready in < 1 second after I release the key.

Megaphone can then clean the result using one of three modes: Smart uses Apple’s on-device Foundation Model, Basic uses deterministic code, and Exact preserves the literal transcript.

It also understands app and window context, learns names and technical terms through a private Dictionary, preserves syntax such as --force-with-lease, and supports inline commands such as “Megaphone, make that more formal” without opening a separate chat.

All that with no accounts, subscriptions, API keys, or per-minute cost. Speech recognition, cleanup, Dictionary learning, context, and Inline AI all run on the Mac.

How I built it

I built Megaphone primarily with Codex CLI using Sol 5.6, varying the reasoning effort based on the task.

I used lower effort for scoped changes such as copy, UI polish, and mechanical refactors; medium effort for features such as the Dictionary and wake-command system; and higher effort for streaming audio, Swift concurrency, cancellation, model isolation, updater safety, signing, and cross-file debugging.

The development workflow was really fun with subagents for tasks and handoffs between the VPS Codex-CLI was running on and my local Mac. I would describe the behavior and constraints, let Codex inspect the repository, implement the change, compile the app or run tests, read the resulting failures, and continue iterating against the real codebase.

Making dictation feel instant

The key architectural decision was to avoid waiting until the user stopped speaking.

Megaphone captures microphone buffers with AVFoundation and sends them into SpeechAnalyzer while also writing a temporary audio file. SpeechAnalyzer setup is asynchronous, it may need to resolve a locale, download model assets, reserve a language, and choose an audio format so Megaphone buffers any samples that arrive early and flushes them once the analyzer is ready.

When the user releases Fn, the live stream is finalized and only the remaining fraction of transcription work is left. If streaming fails, the recorded file becomes a fallback rather than losing the dictation.

That is what allows normal speech at around 120 words per minute to feel breezy rather than like speaking into a slow voice assistant.

Engineering Cleanup

The second difficult problem was making an on-device language model clean speech without changing what the user meant.

Megaphone prewarms a fresh Foundation Models session while recording. Each dictation receives an isolated session because Apple’s LanguageModelSession retains conversational state; sharing sessions could let an earlier dictation influence a later one.

The prompt instructs the model to remove fillers, stutters, abandoned starts, and explicit self-corrections while preserving every real idea, hedge, technical identifier, and piece of tone. The output is then validated: Megaphone rejects empty results, assistant-style answers, and suspiciously large expansions.

Short dictations have a strict 2.5-second cleanup budget, while longer ones receive up to 4 seconds. If the model is unavailable or misses that deadline, Megaphone immediately falls back to deterministic Basic Cleanup.

Teaching it the user’s vocabulary

The personal Dictionary influences both SpeechAnalyzer and Smart Cleanup, so terms can be recognized correctly before post-processing begins.

Automatic learning is intentionally conservative. A potential name, acronym, or technical identifier must appear in three separate successful dictations before Megaphone activates it. A one-off recognition mistake therefore cannot immediately teach the app the wrong word.

Shipping more than the app

Codex also helped me build the website, installer, updater, tests, documentation, and three automated pipelines for development builds, production releases, and website deployment.

Within the first 48 hours, I shipped nine versioned releases, from v1.0.0 through v1.1.4. Every push to main can produce a development DMG, while version tags run tests, build the app, create the DMG, support signing and notarization, publish release notes, and refresh the website with the latest download.

This was bundled with loops for auto-closing issues through cron jobs, producing Codex CLI subagents and review-ready PRs after I posted on X, LinkedIn and Hacker News.

Alongside Codex, I used the ChatGPT app with a fresh context as an independent reviewer. Instead of asking the same long-running agent context to review its own decisions, I brought the implementation to a separate conversation with none of its prior assumptions and the Codex App browser for viewing the website, repository and more.

Challenges I ran into

Learning Swift through a new API

I was learning Swift while building against two very new frameworks: SpeechAnalyzer and Foundation Models. Documentation and examples were limited, and many details only became clear after compiling and testing against the real SDK.

Codex helped me navigate the unfamiliar codebase and API surface, but the compiler, runtime logs, and actual microphone input always had the final word.

Reliability across the entire pipeline

Getting one audio file to produce one transcript was straightforward. Making a global shortcut work reliably across different microphones, sample rates, model states, interruptions, cancellations, and applications was much harder.

A dictation app only feels fast when it also works every time.

Native distribution

The project was not finished when transcription worked. I still had to handle permissions, custom shortcuts, clipboard restoration, model downloads, DMG creation, updates, release notes, signing, notarization, and recovery from failed installations.

The main binary depends on macOS 26-only APIs, which caused older versions of macOS to fail with an opaque Launch Services error. I built a second launcher targeting older macOS versions so it could either start the real application or clearly explain why an upgrade was required.

Accomplishments that I'm proud of

I am proud that Megaphone became a real downloadable product that I use every day rather than a Build Week prototype.

I am proud that its privacy claim comes from the architecture. OpenAI technology was essential to building Megaphone, but users do not need to send their voice or writing to Megaphone, OpenAI or any other cloud provider to use it.

Most of all, I am proud that I went from never having written Swift to shipping a very usable native macOS application in under 2 days through Codex.

What I learned

The biggest lesson was that coding agents become far more capable when they participate in a closed feedback loop.

“Write a SpeechAnalyzer wrapper” might generate plausible code. The difficult work begins when that code must compile against a new SDK, fit an existing architecture, handle real audio, survive cancellation, preserve user data, recover from failures, and ship inside a signed application.

I also learned to treat reasoning effort as an engineering control. High effort was valuable for architecture and ambiguous bugs, but unnecessary for mechanical work. Changing the effort based on the task made the workflow faster and more deliberate.

Finally, fresh context has its own value. Long-running context gives Codex continuity, but it can also preserve assumptions. A separate ChatGPT conversation was more willing to question whether the assumption itself was wrong.

What's next for Megaphone

Next, I want to benchmark Megaphone across more accents, languages, microphones, and speaking environments; improve technical and multilingual dictation; expand useful inline transformations; and harden the audio and model lifecycle with deeper automated tests.

Megaphone began as an experiment after reading one benchmark, but it's truly become the dictation app I and many more use every day and an example of how Codex can help one developer build and ship every layer of a real native product.

- Written with Megaphone.

Built With

  • apple-intelligence
  • apple-speechanalyzer
  • chatgpt
  • codex
  • codex-cli
  • github
  • gpt-sol-5.6
  • macos
  • nextjs
  • openai
  • swift
  • swiftui
  • xcode
Share this project:

Updates