Skip to main content

earshot_classifier_darwin 0.1.0 copy "earshot_classifier_darwin: ^0.1.0" to clipboard
earshot_classifier_darwin: ^0.1.0 copied to clipboard

Pre-release: the iOS and macOS implementation of earshot_classifier, backed by Apple's on-device SoundAnalysis.

earshot_classifier_darwin #

pub package style: very good analysis License: MIT

Warning

Pre-release (0.x). The public API may still change in 0.x. See the feature checklist for what works today.

The iOS and macOS implementation of earshot_classifier, backed by Apple's on-device SoundAnalysis (iOS 15+, macOS 12+). It is endorsed, so apps should depend on earshot_classifier and get this package automatically.

Part of earshot: on-device ambient listening with no network access, where no audio leaves the device.

How it works #

  • Each listen() on detections() starts its own session, with its own SNAudioStreamAnalyzer and SNClassifySoundRequest (classifier version 1). Sessions that run at the same time share one AVAudioEngine input tap, and the microphone is released when the last one is cancelled.
  • Every label of an analysis window (about one second, overlapping by half) at or above the minimum confidence is reported. Labels are mapped to EarshotSound and SoundGroup in Dart, with SoundVocabulary.
  • isAvailable() never prompts, and neither does classification: request the microphone permission first, for example with EarshotCapture.requestMicrophonePermission(). Without it, the stream fails with CaptureException(CaptureErrorCode.permissionDenied).
  • On iOS the audio session uses the .record category and the .measurement mode. Interruptions (calls, Siri, route and device changes) pause the detections, which resume on their own afterwards.
  • No audio is written to disk or leaves the device.

Minimum OS versions #

Sound classification on Apple platforms uses SoundAnalysis, so apps that depend on this package need iOS 15 or macOS 12 or later.

Microphone setup #

Your app declares microphone access, not this package: add NSMicrophoneUsageDescription to Info.plist, and on macOS also add the com.apple.security.device.audio-input entitlement.

Disclaimer #

earshot is informational and is not a certified detector. Never rely on it for safety, including smoke and carbon monoxide alarms.

0
likes
0
points
380
downloads

Publisher

unverified uploader

Weekly Downloads

Pre-release: the iOS and macOS implementation of earshot_classifier, backed by Apple's on-device SoundAnalysis.

Repository (GitHub)
View/report issues

Topics

#audio #sound-classification

License

unknown (license)

Dependencies

earshot_capture_platform_interface, earshot_classifier_platform_interface, flutter, meta

More

Packages that depend on earshot_classifier_darwin

Packages that implement earshot_classifier_darwin