pcmToWave()

Flutter Sound Helpers API


pcmToWave()

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

It adds a Wave envelop to the PCM file, so that the file can be played back with startPlayer().

Note: the parameters numChannels and sampleRate are mandatory, and must match the actual PCM data. See here a discussion about Raw PCM and WAVE file format.

Example:

        String inputFile = '$myInputPath/bar.pcm';
        var tempDir = await getTemporaryDirectory();
        String outpufFile = '${tempDir.path}/$foo.wav';
        await flutterSoundHelper.pcmToWave(inputFile: inputFile, outpoutFile: outputFile, numChannels: 1, sampleRate: 8000);
        Lorem ipsum ...