audioStream property

Stream<List<double>> audioStream

The stream of audio samples.

Implementation

Stream<List<double>> get audioStream => _stream ??= _noiseEventChannel
    .receiveBroadcastStream({"sampleRate": sampleRate})
    .map((buffer) => buffer as List<dynamic>?)
    .map((list) => (list != null && list.isNotEmpty && list[0] is double)
        ? list.cast<double>()
        : list!.map((e) => e is double ? e : double.parse('$e')).toList());