{"id":51222526,"url":"https://github.com/georgemandis/cacophony","last_synced_at":"2026-06-28T08:31:00.093Z","repository":{"id":362983474,"uuid":"1252850885","full_name":"georgemandis/cacophony","owner":"georgemandis","description":"Sound classification CLI powered by native macOS SoundAnalysis. Classify 300+ sound types from audio files or live microphone input. Written in Zig.","archived":false,"fork":false,"pushed_at":"2026-06-13T00:06:31.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-16T12:33:31.568Z","etag":null,"topics":["apple","audio","cli","command-line-tool","macos","native","sound","sound-classification","zig"],"latest_commit_sha":null,"homepage":null,"language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/georgemandis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-28T23:55:36.000Z","updated_at":"2026-06-13T00:05:03.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/georgemandis/cacophony","commit_stats":null,"previous_names":["georgemandis/cacophony"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/georgemandis/cacophony","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georgemandis%2Fcacophony","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georgemandis%2Fcacophony/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georgemandis%2Fcacophony/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georgemandis%2Fcacophony/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/georgemandis","download_url":"https://codeload.github.com/georgemandis/cacophony/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georgemandis%2Fcacophony/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34882751,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-28T02:00:05.809Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apple","audio","cli","command-line-tool","macos","native","sound","sound-classification","zig"],"created_at":"2026-06-28T08:30:58.639Z","updated_at":"2026-06-28T08:31:00.085Z","avatar_url":"https://github.com/georgemandis.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cacophony\n\nSound classification from the command line, powered by native macOS SoundAnalysis.\n\nClassify 300+ types of sounds from audio files or live microphone input. Dogs barking, glass breaking, sirens, laughter, musical instruments, speech, rain — all recognized on-device using Apple's built-in sound classifier. No API keys, no downloads, no network calls.\n\nWritten in Zig. Uses Apple's SoundAnalysis and AVFoundation frameworks via Objective-C runtime bindings.\n\n## Install\n\n### Homebrew\n\n```bash\nbrew install georgemandis/tap/cacophony\n```\n\n### From source\n\nRequires [Zig 0.16+](https://ziglang.org/download/) and macOS.\n\n```bash\ngit clone https://github.com/georgemandis/cacophony.git\ncd cacophony\nzig build -Doptimize=ReleaseFast\n```\n\n## Usage\n\n### Classify an audio file\n\n```bash\n$ cacophony classify recording.wav\n0.9792  speech\n0.5980  sigh\n0.5331  mosquito_buzz\n0.4602  insect\n0.4339  click\n\n$ cacophony classify song.mp3 --top=3 --json\n[{\"label\":\"music\",\"confidence\":0.9812},{\"label\":\"guitar\",\"confidence\":0.7234},{\"label\":\"singing\",\"confidence\":0.6891}]\n```\n\n### Listen to the microphone\n\n```bash\n$ cacophony listen\nListening for 5.0s...\n0.5530  sneeze\n0.4091  wind_instrument\n0.3979  speech\n0.3402  saxophone\n0.3345  music\n\n$ cacophony listen --duration=3000 --threshold=0.5 --top=3\nListening for 3.0s...\n0.8234  dog_bark\n0.6012  animal\n0.5891  domestic_animal\n```\n\n### List all sound categories\n\n```bash\n$ cacophony categories | head -10\nspeech\nshout\nyell\nbattle_cry\nchildren_shouting\nscreaming\nwhispering\nlaughter\nbaby_laughter\ngiggling\n\n$ cacophony categories | wc -l\n303\n\n$ cacophony categories --json | jq '.[0:5]'\n[\"speech\",\"shout\",\"yell\",\"battle_cry\",\"children_shouting\"]\n```\n\n## Composability\n\n```bash\n# Check if a recording contains speech\ncacophony classify recording.wav --top=1 | grep speech\n\n# Monitor for specific sounds\ncacophony listen --duration=10000 --json | jq '.[] | select(.label == \"dog_bark\")'\n\n# Search for a sound category\ncacophony categories | grep drum\n```\n\n## Options\n\n```\ncacophony \u003ccommand\u003e [options]\n\nCommands:\n  classify \u003cfile\u003e    Classify sounds in an audio file\n  listen             Classify sounds from the microphone\n  categories         List all recognized sound categories\n\nOptions:\n  --top=N            Show top N classifications (default: 5)\n  --threshold=N      Minimum confidence 0.0-1.0 (default: 0.0)\n  --duration=MS      Listen duration in ms (default: 5000)\n  --json             Output as JSON\n  --help, -h         Show this help message\n  --version, -v      Show version\n```\n\n## Requirements\n\n- macOS 10.15+ (Catalina or later)\n- Zig 0.16+\n\n## How It Works\n\ncacophony uses Apple's [SoundAnalysis](https://developer.apple.com/documentation/soundanalysis) framework with the built-in Version 1 sound classifier, which recognizes 303 sound categories.\n\n- **File analysis:** `SNAudioFileAnalyzer` loads audio files via `AVAudioFile` and runs classification synchronously\n- **Live mic:** `AVAudioEngine` captures microphone input, feeding audio buffers to `SNAudioStreamAnalyzer` via an audio tap\n- **Observer pattern:** Runtime class creation (`objc_allocateClassPair`) implementing `SNResultsObserving` protocol\n- **Block ABI:** ObjC block construction (`_NSConcreteStackBlock`) for the audio engine tap callback\n\n## Related Projects\n\n- [lingua](https://github.com/georgemandis/lingua) — NLP CLI (NaturalLanguage framework)\n- [tezcatl](https://github.com/georgemandis/tezcatl) — Headless web rendering CLI (WebKit)\n- [loupe](https://github.com/georgemandis/loupe) — Computer vision CLI (Vision framework)\n- [whereami](https://github.com/georgemandis/whereami) — Location CLI (CoreLocation)\n- [nearme](https://github.com/georgemandis/nearme) — Local search CLI (MapKit)\n\n## Credits\n\nCreated by [George Mandis](https://george.mand.is) during [Recurse Center](https://www.recurse.com/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeorgemandis%2Fcacophony","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeorgemandis%2Fcacophony","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeorgemandis%2Fcacophony/lists"}