earshot_classifier_platform_interface 0.1.0
earshot_classifier_platform_interface: ^0.1.0 copied to clipboard
Pre-release: the pure Dart platform interface for earshot_classifier, with the shared types for on-device sound classification.
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 runs its own microphone session:
isAvailable()tells whether the backend can run on this device. It must never prompt the user.detections(ClassifierConfig config)starts a session on eachlisten()and stops it on cancel. It reports every label at or aboveconfig.minConfidencein each analysis window, built withSoundVocabulary().detection(...), and never throws synchronously.
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.