wav-file-encoder
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

wav-file-encoder

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

API

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.

Package Sidebar

Install

npm i wav-file-encoder

Weekly Downloads

868

Version

1.0.4

License

MIT

Unpacked Size

8.12 kB

Total Files

5

Last publish

Collaborators

  • chdh