@audio/decode 3.13.0 → 3.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/audio-decode.js CHANGED
@@ -145,6 +145,8 @@ reg('caf', () => import('@audio/decode-caf'))
145
145
  reg('webm', () => import('@audio/decode-webm'))
146
146
  reg('mkv', () => import('@audio/decode-webm'), true)
147
147
  reg('avi', () => import('@audio/decode-avi'), true)
148
+ reg('ac3', () => import('@audio/decode-ac3'))
149
+ reg('dts', () => import('@audio/decode-dts'))
148
150
  reg('amr', () => import('@audio/decode-amr'))
149
151
  reg('wma', () => import('@audio/decode-wma'), true)
150
152
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@audio/decode",
3
- "version": "3.13.0",
3
+ "version": "3.14.1",
4
4
  "description": "Decode audio data in node or browser",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -29,20 +29,22 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@audio/decode-aac": "^1.5.0",
32
+ "@audio/decode-ac3": "^1.0.0",
32
33
  "@audio/decode-aiff": "^1.3.0",
33
34
  "@audio/decode-amr": "^1.3.0",
34
- "@audio/decode-avi": "^1.0.0",
35
+ "@audio/decode-avi": "^1.1.0",
35
36
  "@audio/decode-caf": "^1.4.0",
37
+ "@audio/decode-dts": "^1.0.0",
36
38
  "@audio/decode-flac": "^1.3.0",
37
39
  "@audio/decode-mp3": "^1.3.0",
38
- "@audio/decode-mp4": "^1.0.0",
40
+ "@audio/decode-mp4": "^1.1.0",
39
41
  "@audio/decode-opus": "^1.3.0",
40
42
  "@audio/decode-qoa": "^1.2.0",
41
43
  "@audio/decode-vorbis": "^1.3.0",
42
44
  "@audio/decode-wav": "^1.5.0",
43
- "@audio/decode-webm": "^1.5.0",
45
+ "@audio/decode-webm": "^1.6.0",
44
46
  "@audio/decode-wma": "^1.3.0",
45
- "audio-type": "^2.5.0"
47
+ "audio-type": "^2.6.0"
46
48
  },
47
49
  "devDependencies": {
48
50
  "audio-lena": "^3.0.0",
@@ -87,7 +89,9 @@
87
89
  "mkv",
88
90
  "avi",
89
91
  "video",
90
- "extract"
92
+ "extract",
93
+ "ac3",
94
+ "dts"
91
95
  ],
92
96
  "author": "Dmitry Iv. <dfcreative@gmail.com>",
93
97
  "license": "MIT",
package/readme.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @audio/decode [![test](https://github.com/audiojs/decode/actions/workflows/test.js.yml/badge.svg)](https://github.com/audiojs/decode/actions/workflows/test.js.yml)
2
2
 
3
+ Try it in the browser: [Extract audio from video](https://audiojs.dev/util/extract-audio/), [Audio converter](https://audiojs.dev/util/convert-audio/). Runs on this package, nothing is uploaded.
4
+
3
5
  Decode any audio format to raw samples.<br>
4
6
  JS / WASM with no ffmpeg or native bindings; works in Node.js and browsers.<br>
5
7
  Small API, minimal size, near-native performance, lazy-loading, chunked decoding.
@@ -28,6 +30,8 @@ const { channelData, sampleRate } = await decode(anyAudioBuffer);
28
30
  | CAF | [@audio/decode-caf](./packages/decode-caf) | 9 KB | JS |
29
31
  | WebM / MKV video | [@audio/decode-webm](./packages/decode-webm) | 250 KB | WASM |
30
32
  | AVI video | [@audio/decode-avi](./packages/decode-avi) | 8 KB + codec | JS demux |
33
+ | AC-3 | [@audio/decode-ac3](./packages/decode-ac3) | 43 KB | WASM |
34
+ | DTS | [@audio/decode-dts](./packages/decode-dts) | 200 KB | WASM |
31
35
  | AMR | [@audio/decode-amr](./packages/decode-amr) | 241 KB | WASM |
32
36
  | WMA | [@audio/decode-wma](./packages/decode-wma) | 91 KB | WASM |
33
37
 
@@ -65,7 +69,7 @@ for await (let { channelData, sampleRate } of decode.mp3(response.body)) {
65
69
 
66
70
  Works with `ReadableStream`, `fetch` body, Node stream, or any async iterable.
67
71
 
68
- Formats: `mp3`, `flac`, `opus`, `oga`, `m4a`, `mp4`, `mov`, `wav`, `qoa`, `aac`, `aiff`, `caf`, `webm`, `mkv`, `avi`, `amr`, `wma`.
72
+ Formats: `mp3`, `flac`, `opus`, `oga`, `m4a`, `mp4`, `mov`, `wav`, `qoa`, `aac`, `aiff`, `caf`, `webm`, `mkv`, `avi`, `ac3`, `dts`, `amr`, `wma`.
69
73
 
70
74
  ### Video files
71
75
 
@@ -77,11 +81,11 @@ let { channelData, sampleRate } = await decode(await fetch('trailer.mp4'))
77
81
 
78
82
  | Container | Package | Audio codecs |
79
83
  |---|---|---|
80
- | MP4, MOV, M4V, 3GP | [@audio/decode-mp4](./packages/decode-mp4) | AAC, ALAC, MP3, FLAC, Opus, AMR, PCM, G.711 |
81
- | WebM, MKV | [@audio/decode-webm](./packages/decode-webm) | Opus, Vorbis, AAC, ALAC, MP3, FLAC, PCM |
82
- | AVI | [@audio/decode-avi](./packages/decode-avi) | PCM, MP3, AAC, G.711 |
84
+ | MP4, MOV, M4V, 3GP | [@audio/decode-mp4](./packages/decode-mp4) | AAC, ALAC, MP3, FLAC, Opus, AC-3, DTS, AMR, PCM, G.711 |
85
+ | WebM, MKV | [@audio/decode-webm](./packages/decode-webm) | Opus, Vorbis, AAC, ALAC, MP3, FLAC, AC-3, DTS, PCM |
86
+ | AVI | [@audio/decode-avi](./packages/decode-avi) | PCM, MP3, AAC, AC-3, DTS, G.711 |
83
87
 
84
- AC-3, E-AC-3 and DTS tracks throw an error naming the codec.
88
+ Surround tracks keep their layout (up to 5.1, WAV channel order). E-AC-3 and TrueHD tracks throw an error naming the codec.
85
89
 
86
90
  ### Browser
87
91
 
@@ -175,6 +179,6 @@ worker.onmessage = ({ data }) => { /* { channelData, sampleRate } */ }
175
179
 
176
180
  ## Licensing
177
181
 
178
- The umbrella and most codec packages are MIT. Three codecs use another license: <a href="./packages/decode-aac">@audio/decode-aac</a> GPL-2.0, <a href="./packages/decode-wma">@audio/decode-wma</a> GPL-2.0-or-later, and <a href="./packages/decode-amr">@audio/decode-amr</a> Apache-2.0. Install only the codecs whose licenses fit your project. The umbrella loads them on demand.
182
+ The umbrella and most codec packages are MIT. Five codecs use another license: <a href="./packages/decode-aac">@audio/decode-aac</a> GPL-2.0, <a href="./packages/decode-wma">@audio/decode-wma</a>, <a href="./packages/decode-ac3">@audio/decode-ac3</a> and <a href="./packages/decode-dts">@audio/decode-dts</a> GPL-2.0-or-later, and <a href="./packages/decode-amr">@audio/decode-amr</a> Apache-2.0. Install only the codecs whose licenses fit your project. The umbrella loads them on demand.
179
183
 
180
184
  <p align="center"><a href="https://github.com/krishnized/license/">ॐ</a> · <a href="./LICENSE">MIT</a>
package/test.html CHANGED
@@ -35,6 +35,8 @@
35
35
  "@audio/decode-mp4": "./packages/decode-mp4/decode-mp4.js",
36
36
  "@audio/decode-avi": "./packages/decode-avi/decode-avi.js",
37
37
  "@audio/decode-opus/core": "./packages/decode-opus/core.js",
38
+ "@audio/decode-ac3": "./packages/decode-ac3/decode-ac3.js",
39
+ "@audio/decode-dts": "./packages/decode-dts/decode-dts.js",
38
40
  "@audio/decode-amr": "./packages/decode-amr/decode-amr.js",
39
41
  "@audio/decode-wma": "./packages/decode-wma/decode-wma.js"
40
42
  }