'How to show waves while record an audio using flutter sound

i am using flutter_sound_lite package to record users voices and i am trying to show the waves while user is recording but couldn't do that

i need something similar the following image

enter image description here

this is my code

import 'package:flutter/material.dart';
import 'package:flutter_sound_lite/public/flutter_sound_recorder.dart';

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {


  FlutterSoundRecorder? record ;

  @override
  void dispose() {
    record!.closeAudioSession();
    super.dispose();
  }

  @override
  void initState() {
    record = FlutterSoundRecorder();
    record!.openAudioSession();
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: Center(
        child: IconButton(
          onPressed: (){
            record!.startRecorder(
              toFile: 'dooo_doo.aac'
            );
          },
          icon: const Icon(Icons.mic),
        ),
      ),
    );
  }
}


Solution 1:[1]

I solved it by using the flutter package https://pub.dev/packages/flutter_sinusoidals .

You can basically get data from your buffer and calculate sound intensity(this can be given in decibels). Then, Write your decibel value on top of the given parameters with some specific formula in the widget such as frequency, wave amount and so on using setstate(({ })). I did it and it looks quite satisfying.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1