@@ -16,14 +16,12 @@ const buf = await encode.wav(channelData, { sampleRate: 44100 });
1616
1717| Format | Package | Engine |
1818| --------| ---------| --------|
19- | WAV | built-in | JS |
20- | MP3 | [ wasm-media-encoders] ( https://github.com/nicodemus26/wasm-media-encoders ) | WASM |
21- | OGG Vorbis | [ wasm-media-encoders] ( https://github.com/nicodemus26/wasm-media-encoders ) | WASM |
22- | Opus | TBD | WASM |
23- | FLAC | [ libflac.js] ( https://github.com/nicodemus26/libflac.js ) | WASM |
24- | AAC / M4A | TBD | WASM |
25- | AIFF | built-in | JS |
26- | WebM | TBD | WASM |
19+ | WAV | [ @audio/wav-encode ] ( https://github.com/audiojs/wav-encode ) | JS |
20+ | MP3 | [ @audio/mp3-encode ] ( https://github.com/audiojs/mp3-encode ) | WASM |
21+ | OGG Vorbis | [ @audio/ogg-encode ] ( https://github.com/audiojs/ogg-encode ) | WASM |
22+ | Opus | [ @audio/opus-encode ] ( https://github.com/audiojs/opus-encode ) | WASM |
23+ | FLAC | [ @audio/flac-encode ] ( https://github.com/audiojs/flac-encode ) | WASM |
24+ | AIFF | [ @audio/aiff-encode ] ( https://github.com/audiojs/aiff-encode ) | JS |
2725
2826### Whole-file encode
2927
@@ -32,9 +30,12 @@ Specify the format as method name. Input is _Float32Array[]_ (one per channel) o
3230``` js
3331import encode from ' audio-encode' ;
3432
35- const wav = await encode .wav (channelData, { sampleRate: 44100 });
36- const mp3 = await encode .mp3 (channelData, { sampleRate: 44100 , bitrate: 128 });
37- const ogg = await encode .ogg (channelData, { sampleRate: 44100 , quality: 5 });
33+ const wav = await encode .wav (channelData, { sampleRate: 44100 });
34+ const aiff = await encode .aiff (channelData, { sampleRate: 44100 });
35+ const mp3 = await encode .mp3 (channelData, { sampleRate: 44100 , bitrate: 128 });
36+ const ogg = await encode .ogg (channelData, { sampleRate: 44100 , quality: 5 });
37+ const flac = await encode .flac (channelData, { sampleRate: 44100 });
38+ const opus = await encode .opus (channelData, { sampleRate: 48000 , bitrate: 96 });
3839```
3940
4041### Stream encoding
@@ -59,9 +60,12 @@ const c = await encoder.encode(); // end of stream — flush + free
5960| Option | Description | Applies to |
6061| --------| -------------| ------------|
6162| ` sampleRate ` | Output sample rate (required) | all |
62- | ` bitrate ` | Target bitrate in kbps | mp3, aac, opus |
63+ | ` bitrate ` | Target bitrate in kbps | mp3, opus |
6364| ` quality ` | Quality 0–10 (VBR) | ogg, mp3 |
6465| ` channels ` | Output channel count | all |
66+ | ` bitDepth ` | Bit depth: 16 or 32 (wav), 16 or 24 (aiff, flac) | wav, aiff, flac |
67+ | ` compression ` | FLAC compression level 0–8 | flac |
68+ | ` application ` | ` 'audio' ` , ` 'voip' ` , or ` 'lowdelay' ` | opus |
6569
6670### Custom encoders
6771
0 commit comments