@audio/decode-aac 1.3.3 → 1.4.0
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/README.md +10 -8
- package/decode-aac.d.ts +2 -2
- package/decode-aac.js +1 -1
- package/package.json +4 -4
- package/src/aac.wasm.cjs +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @audio/decode-aac
|
|
2
2
|
|
|
3
|
-
Decode AAC/M4A and ALAC
|
|
3
|
+
Decode AAC/M4A and ALAC audio to PCM float samples. FAAD2 WASM handles AAC; a pure-JS port of Apple's reference decoder handles ALAC. The M4A sample entry selects the codec.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -13,7 +13,7 @@ npm i @audio/decode-aac
|
|
|
13
13
|
```js
|
|
14
14
|
import decode from '@audio/decode-aac'
|
|
15
15
|
|
|
16
|
-
// M4A or raw ADTS
|
|
16
|
+
// M4A or raw ADTS; auto-detected
|
|
17
17
|
let { channelData, sampleRate } = await decode(uint8array)
|
|
18
18
|
// channelData: Float32Array[] (one per channel)
|
|
19
19
|
// sampleRate: number
|
|
@@ -29,6 +29,8 @@ let { channelData, sampleRate } = dec.decode(chunk)
|
|
|
29
29
|
dec.free()
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
`decoder()` is asynchronous. Its `decode()` and `flush()` methods are synchronous.
|
|
33
|
+
|
|
32
34
|
## API
|
|
33
35
|
|
|
34
36
|
### `decode(src: Uint8Array | ArrayBuffer): Promise<AudioData>`
|
|
@@ -39,9 +41,9 @@ Whole-file decode. Auto-detects M4A (MP4 container) vs raw ADTS.
|
|
|
39
41
|
|
|
40
42
|
Creates a decoder instance for manual control.
|
|
41
43
|
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
44
|
+
- `dec.decode(data)`: decode a `Uint8Array` or `ArrayBuffer` chunk.
|
|
45
|
+
- `dec.flush()`: discard buffered partial data and return an empty result.
|
|
46
|
+
- `dec.free()`: release WASM memory.
|
|
45
47
|
|
|
46
48
|
### `AudioData`
|
|
47
49
|
|
|
@@ -51,8 +53,8 @@ Creates a decoder instance for manual control.
|
|
|
51
53
|
|
|
52
54
|
## Formats
|
|
53
55
|
|
|
54
|
-
- M4A / MP4 with AAC audio (LC
|
|
55
|
-
- M4A / MP4 with ALAC
|
|
56
|
+
- M4A / MP4 with AAC audio (LC and HE-AAC v1/v2 with SBR or PS)
|
|
57
|
+
- M4A / MP4 with bit-exact pure-JS ALAC decoding at 16, 20, 24, or 32 bits
|
|
56
58
|
- Raw ADTS streams (.aac)
|
|
57
59
|
|
|
58
60
|
## Metadata
|
|
@@ -66,4 +68,4 @@ let { meta, sampleRate } = parseMeta(m4aBytes)
|
|
|
66
68
|
|
|
67
69
|
## License
|
|
68
70
|
|
|
69
|
-
AAC decoding
|
|
71
|
+
[ॐ](https://github.com/krishnized/license/) · AAC decoding [GPL-2.0](./LICENSE) (FAAD2), ALAC decoding Apache-2.0 (port of Apple's ALAC reference)
|
package/decode-aac.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
interface AudioData {
|
|
1
|
+
export interface AudioData {
|
|
2
2
|
channelData: Float32Array[];
|
|
3
3
|
sampleRate: number;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
interface AACDecoder {
|
|
7
|
-
decode(data: Uint8Array): AudioData;
|
|
7
|
+
decode(data: Uint8Array | ArrayBuffer): AudioData;
|
|
8
8
|
flush(): AudioData;
|
|
9
9
|
free(): void;
|
|
10
10
|
}
|
package/decode-aac.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@audio/decode-aac",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Decode AAC/M4A (FAAD2 WASM) and ALAC/Apple Lossless (pure JS) to PCM samples",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "decode-aac.js",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
],
|
|
48
48
|
"license": "GPL-2.0",
|
|
49
49
|
"author": "audiojs",
|
|
50
|
-
"homepage": "https://github.com/audiojs/decode-aac#readme",
|
|
51
|
-
"bugs": "https://github.com/audiojs/decode
|
|
50
|
+
"homepage": "https://github.com/audiojs/decode/tree/master/packages/decode-aac#readme",
|
|
51
|
+
"bugs": "https://github.com/audiojs/decode/issues",
|
|
52
52
|
"repository": {
|
|
53
53
|
"type": "git",
|
|
54
|
-
"url": "git+https://github.com/audiojs/decode
|
|
54
|
+
"url": "git+https://github.com/audiojs/decode.git",
|
|
55
55
|
"directory": "packages/decode-aac"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|
package/src/aac.wasm.cjs
CHANGED
|
Binary file
|