EarshotClassifierDarwin class

The iOS and macOS implementation of EarshotClassifierPlatform, backed by the ClassifierBackend.apple backend: Apple's on-device SoundAnalysis framework (SNClassifySoundRequest, classifier version 1).

Requires iOS 15 or macOS 12. SoundAnalysis classifies PCM captured by earshot_capture, so it shares the one microphone session of the app. Classification never prompts for the microphone permission: request it first, for example with EarshotCapture.requestMicrophonePermission.

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

Inheritance
  • Object
  • PlatformInterface
  • EarshotClassifierDarwin

Constructors

EarshotClassifierDarwin({@visibleForTesting EarshotClassifierHostApi? hostApi, @visibleForTesting Stream<ClassifierEventMessage>? eventMessages, @visibleForTesting PcmOpener? openPcm})
The iOS and macOS implementation of EarshotClassifierPlatform, backed by the ClassifierBackend.apple backend: Apple's on-device SoundAnalysis framework (SNClassifySoundRequest, classifier version 1).

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

classify(Stream<PcmChunk> pcm, ClassifierConfig config) → Stream<SoundDetection>
Classifies pcm with SoundAnalysis.
detections(ClassifierConfig config) → Stream<SoundDetection>
Captures 16 kHz PCM with earshot_capture and classifies it with SoundAnalysis, as classify does.
isAvailable() → Future<bool>
Whether SoundAnalysis can classify on this device. Never prompts the user.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

registerWith() → void
Registers this class as the EarshotClassifierPlatform.instance.