A simple encoder for WAV audio files.
NPM package: wav-file-encoder
Online demo: www.source-code.biz/snippets/typescript/wavFileEncoder
Example of how to use it: github.com/chdh/wav-file-encoder/tree/master/example
Compagnion package: wav-file-decoder
encodeWavFileFromAudioBuffer(audioBuffer: AudioBuffer, wavFileType: WavFileType) : ArrayBuffer
audioBuffer
: An AudioBuffer that contains the audio data.wavFileType
:WavFileType.int16
(0) for 16 bit signed integer,WavFileType.float32
(1) for 32 bit float.- Return value: An ArrayBuffer that contains the raw data bytes of the generated WAV file.
encodeWavFileFromArrays(channelData: ArrayLike<number>[], sampleRate: number, wavFileType: WavFileType) : ArrayBuffer
channelData
: Arrays containing the audio samples (PCM data). One array per channel.sampleRate
: Sample rate (samples per second).wavFileType
:WavFileType.int16
(0) for 16 bit signed integer,WavFileType.float32
(1) for 32 bit float.- Return value: An ArrayBuffer that contains the raw data bytes of the generated WAV file.