@openclaw/whatsapp 2026.5.28 → 2026.5.31-beta.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/dist/{access-control-Z0fYaWrx.js → access-control-C53zKYSN.js} +1 -1
- package/dist/{accounts-BMGM1RtF.js → accounts-DgViSyJx.js} +1 -0
- package/dist/{action-runtime-BdhkGtaP.js → action-runtime-Cyp5GNIT.js} +2 -2
- package/dist/action-runtime-api.js +1 -1
- package/dist/action-runtime.runtime.js +1 -1
- package/dist/api.js +9 -9
- package/dist/{approval-handler.runtime-C25wPeBf.js → approval-handler.runtime-BVmOu6x1.js} +1 -2
- package/dist/{auth-store-BrKb0mwT.js → auth-store-CZ22aNcV.js} +4 -2
- package/dist/{channel-D3y4A5Dd.js → channel-DA2BAIo5.js} +17 -64
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-react-action-Cd2qkLqp.js → channel-react-action-zvbaCnGe.js} +3 -3
- package/dist/{channel.runtime-C228XUjs.js → channel.runtime-Q1LZDB5s.js} +4 -4
- package/dist/{channel.setup-BJQyTUUP.js → channel.setup-DHXOo4h5.js} +2 -3
- package/dist/{config-schema-CsNDlDpL.js → config-schema-CROZuhT-.js} +16 -0
- package/dist/{connection-controller-mpPGmqGq.js → connection-controller-Bnm4INld.js} +2 -2
- package/dist/contract-api.js +1 -1
- package/dist/light-runtime-api.js +1 -1
- package/dist/{login-CE4UYnyO.js → login-2fuBM7Je.js} +4 -4
- package/dist/{login-qr-LBvhEes5.js → login-qr-B1o7GFy8.js} +10 -6
- package/dist/login-qr-runtime.js +1 -1
- package/dist/{monitor-Ccph7Y8M.js → monitor-BVRq04Dt.js} +36 -18
- package/dist/runtime-api.js +7 -7
- package/dist/{send-C4LG-Cl6.js → send-DSlVXKL_.js} +53 -41
- package/dist/{send-api-C66vkRl9.js → send-api-Bjn-h80j.js} +3 -2
- package/dist/{session-D8UW2Vbn.js → session-DyGWNClj.js} +1 -1
- package/dist/{setup-core-DpfT4K-2.js → setup-core-OvPMaAsx.js} +4 -4
- package/dist/{setup-finalize-CFnxX7la.js → setup-finalize-Dk23pfKc.js} +3 -3
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-DRsmp0ZS.js → setup-surface-F-jVrH8u.js} +3 -3
- package/node_modules/@audio/decode-aac/LICENSE +9 -0
- package/node_modules/@audio/decode-aac/README.md +60 -0
- package/node_modules/@audio/decode-aac/decode-aac.d.ts +16 -0
- package/node_modules/@audio/decode-aac/decode-aac.js +391 -0
- package/node_modules/@audio/decode-aac/package.json +47 -0
- package/node_modules/@audio/decode-aac/src/aac.wasm.cjs +0 -0
- package/node_modules/@audio/decode-aiff/LICENSE +21 -0
- package/node_modules/@audio/decode-aiff/README.md +53 -0
- package/node_modules/@audio/decode-aiff/decode-aiff.d.ts +16 -0
- package/node_modules/@audio/decode-aiff/decode-aiff.js +583 -0
- package/node_modules/@audio/decode-aiff/package.json +42 -0
- package/node_modules/@audio/decode-amr/LICENSE +191 -0
- package/node_modules/@audio/decode-amr/README.md +65 -0
- package/node_modules/@audio/decode-amr/decode-amr.d.ts +16 -0
- package/node_modules/@audio/decode-amr/decode-amr.js +159 -0
- package/node_modules/@audio/decode-amr/package.json +48 -0
- package/node_modules/@audio/decode-amr/src/amr.wasm.cjs +0 -0
- package/node_modules/@audio/decode-caf/LICENSE +21 -0
- package/node_modules/@audio/decode-caf/README.md +55 -0
- package/node_modules/@audio/decode-caf/decode-caf.d.ts +16 -0
- package/node_modules/@audio/decode-caf/decode-caf.js +190 -0
- package/node_modules/@audio/decode-caf/package.json +43 -0
- package/node_modules/{audio-buffer → @audio/decode-flac}/LICENSE +5 -2
- package/node_modules/@audio/decode-flac/README.md +23 -0
- package/node_modules/@audio/decode-flac/decode-flac.d.ts +16 -0
- package/node_modules/@audio/decode-flac/decode-flac.js +2994 -0
- package/node_modules/@audio/decode-flac/meta.js +115 -0
- package/node_modules/@audio/decode-flac/package.json +49 -0
- package/node_modules/@audio/decode-mp3/LICENSE +25 -0
- package/node_modules/@audio/decode-mp3/README.md +23 -0
- package/node_modules/@audio/decode-mp3/decode-mp3.d.ts +16 -0
- package/node_modules/@audio/decode-mp3/decode-mp3.js +868 -0
- package/node_modules/@audio/decode-mp3/meta.js +143 -0
- package/node_modules/@audio/decode-mp3/package.json +50 -0
- package/node_modules/@audio/decode-opus/LICENSE +25 -0
- package/node_modules/@audio/decode-opus/README.md +23 -0
- package/node_modules/@audio/decode-opus/decode-opus.d.ts +16 -0
- package/node_modules/@audio/decode-opus/decode-opus.js +3179 -0
- package/node_modules/@audio/decode-opus/package.json +47 -0
- package/node_modules/@audio/decode-qoa/LICENSE +25 -0
- package/node_modules/@audio/decode-qoa/README.md +21 -0
- package/node_modules/@audio/decode-qoa/decode-qoa.d.ts +16 -0
- package/node_modules/@audio/decode-qoa/decode-qoa.js +278 -0
- package/node_modules/@audio/decode-qoa/package.json +46 -0
- package/node_modules/@audio/decode-vorbis/LICENSE +25 -0
- package/node_modules/@audio/decode-vorbis/README.md +23 -0
- package/node_modules/@audio/decode-vorbis/decode-vorbis.d.ts +16 -0
- package/node_modules/@audio/decode-vorbis/decode-vorbis.js +2984 -0
- package/node_modules/@audio/decode-vorbis/package.json +47 -0
- package/node_modules/@audio/decode-wav/decode-wav.js +104 -0
- package/node_modules/@audio/decode-wav/meta.js +114 -0
- package/node_modules/@audio/decode-wav/package.json +27 -0
- package/node_modules/@audio/decode-webm/LICENSE +21 -0
- package/node_modules/@audio/decode-webm/README.md +57 -0
- package/node_modules/@audio/decode-webm/decode-webm.d.ts +16 -0
- package/node_modules/@audio/decode-webm/decode-webm.js +3964 -0
- package/node_modules/@audio/decode-webm/package.json +51 -0
- package/node_modules/@audio/decode-wma/LICENSE +12 -0
- package/node_modules/@audio/decode-wma/README.md +76 -0
- package/node_modules/@audio/decode-wma/decode-wma.d.ts +33 -0
- package/node_modules/@audio/decode-wma/decode-wma.js +525 -0
- package/node_modules/@audio/decode-wma/package.json +47 -0
- package/node_modules/@audio/decode-wma/src/wma.wasm.cjs +0 -0
- package/node_modules/audio-decode/.claude/settings.json +204 -0
- package/node_modules/audio-decode/.github/workflows/test.js.yml +11 -20
- package/node_modules/audio-decode/.gitmodules +9 -0
- package/node_modules/audio-decode/audio-decode.d.ts +48 -10
- package/node_modules/audio-decode/audio-decode.js +193 -77
- package/node_modules/audio-decode/meta.js +11 -0
- package/node_modules/audio-decode/package.json +49 -21
- package/node_modules/audio-decode/readme.md +129 -29
- package/node_modules/audio-decode/stream.d.ts +15 -0
- package/node_modules/audio-decode/stream.js +1 -0
- package/node_modules/audio-decode/test.html +29 -10
- package/node_modules/lru-cache/dist/commonjs/browser/index.d.ts +2 -2
- package/node_modules/lru-cache/dist/commonjs/browser/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/browser/index.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/browser/index.min.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/index.d.ts +2 -2
- package/node_modules/lru-cache/dist/commonjs/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/index.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/index.min.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/node/index.d.ts +2 -2
- package/node_modules/lru-cache/dist/commonjs/node/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/node/index.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/node/index.min.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/browser/index.d.ts +2 -2
- package/node_modules/lru-cache/dist/esm/browser/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/esm/browser/index.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/browser/index.min.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/index.d.ts +2 -2
- package/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/esm/index.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/index.min.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/node/index.d.ts +2 -2
- package/node_modules/lru-cache/dist/esm/node/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/esm/node/index.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/node/index.min.js.map +1 -1
- package/node_modules/lru-cache/package.json +1 -1
- package/node_modules/typebox/build/type/script/mapping.d.mts +5 -2
- package/node_modules/typebox/build/type/script/mapping.mjs +15 -8
- package/node_modules/typebox/build/type/script/parser.d.mts +3 -1
- package/node_modules/typebox/build/type/script/parser.mjs +2 -1
- package/node_modules/typebox/package.json +29 -29
- package/npm-shrinkwrap.json +156 -39
- package/openclaw.plugin.json +76 -0
- package/package.json +6 -6
- package/node_modules/audio-buffer/.eslintrc.json +0 -44
- package/node_modules/audio-buffer/.github/workflows/node.js.yml +0 -31
- package/node_modules/audio-buffer/.travis.yml +0 -7
- package/node_modules/audio-buffer/index.js +0 -76
- package/node_modules/audio-buffer/package.json +0 -37
- package/node_modules/audio-buffer/readme.md +0 -56
- package/node_modules/audio-decode/.eslintrc.json +0 -43
- package/node_modules/audio-decode/.travis.yml +0 -13
- package/node_modules/audio-decode/tea.yaml +0 -6
- package/node_modules/audio-decode/test-case.js +0 -11
- package/node_modules/audio-decode/test.js +0 -107
- package/node_modules/node-wav/README.md +0 -35
- package/node_modules/node-wav/file.wav +0 -0
- package/node_modules/node-wav/index.js +0 -291
- package/node_modules/node-wav/package.json +0 -29
- package/node_modules/node-wav/tests/file1.wav +0 -0
- package/node_modules/node-wav/tests/test.js +0 -66
- package/node_modules/node-wav/x.js +0 -12
- package/node_modules/node-wav/x.json +0 -86702
- package/node_modules/node-wav/x.js~ +0 -13
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CAF (Core Audio Format) decoder
|
|
3
|
+
* Decodes CAF containers with lpcm, alaw, ulaw audio to Float32 PCM
|
|
4
|
+
*
|
|
5
|
+
* let { channelData, sampleRate } = await decode(cafbuf)
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const EMPTY = Object.freeze({ channelData: [], sampleRate: 0 })
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Whole-file decode
|
|
12
|
+
* @param {Uint8Array|ArrayBuffer} src
|
|
13
|
+
* @returns {Promise<{channelData: Float32Array[], sampleRate: number}>}
|
|
14
|
+
*/
|
|
15
|
+
export default async function decode(src) {
|
|
16
|
+
let dec = await decoder()
|
|
17
|
+
try { return dec.decode(src) }
|
|
18
|
+
finally { dec.free() }
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Create decoder instance (streaming-aware)
|
|
23
|
+
* @returns {Promise<{decode(chunk: Uint8Array): {channelData, sampleRate}, flush(), free()}>}
|
|
24
|
+
*/
|
|
25
|
+
export async function decoder() {
|
|
26
|
+
let hdr = null, left = null, freed = false
|
|
27
|
+
return {
|
|
28
|
+
decode(data) {
|
|
29
|
+
if (freed) throw Error('Decoder already freed')
|
|
30
|
+
if (!data || !data.byteLength) return EMPTY
|
|
31
|
+
let chunk = data instanceof Uint8Array ? data : new Uint8Array(data)
|
|
32
|
+
if (left) { chunk = catB(left, chunk); left = null }
|
|
33
|
+
if (!hdr) {
|
|
34
|
+
hdr = scanCafHdr(chunk)
|
|
35
|
+
if (!hdr) { left = chunk.slice(); return EMPTY }
|
|
36
|
+
chunk = chunk.subarray(hdr.dataStart)
|
|
37
|
+
}
|
|
38
|
+
let fb = hdr.frameBytes
|
|
39
|
+
let complete = Math.floor(chunk.length / fb) * fb
|
|
40
|
+
if (!complete) { if (chunk.length) left = chunk.slice(); return EMPTY }
|
|
41
|
+
if (chunk.length > complete) left = chunk.subarray(complete).slice()
|
|
42
|
+
return decodeCafRaw(chunk.subarray(0, complete), hdr)
|
|
43
|
+
},
|
|
44
|
+
flush() { left = null; return EMPTY },
|
|
45
|
+
free() { freed = true; left = null; hdr = null },
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function catB(a, b) {
|
|
50
|
+
let r = new Uint8Array(a.length + b.length)
|
|
51
|
+
r.set(a); r.set(b, a.length)
|
|
52
|
+
return r
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function scanCafHdr(buf) {
|
|
56
|
+
if (buf.length < 8) return null
|
|
57
|
+
if (buf[0] !== 0x63 || buf[1] !== 0x61 || buf[2] !== 0x66 || buf[3] !== 0x66) throw Error('Not a CAF file')
|
|
58
|
+
let dv = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)
|
|
59
|
+
if (dv.getUint16(4, false) !== 1) throw Error('Unsupported CAF version')
|
|
60
|
+
let off = 8, desc = null
|
|
61
|
+
while (off + 12 <= buf.length) {
|
|
62
|
+
let type = String.fromCharCode(buf[off], buf[off + 1], buf[off + 2], buf[off + 3])
|
|
63
|
+
let sizeHi = dv.getUint32(off + 4, false), sizeLo = dv.getUint32(off + 8, false)
|
|
64
|
+
let size = sizeHi * 0x100000000 + sizeLo
|
|
65
|
+
off += 12
|
|
66
|
+
if (type === 'desc') {
|
|
67
|
+
if (off + 32 > buf.length) return null
|
|
68
|
+
desc = {
|
|
69
|
+
sampleRate: dv.getFloat64(off, false),
|
|
70
|
+
formatID: String.fromCharCode(buf[off + 8], buf[off + 9], buf[off + 10], buf[off + 11]),
|
|
71
|
+
formatFlags: dv.getUint32(off + 12, false),
|
|
72
|
+
bytesPerPacket: dv.getUint32(off + 16, false),
|
|
73
|
+
framesPerPacket: dv.getUint32(off + 20, false),
|
|
74
|
+
channelsPerFrame: dv.getUint32(off + 24, false),
|
|
75
|
+
bitsPerChannel: dv.getUint32(off + 28, false),
|
|
76
|
+
}
|
|
77
|
+
} else if (type === 'data') {
|
|
78
|
+
if (!desc) return null
|
|
79
|
+
let dataStart = off + 4 // skip editCount
|
|
80
|
+
if (dataStart > buf.length) return null
|
|
81
|
+
let { formatID, formatFlags, channelsPerFrame: ch, bitsPerChannel: bits } = desc
|
|
82
|
+
let bytesPerSample = bits >> 3
|
|
83
|
+
let frameBytes
|
|
84
|
+
if (formatID === 'alaw' || formatID === 'ulaw') frameBytes = ch
|
|
85
|
+
else frameBytes = ch * bytesPerSample
|
|
86
|
+
if (!frameBytes) return null
|
|
87
|
+
return { ...desc, dataStart, frameBytes }
|
|
88
|
+
}
|
|
89
|
+
if (size < 0) break
|
|
90
|
+
if (sizeHi === 0xFFFFFFFF && sizeLo === 0xFFFFFFFF) break
|
|
91
|
+
off += size
|
|
92
|
+
}
|
|
93
|
+
return null
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function decodeCafRaw(raw, hdr) {
|
|
97
|
+
let { sampleRate, formatID, formatFlags, channelsPerFrame: ch, bitsPerChannel: bits, frameBytes } = hdr
|
|
98
|
+
let frames = Math.floor(raw.length / frameBytes)
|
|
99
|
+
if (!frames) return EMPTY
|
|
100
|
+
let samples
|
|
101
|
+
if (formatID === 'lpcm') samples = decodeLPCM(raw, formatFlags, bits, ch)
|
|
102
|
+
else if (formatID === 'alaw') samples = decodeAlaw(raw, ch)
|
|
103
|
+
else if (formatID === 'ulaw') samples = decodeUlaw(raw, ch)
|
|
104
|
+
else throw Error('CAF: unsupported format ' + formatID)
|
|
105
|
+
return { channelData: samples, sampleRate }
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function decodeLPCM(data, flags, bits, ch) {
|
|
109
|
+
let isFloat = flags & 1, isLE = flags & 2
|
|
110
|
+
let bytesPerSample = bits >> 3
|
|
111
|
+
let totalSamples = (data.length / bytesPerSample) | 0
|
|
112
|
+
let framesCount = (totalSamples / ch) | 0
|
|
113
|
+
if (!framesCount) return []
|
|
114
|
+
|
|
115
|
+
let dv = new DataView(data.buffer, data.byteOffset, data.byteLength)
|
|
116
|
+
let channelData = Array.from({ length: ch }, () => new Float32Array(framesCount))
|
|
117
|
+
|
|
118
|
+
if (isFloat && bits === 32) {
|
|
119
|
+
for (let i = 0, off = 0; i < framesCount; i++)
|
|
120
|
+
for (let c = 0; c < ch; c++, off += 4)
|
|
121
|
+
channelData[c][i] = dv.getFloat32(off, !!isLE)
|
|
122
|
+
} else if (isFloat && bits === 64) {
|
|
123
|
+
for (let i = 0, off = 0; i < framesCount; i++)
|
|
124
|
+
for (let c = 0; c < ch; c++, off += 8)
|
|
125
|
+
channelData[c][i] = dv.getFloat64(off, !!isLE)
|
|
126
|
+
} else if (bits === 32) {
|
|
127
|
+
let norm = 1 / 2147483648
|
|
128
|
+
for (let i = 0, off = 0; i < framesCount; i++)
|
|
129
|
+
for (let c = 0; c < ch; c++, off += 4)
|
|
130
|
+
channelData[c][i] = dv.getInt32(off, !!isLE) * norm
|
|
131
|
+
} else if (bits === 24) {
|
|
132
|
+
let norm = 1 / 8388608
|
|
133
|
+
for (let i = 0, off = 0; i < framesCount; i++)
|
|
134
|
+
for (let c = 0; c < ch; c++, off += 3) {
|
|
135
|
+
let s
|
|
136
|
+
if (!isLE) s = (data[off] << 16) | (data[off + 1] << 8) | data[off + 2]
|
|
137
|
+
else s = data[off] | (data[off + 1] << 8) | (data[off + 2] << 16)
|
|
138
|
+
if (s & 0x800000) s |= ~0xFFFFFF
|
|
139
|
+
channelData[c][i] = s * norm
|
|
140
|
+
}
|
|
141
|
+
} else if (bits === 16) {
|
|
142
|
+
let norm = 1 / 32768
|
|
143
|
+
for (let i = 0, off = 0; i < framesCount; i++)
|
|
144
|
+
for (let c = 0; c < ch; c++, off += 2)
|
|
145
|
+
channelData[c][i] = dv.getInt16(off, !!isLE) * norm
|
|
146
|
+
} else if (bits === 8) {
|
|
147
|
+
let norm = 1 / 128
|
|
148
|
+
for (let i = 0, off = 0; i < framesCount; i++)
|
|
149
|
+
for (let c = 0; c < ch; c++, off++)
|
|
150
|
+
channelData[c][i] = dv.getInt8(off) * norm
|
|
151
|
+
} else {
|
|
152
|
+
throw Error('CAF: unsupported LPCM bit depth ' + bits)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return channelData
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function alawDecode(val) {
|
|
159
|
+
val ^= 0x55
|
|
160
|
+
let sign = val & 0x80, seg = (val >> 4) & 7, quant = val & 0x0F
|
|
161
|
+
let sample = seg ? ((quant << 1) | 0x21) << (seg - 1) : (quant << 1) | 1
|
|
162
|
+
return (sign ? -sample : sample) / 32768
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function ulawDecode(val) {
|
|
166
|
+
val = ~val & 0xFF
|
|
167
|
+
let sign = val & 0x80, exp = (val >> 4) & 7, mant = val & 0x0F
|
|
168
|
+
let sample = ((mant << 1) | 0x21) << exp
|
|
169
|
+
return (sign ? -(sample - 33) : (sample - 33)) / 32768
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function decodeAlaw(data, ch) {
|
|
173
|
+
let framesCount = (data.length / ch) | 0
|
|
174
|
+
if (!framesCount) return []
|
|
175
|
+
let channelData = Array.from({ length: ch }, () => new Float32Array(framesCount))
|
|
176
|
+
for (let i = 0, off = 0; i < framesCount; i++)
|
|
177
|
+
for (let c = 0; c < ch; c++, off++)
|
|
178
|
+
channelData[c][i] = alawDecode(data[off])
|
|
179
|
+
return channelData
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function decodeUlaw(data, ch) {
|
|
183
|
+
let framesCount = (data.length / ch) | 0
|
|
184
|
+
if (!framesCount) return []
|
|
185
|
+
let channelData = Array.from({ length: ch }, () => new Float32Array(framesCount))
|
|
186
|
+
for (let i = 0, off = 0; i < framesCount; i++)
|
|
187
|
+
for (let c = 0; c < ch; c++, off++)
|
|
188
|
+
channelData[c][i] = ulawDecode(data[off])
|
|
189
|
+
return channelData
|
|
190
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@audio/decode-caf",
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"description": "Decode CAF (Core Audio Format) audio to PCM samples",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "decode-caf.js",
|
|
7
|
+
"types": "decode-caf.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./decode-caf.js",
|
|
10
|
+
"./package.json": "./package.json"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"decode-caf.js",
|
|
14
|
+
"decode-caf.d.ts",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"test": "node test.js"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"caf",
|
|
22
|
+
"core-audio",
|
|
23
|
+
"apple",
|
|
24
|
+
"audio",
|
|
25
|
+
"decode",
|
|
26
|
+
"decoder",
|
|
27
|
+
"pcm"
|
|
28
|
+
],
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"author": "audiojs",
|
|
34
|
+
"homepage": "https://github.com/audiojs/decode-caf#readme",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "git+https://github.com/audiojs/decode-caf.git"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=16"
|
|
41
|
+
},
|
|
42
|
+
"bugs": "https://github.com/audiojs/decode-caf/issues"
|
|
43
|
+
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
This work is offered to Krishna (https://github.com/krishnized/license).
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
1
5
|
The MIT License (MIT)
|
|
2
|
-
Copyright (c) 2018 Dmitry Yvanov <df.creative@gmail.com>
|
|
3
6
|
|
|
7
|
+
Copyright (c) 2025 audiojs
|
|
4
8
|
|
|
5
9
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
10
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -19,4 +23,3 @@ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
|
19
23
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
20
24
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
|
21
25
|
OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
-
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# @audio/decode-flac
|
|
2
|
+
|
|
3
|
+
Decode FLAC audio to PCM samples. Self-contained WASM bundle — no import map entries needed.
|
|
4
|
+
|
|
5
|
+
Wraps [@wasm-audio-decoders/flac](https://github.com/eshaz/wasm-audio-decoders).
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import decode, { decoder } from '@audio/decode-flac'
|
|
9
|
+
|
|
10
|
+
// whole-file
|
|
11
|
+
let { channelData, sampleRate } = await decode(flacbuf)
|
|
12
|
+
|
|
13
|
+
// streaming
|
|
14
|
+
let dec = await decoder()
|
|
15
|
+
let a = dec.decode(chunk1)
|
|
16
|
+
let b = dec.decode(chunk2)
|
|
17
|
+
let c = dec.flush()
|
|
18
|
+
dec.free()
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## License
|
|
22
|
+
|
|
23
|
+
[MIT](./LICENSE) · [ॐ](https://github.com/krishnized/license/)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface AudioData {
|
|
2
|
+
channelData: Float32Array[];
|
|
3
|
+
sampleRate: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
interface FlacDecoder {
|
|
7
|
+
decode(data: Uint8Array): AudioData;
|
|
8
|
+
flush(): AudioData;
|
|
9
|
+
free(): void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Whole-file FLAC decode */
|
|
13
|
+
export default function decode(src: ArrayBuffer | Uint8Array): Promise<AudioData>;
|
|
14
|
+
|
|
15
|
+
/** Create streaming decoder instance */
|
|
16
|
+
export function decoder(): Promise<FlacDecoder>;
|