flutter_sound icon indicating copy to clipboard operation
flutter_sound copied to clipboard

How to process the audio stream?

Open ShuoShenDe opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe. Hi~Dear flutter sound team,

I want to do a function really like the streamLoop example, which could get the audio stream and then player play the stream. Now I have the question about how I access and process the stream?

I see the example streamLoop example, which write

  Future<void> record() async {
    await _mPlayer!.startPlayerFromStream(
      codec: Codec.pcm16,
      numChannels: 1,
      sampleRate: _sampleRatePlayer,
    );

    await _mRecorder!.startRecorder(
      codec: Codec.pcm16,
      toStream: _mPlayer!.foodSink, // ***** THIS IS THE LOOP !!! *****
      sampleRate: _sampleRateRecorder,
      numChannels: 1,
    );
    setState(() {});
  }

It sounds like _mPlayer!.foodSink is the stream what I want to process, but how can I transfer it from Instance of '_StreamSinkWrapper<Food>' to an instance of array, which format is easy to calculate and change, and transfer back to palyer? For example, If i want to calculate _mPlayer!.foodSink*2 then play it, what should I do?

Do you have any suggestion?

ShuoShenDe avatar May 06 '22 19:05 ShuoShenDe

Thanks guys, I solved the problem, thanks for your amazing examples!

ShuoShenDe avatar May 09 '22 19:05 ShuoShenDe

@ShuoShenDe I'm working on process the audio stream also. how did you solved the problem ? can share your way to do it ? Store the stream from the recorder -> process them part by part -> then feed to player ?

johnnysan173 avatar Jan 08 '23 05:01 johnnysan173

This issue is stale because it has been open 90 days with no activity. Leave a comment or this will be closed in 7 days.

github-actions[bot] avatar Dec 04 '23 01:12 github-actions[bot]