waveToPCM
waveToPCM method
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 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();
}