SoundSense class
Captures microphone amplitude using AudioRecorder from the record package
and emits a normalized RMS level (0.0–1.0).
To use, call SoundSense.microphone (factory) and add it to NerveController:
NerveRoot(
controller: NerveController(
sound: await SoundSense.microphone(),
),
child: MyApp(),
)
Alternatively, inject any Stream<double> with SoundSense.withStream.
Constructors
- SoundSense()
- Creates a SoundSense that emits 0.0 constantly (silent stub).
-
SoundSense.withStream(Stream<
double> rawStream) - Creates a SoundSense backed by a custom stream of RMS levels (0.0–1.0).
Properties
Methods
-
dispose(
) → Future< void> - Release resources.
-
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
-
microphone(
{int sampleRate = 16000, int windowMs = 100}) → Future< SoundSense> -
Creates a SoundSense that reads from the device microphone via
record. -
normalizeAmplitude(
double rawAmplitude) → double - Normalize an arbitrary amplitude to 0.0–1.0 using log scaling.