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 usefull to convert a Wave file to a Raw PCM file.

Note that this verb is not asynchronous and does not return a Future.

Implementation

Future<void> waveToPCM({
  required String inputFile,
  required String outputFile,
}) async {
  var filIn = File(inputFile);
  var filOut = File(outputFile);
  var sink = filOut.openWrite();
  await filIn.open();
  var buffer = filIn.readAsBytesSync();
  sink.add(buffer.sublist(WaveHeader.headerLength));
  await sink.close();
}