Canardoux / flutter_sound

Flutter plugin for sound. Audio recorder and player.
Mozilla Public License 2.0
874 stars 569 forks source link

[Feature request]: Audio visualizer when audio is being recorded #787

Open jcblancomartinez opened 2 years ago

jcblancomartinez commented 2 years ago

Is your feature request related to a problem? Please describe. There is no straight forward solution to display an audio visualizer while recording an audio.

Describe the solution you'd like I would like a straight forward solution to display an audio visualizer while recording an audio.

Describe alternatives you've considered

Instead of showing an audio visualizer, we are using a LinearProgressIndicator that consumes _dbLevel.

    await _audioRecorder.setSubscriptionDuration(Duration(milliseconds: 100));
    _audioRecorderSubscription = _audioRecorder.onProgress!.listen((e) {
      setState(() {
        _dbLevel = e.decibels!;
      });
    });

Additional context

This would be the expected audio visualizer of the recorded audio:

Screenshot from 2021-10-27 18-18-35

Thanks.

Larpoux commented 2 years ago

Perhaps you could recordToStream() to a PCM stream. You will get a stream of 16 bits integers for each sample rate and use those integers to draw your visualizer

yacaeh commented 2 years ago

@Larpoux Hi, Is it also possible to play the pcm file while recording using recordToStream?

Larpoux commented 2 years ago

Yes. You can look to the streamLoop example

github-actions[bot] commented 10 months ago

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.