earshot_classifier_platform_interface
Warning
Pre-release (0.x). The public API may still change in 0.x. See the feature checklist for what works today.
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 eachlisten(), listens topcm, and stops on cancel. It reports every label at or aboveconfig.minConfidencein each analysis window, built withSoundVocabulary().detection(...), timestamped on the PCM clock, and never throws synchronously.detections(ClassifierConfig config)captures withearshot_captureand 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.