I want to create an audio wave while recording in flutter. To record voice I am using Flutter Audio Recorder. To create wave I tried this plugin as well Wave Generator, but could not find any positive results.
Code Sample:
class AudioWave extends StatelessWidget {
const AudioWave({
Key key,
@required this.translateX,
@required List<double> audioPowerData,
}) : _audioPowerData = audioPowerData,
super(key: key);
final double translateX;
final List<double> _audioPowerData;
@override
Widget build(BuildContext context) {
return Container(
width: screenUtil.screenWidth,
margin: const EdgeInsets.only(top: 0, right: 0),
alignment: Alignment.topRight,
child: CustomPaint(
child: Container(height: 180.0, width: screenUtil.screenWidth),
painter: CurvePainter(translateX: translateX, data: _audioPowerData),
isComplex: true,
willChange: false,
),
);
}
}
I recently did some work on a package called mic_stream
If you clone the repo from here, and run the app that is held within the example
directory, you'll see a (relatively crude) waveform thats pulled in from the microphone. Hopefully it can give you a good starting point for what you want to build!
UPDATE: I believe there is something wrong with the mic_stream code in the ios side.
I might instead recommend using some of the IOS code from the following repository, which has an ios visualizer: https://pub.dev/packages/audio_visualizer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With