@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,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ID3v2 metadata parser for MP3 files.
|
|
3
|
+
* @module @audio/decode-mp3/meta
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const TD_U8 = new TextDecoder('utf-8'), TD_L1 = new TextDecoder('iso-8859-1')
|
|
7
|
+
|
|
8
|
+
function str(bytes, enc = 'utf-8') {
|
|
9
|
+
let end = bytes.length
|
|
10
|
+
if (enc === 'utf-16') {
|
|
11
|
+
while (end >= 2 && bytes[end - 1] === 0 && bytes[end - 2] === 0) end -= 2
|
|
12
|
+
return new TextDecoder('utf-16').decode(bytes.subarray(0, end))
|
|
13
|
+
}
|
|
14
|
+
while (end > 0 && bytes[end - 1] === 0) end--
|
|
15
|
+
return (enc === 'iso-8859-1' ? TD_L1 : TD_U8).decode(bytes.subarray(0, end))
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// ── Constants ───────────────────────────────────────────────────────────
|
|
19
|
+
|
|
20
|
+
export const ID3_MAP = {
|
|
21
|
+
TIT2: 'title', TPE1: 'artist', TALB: 'album', TPE2: 'albumartist',
|
|
22
|
+
TCOM: 'composer', TCON: 'genre', TYER: 'year', TDRC: 'year',
|
|
23
|
+
TRCK: 'track', TPOS: 'disc', TBPM: 'bpm', TKEY: 'key',
|
|
24
|
+
TCOP: 'copyright', TSRC: 'isrc', TPUB: 'publisher', TENC: 'software',
|
|
25
|
+
COMM: 'comment', USLT: 'lyrics'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// ── Binary helpers ──────────────────────────────────────────────────────
|
|
29
|
+
|
|
30
|
+
function u32be(b, o) { return (b[o] * 0x1000000) + (b[o + 1] << 16) + (b[o + 2] << 8) + b[o + 3] }
|
|
31
|
+
function synchsafe(b, o) { return (b[o] << 21) | (b[o + 1] << 14) | (b[o + 2] << 7) | b[o + 3] }
|
|
32
|
+
|
|
33
|
+
// ── ID3v2 parsing ───────────────────────────────────────────────────────
|
|
34
|
+
|
|
35
|
+
function splitEncodedStrings(b) {
|
|
36
|
+
if (!b.length) return []
|
|
37
|
+
let enc = b[0], data = b.subarray(1)
|
|
38
|
+
let out = []
|
|
39
|
+
if (enc === 1 || enc === 2) {
|
|
40
|
+
let start = 0
|
|
41
|
+
if (enc === 1 && data.length >= 2 && ((data[0] === 0xFF && data[1] === 0xFE) || (data[0] === 0xFE && data[1] === 0xFF))) start = 2
|
|
42
|
+
let i = start
|
|
43
|
+
for (let j = start; j < data.length - 1; j += 2) {
|
|
44
|
+
if (data[j] === 0 && data[j + 1] === 0) {
|
|
45
|
+
let td = new TextDecoder(enc === 1 ? (start === 2 && data[0] === 0xFE ? 'utf-16be' : 'utf-16le') : 'utf-16be')
|
|
46
|
+
out.push(td.decode(data.subarray(i, j)))
|
|
47
|
+
i = j + 2
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (i < data.length) {
|
|
51
|
+
let td = new TextDecoder(enc === 1 ? (start === 2 && data[0] === 0xFE ? 'utf-16be' : 'utf-16le') : 'utf-16be')
|
|
52
|
+
out.push(td.decode(data.subarray(i, data.length - (data[data.length - 1] === 0 && data[data.length - 2] === 0 ? 2 : 0))))
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
let i = 0
|
|
56
|
+
for (let j = 0; j < data.length; j++) {
|
|
57
|
+
if (data[j] === 0) { out.push(str(data.subarray(i, j), enc === 3 ? 'utf-8' : 'iso-8859-1')); i = j + 1 }
|
|
58
|
+
}
|
|
59
|
+
if (i < data.length) out.push(str(data.subarray(i), enc === 3 ? 'utf-8' : 'iso-8859-1'))
|
|
60
|
+
}
|
|
61
|
+
return out
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function parseApic(body) {
|
|
65
|
+
let enc = body[0], i = 1
|
|
66
|
+
let mime = '', desc = ''
|
|
67
|
+
while (i < body.length && body[i] !== 0) i++
|
|
68
|
+
mime = str(body.subarray(1, i), 'iso-8859-1')
|
|
69
|
+
i++
|
|
70
|
+
let type = body[i++]
|
|
71
|
+
let descStart = i
|
|
72
|
+
if (enc === 1 || enc === 2) {
|
|
73
|
+
while (i + 1 < body.length && !(body[i] === 0 && body[i + 1] === 0)) i += 2
|
|
74
|
+
desc = enc === 1 ? new TextDecoder('utf-16le').decode(body.subarray(descStart, i)) : new TextDecoder('utf-16be').decode(body.subarray(descStart, i))
|
|
75
|
+
i += 2
|
|
76
|
+
} else {
|
|
77
|
+
while (i < body.length && body[i] !== 0) i++
|
|
78
|
+
desc = str(body.subarray(descStart, i), enc === 3 ? 'utf-8' : 'iso-8859-1')
|
|
79
|
+
i++
|
|
80
|
+
}
|
|
81
|
+
let data = body.slice(i)
|
|
82
|
+
return { mime, type, description: desc, data }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Parse ID3v2 tag. Returns {meta, size, markers: [], regions: []} or null. */
|
|
86
|
+
export function parseId3v2(bytes) {
|
|
87
|
+
if (bytes.length < 10 || bytes[0] !== 0x49 || bytes[1] !== 0x44 || bytes[2] !== 0x33) return null
|
|
88
|
+
let ver = bytes[3], flags = bytes[5], size = synchsafe(bytes, 6)
|
|
89
|
+
let end = Math.min(10 + size, bytes.length)
|
|
90
|
+
let meta = {}, raw = { version: ver, frames: [] }, pictures = []
|
|
91
|
+
let headerSize = ver === 2 ? 6 : 10
|
|
92
|
+
let sizeFn = ver >= 4 ? synchsafe : (b, o) => u32be(b, o)
|
|
93
|
+
let off = 10
|
|
94
|
+
if (flags & 0x40) {
|
|
95
|
+
let extSize = ver >= 4 ? synchsafe(bytes, off) : u32be(bytes, off)
|
|
96
|
+
off += extSize + (ver >= 4 ? 0 : 4)
|
|
97
|
+
}
|
|
98
|
+
while (off + headerSize <= end) {
|
|
99
|
+
let id, frameSize
|
|
100
|
+
if (ver === 2) {
|
|
101
|
+
id = String.fromCharCode(bytes[off], bytes[off + 1], bytes[off + 2])
|
|
102
|
+
frameSize = (bytes[off + 3] << 16) | (bytes[off + 4] << 8) | bytes[off + 5]
|
|
103
|
+
off += 6
|
|
104
|
+
} else {
|
|
105
|
+
id = String.fromCharCode(bytes[off], bytes[off + 1], bytes[off + 2], bytes[off + 3])
|
|
106
|
+
frameSize = sizeFn(bytes, off + 4)
|
|
107
|
+
off += 10
|
|
108
|
+
}
|
|
109
|
+
if (!id.match(/^[A-Z0-9]+$/)) break
|
|
110
|
+
if (frameSize === 0 || off + frameSize > end) break
|
|
111
|
+
let body = bytes.subarray(off, off + frameSize)
|
|
112
|
+
raw.frames.push({ id, body })
|
|
113
|
+
let key = ID3_MAP[id]
|
|
114
|
+
if (id === 'APIC' && body.length > 0) {
|
|
115
|
+
let p = parseApic(body)
|
|
116
|
+
if (p) pictures.push(p)
|
|
117
|
+
} else if (id === 'COMM' || id === 'USLT') {
|
|
118
|
+
if (body.length >= 4) {
|
|
119
|
+
let lang = str(body.subarray(1, 4), 'iso-8859-1')
|
|
120
|
+
let enc = body[0], rest = body.subarray(4)
|
|
121
|
+
let parts = splitEncodedStrings(Uint8Array.from([enc, ...rest]))
|
|
122
|
+
let text = parts[parts.length - 1] || ''
|
|
123
|
+
if (key) meta[key] = text
|
|
124
|
+
if (id === 'COMM') (meta.comments = meta.comments || []).push({ lang, description: parts[0] || '', text })
|
|
125
|
+
}
|
|
126
|
+
} else if (key) {
|
|
127
|
+
let parts = splitEncodedStrings(body)
|
|
128
|
+
meta[key] = parts.join('; ')
|
|
129
|
+
}
|
|
130
|
+
off += frameSize
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
meta.raw = raw
|
|
134
|
+
meta.pictures = pictures
|
|
135
|
+
return { meta, size: 10 + size, markers: [], regions: [] }
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** Parse MP3 metadata. Returns {meta, markers, regions} or null. */
|
|
139
|
+
export function parseMeta(bytes) {
|
|
140
|
+
if (!bytes?.length) return null
|
|
141
|
+
let r = parseId3v2(bytes)
|
|
142
|
+
return r ? { meta: r.meta, markers: r.markers, regions: r.regions } : null
|
|
143
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@audio/decode-mp3",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Decode MP3 audio via mpg123 WASM — self-contained bundle",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "decode-mp3.js",
|
|
7
|
+
"types": "decode-mp3.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./decode-mp3.js",
|
|
10
|
+
"./meta": "./meta.js",
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"decode-mp3.js",
|
|
15
|
+
"decode-mp3.d.ts",
|
|
16
|
+
"meta.js",
|
|
17
|
+
"LICENSE"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "bash build.sh",
|
|
21
|
+
"prepack": "npm run build",
|
|
22
|
+
"test": "node test.js"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"mp3",
|
|
26
|
+
"mpeg",
|
|
27
|
+
"audio",
|
|
28
|
+
"decode",
|
|
29
|
+
"decoder",
|
|
30
|
+
"wasm",
|
|
31
|
+
"mpg123"
|
|
32
|
+
],
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"author": "audiojs",
|
|
38
|
+
"homepage": "https://github.com/audiojs/audio-decode/tree/main/packages/decode-mp3#readme",
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "git+https://github.com/audiojs/audio-decode.git",
|
|
42
|
+
"directory": "packages/decode-mp3"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"mpg123-decoder": "^1.0.3"
|
|
46
|
+
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=16"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
This work is offered to Krishna (https://github.com/krishnized/license).
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
The MIT License (MIT)
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2025 audiojs
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
20
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
21
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
22
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
23
|
+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
24
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
|
25
|
+
OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# @audio/decode-opus
|
|
2
|
+
|
|
3
|
+
Decode Ogg Opus audio to PCM samples. Self-contained WASM bundle — no import map entries needed.
|
|
4
|
+
|
|
5
|
+
Wraps [ogg-opus-decoder](https://github.com/eshaz/wasm-audio-decoders/tree/main/src/ogg-opus-decoder).
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import decode, { decoder } from '@audio/decode-opus'
|
|
9
|
+
|
|
10
|
+
// whole-file
|
|
11
|
+
let { channelData, sampleRate } = await decode(opusbuf)
|
|
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 OpusDecoder {
|
|
7
|
+
decode(data: Uint8Array): AudioData;
|
|
8
|
+
flush(): AudioData;
|
|
9
|
+
free(): void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Whole-file Ogg Opus decode */
|
|
13
|
+
export default function decode(src: ArrayBuffer | Uint8Array): Promise<AudioData>;
|
|
14
|
+
|
|
15
|
+
/** Create streaming decoder instance */
|
|
16
|
+
export function decoder(): Promise<OpusDecoder>;
|