Skip to content

About

On-device ambient listening for Flutter: sound level in dB(A) and sound classification. No network.

Resources

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

earshot: on-device ambient listening for Flutter

earshot

ci style: very good analysis License: MIT

Note

Stable (1.0.0). Capture, level metering and sound classification work on Android, iOS and macOS. The public API follows semantic versioning: breaking changes only come in a major version (ADR 0021). The feature checklist shows what each version added.

On-device ambient listening for Flutter. earshot tells your app how loud it is, in dB(A) with Leq and calibration, and what is sounding, through sound classification. It has the same API on Android, iOS and macOS.

Privacy

  • earshot never uses the network and sends no telemetry.
  • Audio never leaves the device and is never written to disk.
  • Reading the microphone permission status never prompts the user.
  • The Apple packages ship a privacy manifest that declares no data collection and no tracking.

Your app owns the microphone usage declarations: NSMicrophoneUsageDescription in the iOS and macOS Info.plist, plus the com.apple.security.device.audio-input entitlement on macOS. Android's RECORD_AUDIO is merged into your manifest, and your app still asks the user at runtime.

Disclaimer

earshot is informational and is not a certified detector. Never rely on it for safety. In particular, it must not replace a certified smoke or carbon monoxide alarm.

Packages

Most apps need only earshot_plugin, or earshot_level if they just want a sound level meter.

Package What it does pub.dev
earshot_plugin Level and classification in one stream pub
earshot_capture Microphone → float32 PCM, permission status pub
earshot_level Pure Dart dB metering: weighting, Leq, calibration pub
earshot_classifier Sound classification (SoundAnalysis, YAMNet) pub
earshot_capture_platform_interface Capture platform interface pub
earshot_capture_android Capture on Android pub
earshot_capture_darwin Capture on iOS and macOS pub
earshot_classifier_platform_interface Classifier platform interface pub
earshot_classifier_darwin SoundAnalysis on iOS and macOS pub

Feature checklist

An item is ticked (- [x]) in the same pull request that implements it. The version that first ships it is appended on release, for example (0.1.0).

0.0.1: foundation

Workspace

  • Melos 8 on Dart pub workspaces, with one lockfile (0.0.1)
  • CI: analyze, format, 100% test coverage, generated-code check, Android example build (0.0.1)
  • Swift Package Manager and CocoaPods support for the Apple packages (0.0.1)

earshot_capture

  • Microphone permission status (Android, iOS, macOS) (0.0.1)

0.1.0: capture, level and classification

earshot_capture

  • Microphone permission request (0.1.0)
  • PCM float32 mono stream at 16 / 44.1 / 48 kHz (Android, iOS, macOS) (0.1.0)
  • Capture state changes (0.1.0)
  • Interruption handling (calls, Siri, Android input silencing) with auto-resume, without taking audio focus (0.1.0)
  • Unprocessed input (iOS .measurement mode, Android UNPROCESSED with VOICE_RECOGNITION fallback) (0.1.0)

earshot_level

  • A and Z weighting (IEC 61672, ±0.5 dB at 10 frequencies) (0.1.0)
  • C weighting (0.1.0)
  • Fast / Slow / Impulse response (0.1.0)
  • Leq (session, 1 s, 60 s) (0.1.0)
  • Calibration offset (0.1.0)

earshot_classifier

  • YAMNet backend via LiteRT, in an isolate (every platform) (0.1.0)
  • Apple SoundAnalysis backend (iOS 15+, macOS 12+) (0.1.0)
  • Backend selection (auto, apple, yamnet) (0.1.0)
  • Sound vocabulary (EarshotSound) with validated label mapping (0.1.0)
  • Confidence threshold and smoothing (N hits within T seconds) (0.1.0)

earshot_plugin

  • Earshot.listen combining level and classification (0.1.0)
  • EarshotException error codes on stream errors (0.1.0)

0.2.0: consolidation

  • SoundAnalysis fed from the shared capture tap (single microphone session) (0.2.0)
  • Release automation with melos version and Conventional Commits (0.2.0)
  • pana checks in CI (0.2.0)

1.0.0: stable

  • Stable public API (1.0.0)
  • Performance measured on real devices (YAMNet under 50 ms per window on a mid-range Android device) (1.0.0)

Contributing

See CONTRIBUTING.md. Architecture decisions are recorded in docs/adr/.

License

MIT

About

On-device ambient listening for Flutter: sound level in dB(A) and sound classification. No network.

Resources

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages