earshot_classifier_platform_interface

pub package style: very good analysis License: MIT

The pure Dart platform interface for earshot_classifier. Apps should depend on earshot_classifier instead.

It holds the types every backend shares: SoundDetection, SoundGroup, ClassifierBackend, the EarshotSound vocabulary and SoundVocabulary, which maps each backend's raw labels to sounds and groups.

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

Implementing a backend

A platform implementation extends EarshotClassifierPlatform and classifies PCM captured by earshot_capture:

  • isAvailable() tells whether the backend can run on this device. It must never prompt the user.
  • classify(Stream<PcmChunk> pcm, ClassifierConfig config) starts a session on each listen(), listens to pcm, and stops on cancel. It reports every label at or above config.minConfidence in each analysis window, built with SoundVocabulary().detection(...), timestamped on the PCM clock, and never throws synchronously.
  • detections(ClassifierConfig config) captures with earshot_capture and classifies the result the same way.

earshot_classifier applies the confidence threshold and smoothing on top, the same way for every backend. See ADR 0014.

Disclaimer

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

Libraries

earshot_classifier_platform_interface
The pure Dart platform interface for earshot_classifier.