Skip to content

Repository files navigation

TonalTap — live BPM and musical key from Mac system audio

CI Release v0.2.0 macOS 14.2 or newer Swift 6 MIT License

The tiny macOS menu bar app that hears what your Mac is playing and returns BPM, musical key, and Camelot code — entirely on device.

See it live · Accuracy · Architecture · Quick start · Privacy

Built for the moment the track hits

TonalTap starts listening when it launches. Play audio in your favorite Mac app and get a rolling readout without routing cables, uploading a file, or reaching for a phone.

Live analysis Native and compact Private by architecture
BPM, key, and Camelot code from the audio playing now A compact Swift menu bar app that stays out of the way No microphone, uploads, telemetry, accounts, or saved recordings
Updates continuously as the song develops Starts listening on launch; pause any time Audio is analyzed locally and kept in memory

See it live

TonalTap's compact panel with live BPM, musical key, and Camelot code

The panel spends its space on the signal: status, BPM, key, evidence state, and a pause control. It stays in a compact 320-point-wide popover and disappears when you return to your work.

Accuracy you can reproduce

Key detection is protected by a closed-loop test system. The commands below fetch checksum-pinned public fixtures, run the same bundled S-KEY Core ML detector used by the app over a fixed, key-balanced real-song corpus, and write a machine-readable report. No manual listening pass is required.

GiantSteps benchmark Cases Exact Top two MIREX
Independent 15-second windows 741 48.0% 58.8% 0.571
Arithmetic track posterior 93 tracks 54.8% 68.8% 0.626
Runtime evidence tracker 93 tracks 53.8% 68.8% 0.618

The previous 97.4% score came from a generated-heavy regression set and is retained only as a conversion smoke test. It is not a product-accuracy claim. The primary ruler is now 93 checksum-verified GiantSteps tracks with 741 complete windows. See the testing strategy and algorithm research.

TonalTap now reserves a single Stable key for strong accumulated evidence and shows the two leading keys otherwise. The 0.825 evidence threshold was selected on a 46-track development split: wrong definitive outputs fell from 45.7% of tracks to 4.3%, more than a 10× reduction. On the untouched 47-track holdout, Stable covered 10.6% of tracks with 100% exact accuracy. Across the whole corpus, Stable coverage is 12.9% at 83.3% accuracy. This improves trust by abstaining; it does not make S-KEY universally accurate.

./scripts/fetch-key-reliability-fixtures.py
./scripts/evaluate-key-reliability.sh

Under the hood

flowchart LR
    A[Mac system audio] --> B[Core Audio process tap]
    B --> C[Rolling in-memory buffer]
    C --> D[Onset autocorrelation BPM]
    C --> E[S-KEY Core ML key model]
    D --> F[Tempo stabilizer]
    E --> G[24-key evidence tracker]
    F --> H[Menu bar readout]
    G --> H
Loading
  • BPM: onset-strength autocorrelation for rolling estimates.
  • Key: S-KEY inference over fresh, non-overlapping 15-second windows. The app keeps all 24 scores, requires independent agreement, and exposes ambiguity or change instead of converting raw model scores into confidence labels.
  • Capture: macOS Core Audio process taps; the microphone is never opened.
  • Runtime: native Swift and Core ML with no app-runtime network dependency.

Read the full system map in ARCHITECTURE.md.

Quick start

Requires macOS 14.2 or newer and Swift 6. TonalTap is tested on Apple silicon.

git clone https://github.com/diptobiswas/TonalTap.git
cd TonalTap
./scripts/verify.sh
./scripts/install.sh
open /Applications/TonalTap.app

Approve System Audio Recording when macOS prompts. The packaged app uses a stable local signing requirement to help preserve permission across rebuilds. macOS still controls when consent is required.

To run directly during development:

swift build
swift run TonalTap

Use ./scripts/uninstall.sh to remove only /Applications/TonalTap.app and its launch-at-login registration.

Note

The current GitHub release is source only. A public direct download still requires Developer ID signing, hardened runtime, Apple notarization, and Gatekeeper verification. Locally packaged builds are intended for the Mac that built them.

Verify every layer

./scripts/verify.sh

The verification pipeline runs unit tests, deterministic audio fixtures, the key-accuracy gate, debug and release builds, app-bundle validation, and strict local-signature checks. GitHub Actions checks model integrity, tests, deterministic fixtures, key accuracy, and the release build on macOS.

Privacy, by default

TonalTap analyzes captured audio locally, keeps it in memory, and does not save or upload it. There are no analytics SDKs, user accounts, or external APIs in the app runtime. Read the plain-language privacy statement and security policy.

Contributing

Ideas, fixtures, and focused pull requests are welcome. Start with CONTRIBUTING.md, then use the commands in AGENTS.md and WORKFLOW.md to keep changes reproducible for humans and agents.

TonalTap is available under the MIT License. The bundled S-KEY model retains its upstream MIT notice in Resources/Models/SKEY-LICENSE.txt.

Hear it. Name it. Keep moving.

About

Live BPM, musical key, and Camelot code from Mac system audio. Private. Offline. Native.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages