extractWaveformData method

Future<List<double>> extractWaveformData({
  1. required String path,
  2. int noOfSamples = 100,
})

Extracts waveform data from provided audio file path. noOfSamples indicates number of extracted data points. This will determine number of bars in the waveform.

This function will decode whole audio file and will calculate RMS according to provided number of samples. So it may take a while to fully decode audio file, specifically on android.

For example, an audio file of 58 min and about 18 MB of size took about 4 minutes to decode on android while the same file took about 6-7 seconds on IOS.

Providing less number if sample doesn't make a difference because it still have to decode whole file.

noOfSamples defaults to 100.

Implementation

Future<List<double>> extractWaveformData({
  required String path,
  int noOfSamples = 100,
}) async {
  final result = await AudioWaveformsInterface.instance.extractWaveformData(
    key: playerKey,
    path: path,
    noOfSamples: noOfSamples,
  );
  return result;
}