DecibelData class
Decibel data from audio capture.
This class represents a single decibel reading with its timestamp. Used by both microphone and system audio capture to provide volume level information.
Example:
// From stream
capture.decibelStream?.listen((data) {
print('Decibel: ${data.decibel} dB');
print('Time: ${DateTime.fromMillisecondsSinceEpoch((data.timestamp * 1000).toInt())}');
});
// Create manually
final data = DecibelData(
decibel: -45.5,
timestamp: DateTime.now().millisecondsSinceEpoch / 1000.0,
);
// Convert to/from map
final map = data.toMap();
final restored = DecibelData.fromMap(map);
Constructors
- DecibelData({required double decibel, required double timestamp})
-
Creates a new DecibelData instance.
const
-
DecibelData.fromMap(Map<
String, dynamic> map) -
Creates a DecibelData instance from a map.
factory
Properties
- decibel → double
-
Decibel value in dB, typically ranging from -120 to 0 dB.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- timestamp → double
-
Unix timestamp in seconds (not milliseconds).
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMap(
) → Map< String, dynamic> - Converts this DecibelData instance to a map.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited