waveToPCM method

Future<void> waveToPCM({
  1. required String inputFile,
  2. required String outputFile,
})

Convert a WAVE file to a Raw PCM file.


Remove the WAVE header in front of the Wave file

This verb is useful to convert a Wave file to a Raw PCM file.

Note that this verb is not asynchronous and does not return a Future. See here a discussion about Raw PCM and WAVE file format.

Parameters

  • inputFile: is the path of your input file
  • outputFile: is the path to your output file

Example

FlutterSoundHelper().waveToPCM(inputFile: 'foo.wav', outputFile: 'bla.pcm');

Implementation

Future<void> waveToPCM({
  required String inputFile,
  required String outputFile,
}) async {
  var buffer = fsReadFileBytesSync(inputFile);
  await fsWriteFileBytes(outputFile, buffer.sublist(WaveHeader.headerLength));
}