@openclaw/whatsapp 2026.9.6 → 2026.9.7
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/assets/icon.png +0 -0
- package/dist/.setup/{accounts-D_NGDjCx.mjs → accounts-CtRPAQCL.mjs} +3 -9
- package/dist/.setup/{action-runtime-DZZFamfl.mjs → action-runtime-DeVk5V7r.mjs} +2 -2
- package/dist/.setup/{approval-handler.runtime-C0hzmMSj.mjs → approval-handler.runtime-CjqMlPOX.mjs} +6 -26
- package/dist/.setup/{approval-reactions-BnXw-UZI.mjs → approval-reactions-DiOFvb1s.mjs} +8 -14
- package/dist/.setup/{auth-store-Dh8a3cba.mjs → auth-store-BBonwKks.mjs} +9 -33
- package/dist/.setup/{channel-Bg_fS2iF.mjs → channel-CJFE0kD_.mjs} +82 -154
- package/dist/.setup/{channel-react-action-1iBiEnq7.mjs → channel-react-action-2r_hjLZV.mjs} +4 -8
- package/dist/.setup/{channel.runtime-rurG-kbr.mjs → channel.runtime-C94goLw9.mjs} +4 -4
- package/dist/.setup/{channel.setup-C8P5q8uD.mjs → channel.setup-CfN1UfdY.mjs} +1 -1
- package/dist/.setup/{connection-controller-C60mU7j7.mjs → connection-controller-CHo1oRJA.mjs} +13 -63
- package/dist/.setup/{creds-files-Drg3usj1.mjs → creds-files-CDATZWWM.mjs} +5 -11
- package/dist/.setup/{directory-config-BHPoBklt.mjs → directory-config-DUiJ5d8I.mjs} +13 -14
- package/dist/.setup/doctor-iMwg0Vhr.mjs +222 -0
- package/dist/.setup/group-config-path-DZr3ucUO.mjs +40 -0
- package/dist/.setup/{group-session-key-D22hYMdE.mjs → group-session-key-2-mja4OF.mjs} +3 -9
- package/dist/.setup/{login-2dmd1TfE.mjs → login-BFlvSh9h.mjs} +9 -11
- package/dist/.setup/{login-qr-CgKtO_ef.mjs → login-qr-Ayb8i25J.mjs} +29 -77
- package/dist/.setup/{monitor-By82ehLA.mjs → monitor-CGpV2VNN.mjs} +376 -504
- package/dist/.setup/{question-reactions-D3Zq9Gbn.mjs → question-reactions-CPyyi5AY.mjs} +2 -2
- package/dist/.setup/rolldown-runtime-BBjsoOtd.mjs +27 -0
- package/dist/.setup/{send-C6jDmcL9.mjs → send-BGdvf5cC.mjs} +31 -80
- package/dist/.setup/{send-api-B4DOt2RJ.mjs → send-api-H4AkQJjT.mjs} +45 -109
- package/dist/.setup/{session-errors-JuazczrA.mjs → session-errors-B8UcAnZN.mjs} +1 -4
- package/dist/.setup/{session.runtime-DcJuO42v.mjs → session.runtime-st1konFI.mjs} +1 -1
- package/dist/.setup/{setup-finalize-pGqWOiFX.mjs → setup-finalize-DmPX4EaW.mjs} +32 -70
- package/dist/.setup/setup-plugin-api-vJlxKzca.mjs +3 -0
- package/dist/.setup/{setup-surface-B9CYwDPZ.mjs → setup-surface-43fj197P.mjs} +3 -3
- package/dist/.setup/{shared-DVgQ8kRG.mjs → shared-DgOG5Iqr.mjs} +26 -37
- package/dist/.setup/{socket-close-CCVSFufF.mjs → socket-close-CT__V2fz.mjs} +80 -92
- package/dist/.setup/{targets-runtime-RBjx3pg_.mjs → targets-runtime-DmiqXIXO.mjs} +2 -7
- package/dist/action-runtime-api.js +1 -1
- package/dist/action-runtime.runtime.js +1 -1
- package/dist/agent-tools-api.js +5 -12
- package/dist/api.js +10 -10
- package/dist/auth-presence.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/contract-api.js +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +9 -10
- package/dist/light-runtime-api.js +2 -2
- package/dist/login-qr-runtime.js +1 -1
- package/dist/runtime-api.js +9 -9
- package/dist/setup-entry.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/node_modules/audio-decode/LICENSE +9 -10
- package/node_modules/audio-decode/README.md +16 -0
- package/node_modules/audio-decode/audio-decode.d.ts +2 -14
- package/node_modules/audio-decode/audio-decode.js +4 -92
- package/node_modules/audio-decode/meta.js +1 -0
- package/node_modules/audio-decode/node_modules/{audio-buffer → @audio/decode}/LICENSE +1 -1
- package/node_modules/audio-decode/node_modules/@audio/decode/audio-decode.d.ts +52 -0
- package/node_modules/audio-decode/node_modules/@audio/decode/audio-decode.js +242 -0
- package/node_modules/audio-decode/node_modules/@audio/decode/meta.js +14 -0
- package/node_modules/audio-decode/node_modules/@audio/decode/package.json +114 -0
- package/node_modules/audio-decode/node_modules/@audio/decode/readme.md +191 -0
- package/node_modules/audio-decode/node_modules/@audio/decode/stream.d.ts +12 -0
- package/node_modules/audio-decode/node_modules/@audio/decode/stream.js +1 -0
- package/node_modules/audio-decode/node_modules/@audio/decode/test.html +52 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-aac/LICENSE +9 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-aac/README.md +80 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-aac/alac.js +326 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-aac/audio.d.ts +15 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-aac/audio.js +10 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-aac/decode-aac.d.ts +24 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-aac/decode-aac.js +452 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-aac/meta.js +81 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-aac/package.json +63 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-aac/src/aac.wasm.js +0 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-ac3/LICENSE +12 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-ac3/LICENSE.liba52 +340 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-ac3/README.md +41 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-ac3/audio.d.ts +15 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-ac3/audio.js +9 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-ac3/decode-ac3.d.ts +20 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-ac3/decode-ac3.js +131 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-ac3/package.json +64 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-ac3/src/ac3.wasm.js +0 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-aiff/LICENSE +21 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-aiff/README.md +46 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-aiff/audio.d.ts +15 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-aiff/audio.js +10 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-aiff/decode-aiff.d.ts +16 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-aiff/decode-aiff.js +583 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-aiff/package.json +52 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-amr/LICENSE +191 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-amr/README.md +65 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-amr/audio.d.ts +15 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-amr/audio.js +10 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-amr/decode-amr.d.ts +16 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-amr/decode-amr.js +150 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-amr/package.json +58 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-amr/src/amr.wasm.js +0 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-avi/LICENSE +21 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-avi/README.md +53 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-avi/audio.d.ts +15 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-avi/audio.js +9 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-avi/decode-avi.d.ts +21 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-avi/decode-avi.js +241 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-avi/package.json +66 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-caf/LICENSE +21 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-caf/README.md +48 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-caf/audio.d.ts +15 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-caf/audio.js +10 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-caf/decode-caf.d.ts +16 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-caf/decode-caf.js +238 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-caf/package.json +53 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-dsd/LICENSE +21 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-dsd/README.md +73 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-dsd/audio.d.ts +21 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-dsd/audio.js +15 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-dsd/decode-dsd.d.ts +29 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-dsd/decode-dsd.js +423 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-dsd/meta.js +40 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-dsd/package.json +64 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-dts/LICENSE +12 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-dts/LICENSE.libdca +339 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-dts/README.md +41 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-dts/audio.d.ts +15 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-dts/audio.js +9 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-dts/decode-dts.d.ts +20 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-dts/decode-dts.js +139 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-dts/package.json +64 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-dts/src/dts.wasm.js +0 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-eac3/LICENSE +12 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-eac3/LICENSE.ffmpeg +502 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-eac3/README.md +45 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-eac3/audio.d.ts +15 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-eac3/audio.js +9 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-eac3/decode-eac3.d.ts +20 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-eac3/decode-eac3.js +124 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-eac3/package.json +68 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-eac3/src/eac3.wasm.js +0 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-flac/LICENSE +25 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-flac/README.md +23 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-flac/audio.d.ts +15 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-flac/audio.js +10 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-flac/decode-flac.d.ts +18 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-flac/decode-flac.js +3172 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-flac/meta.js +115 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-flac/package.json +60 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mod/LICENSE +23 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mod/LICENSE.libopenmpt +25 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mod/README.md +86 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mod/audio.d.ts +20 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mod/audio.js +12 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mod/decode-mod.d.ts +58 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mod/decode-mod.js +148 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mod/package.json +68 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mod/src/mod.wasm.js +0 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mp3/LICENSE +25 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mp3/README.md +20 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mp3/audio.d.ts +15 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mp3/audio.js +10 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mp3/decode-mp3.d.ts +16 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mp3/decode-mp3.js +793 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mp3/meta.js +143 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mp3/package.json +60 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mp4/LICENSE +21 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mp4/README.md +58 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mp4/audio.d.ts +15 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mp4/audio.js +9 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mp4/decode-mp4.d.ts +21 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mp4/decode-mp4.js +455 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mp4/package.json +74 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mpc/LICENSE +31 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mpc/LICENSE.libmpcdec +31 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mpc/README.md +60 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mpc/audio.d.ts +15 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mpc/audio.js +9 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mpc/decode-mpc.d.ts +20 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mpc/decode-mpc.js +158 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mpc/package.json +64 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-mpc/src/mpc.wasm.js +0 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-opus/LICENSE +25 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-opus/LICENSE.libopus +44 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-opus/README.md +32 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-opus/audio.d.ts +15 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-opus/audio.js +10 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-opus/core.d.ts +33 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-opus/core.js +147 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-opus/decode-opus.d.ts +18 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-opus/decode-opus.js +1 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-opus/meta.js +103 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-opus/package.json +68 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-opus/src/decode-opus.js +2 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-opus/src/opus.wasm.js +0 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-qoa/LICENSE +25 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-qoa/README.md +19 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-qoa/audio.d.ts +15 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-qoa/audio.js +10 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-qoa/decode-qoa.d.ts +16 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-qoa/decode-qoa.js +275 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-qoa/package.json +56 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-tta/LICENSE +21 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-tta/LICENSE.ttadec +39 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-tta/README.md +58 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-tta/audio.d.ts +15 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-tta/audio.js +9 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-tta/decode-tta.d.ts +17 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-tta/decode-tta.js +302 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-tta/package.json +58 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/LICENSE +25 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/README.md +33 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/audio.d.ts +15 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/audio.js +10 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/decode-vorbis.d.ts +18 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/decode-vorbis.js +2984 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/meta.js +102 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/package.json +60 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wav/LICENSE +21 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wav/README.md +23 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wav/audio.d.ts +15 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wav/audio.js +10 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wav/decode-wav.d.ts +8 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wav/decode-wav.js +256 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wav/meta.js +114 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wav/package.json +52 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/LICENSE +29 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/LICENSE.wavpack +25 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/README.md +41 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/audio.d.ts +15 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/audio.js +9 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/decode-wavpack.d.ts +18 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/decode-wavpack.js +140 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/package.json +62 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/src/wavpack.wasm.js +0 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-webm/LICENSE +21 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-webm/LICENSE.libopus +44 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-webm/README.md +59 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-webm/audio.d.ts +15 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-webm/audio.js +10 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-webm/decode-webm.d.ts +18 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-webm/decode-webm.js +141 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-webm/package.json +76 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-webm/src/opus.wasm.js +0 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wma/LICENSE +12 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wma/README.md +74 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wma/audio.d.ts +15 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wma/audio.js +10 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wma/decode-wma.d.ts +33 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wma/decode-wma.js +516 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wma/package.json +57 -0
- package/node_modules/audio-decode/node_modules/@audio/decode-wma/src/wma.wasm.js +0 -0
- package/node_modules/audio-decode/package.json +37 -39
- package/node_modules/audio-decode/stream.d.ts +2 -0
- package/node_modules/audio-decode/stream.js +2 -0
- package/node_modules/baileys/lib/Utils/messages-media.js +1 -1
- package/node_modules/baileys/node_modules/file-type/package.json +1 -1
- package/node_modules/baileys/node_modules/file-type/readme.md +2 -0
- package/node_modules/baileys/node_modules/file-type/source/detectors/zip.js +9 -4
- package/node_modules/baileys/package.json +1 -1
- package/node_modules/typebox/build/compile/code.mjs +1 -2
- package/node_modules/typebox/build/compile/validator.mjs +5 -1
- package/node_modules/typebox/build/format/iri.mjs +16 -9
- package/node_modules/typebox/build/guard/emit.mjs +2 -2
- package/node_modules/typebox/build/guard/guard.d.mts +7 -5
- package/node_modules/typebox/build/guard/guard.mjs +14 -9
- package/node_modules/typebox/build/guard/index.mjs +6 -0
- package/node_modules/typebox/build/guard/unicode/unicode.d.mts +6 -0
- package/node_modules/typebox/build/guard/unicode/unicode.mjs +35 -0
- package/node_modules/typebox/build/guard/{string.mjs → unicode/unicode_segment.mjs} +16 -19
- package/node_modules/typebox/build/schema/build.mjs +2 -3
- package/node_modules/typebox/build/schema/engine/_pathing.d.mts +1 -0
- package/node_modules/typebox/build/schema/engine/_pathing.mjs +11 -0
- package/node_modules/typebox/build/schema/engine/_refine.mjs +13 -5
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dependencies.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dependentSchemas.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/format.mjs +9 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/properties.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/ref.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/ref.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/schema.mjs +24 -24
- package/node_modules/typebox/build/schema/parse.mjs +3 -0
- package/node_modules/typebox/build/schema/pointer/pointer.d.mts +1 -6
- package/node_modules/typebox/build/schema/pointer/pointer.mjs +47 -64
- package/node_modules/typebox/build/system/settings/internal.d.mts +2 -0
- package/node_modules/typebox/build/system/settings/internal.mjs +20 -0
- package/node_modules/typebox/build/system/settings/settings.d.mts +11 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +14 -0
- package/node_modules/typebox/build/type/extends/inference.d.mts +1 -1
- package/node_modules/typebox/build/type/extends/inference.mjs +15 -2
- package/node_modules/typebox/build/type/extends/tuple.d.mts +2 -1
- package/node_modules/typebox/build/type/extends/tuple.mjs +21 -1
- package/node_modules/typebox/build/value/parse/parse.mjs +10 -4
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +3 -1
- package/package.json +6 -6
- package/dist/.setup/doctor-BPb-SjdE.mjs +0 -65
- package/dist/.setup/group-config-path-BGyzT9Lg.mjs +0 -54
- package/dist/.setup/normalize-DdsROMMa.mjs +0 -2
- package/dist/.setup/rolldown-runtime-D7D4PA-g.mjs +0 -13
- package/dist/.setup/runtime-group-policy-DeSRFXEV.mjs +0 -11
- package/dist/.setup/setup-plugin-api-2wUapweU.mjs +0 -3
- package/dist/.setup/text-runtime-CHl0iPYe.mjs +0 -4
- package/node_modules/audio-decode/.eslintrc.json +0 -43
- package/node_modules/audio-decode/.github/workflows/test.js.yml +0 -31
- package/node_modules/audio-decode/.travis.yml +0 -13
- package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/README.md +0 -293
- package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/dist/opus-ml-decoder.min.js +0 -11646
- package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/dist/opus-ml-decoder.min.js.map +0 -1
- package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/index.js +0 -8
- package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/package.json +0 -58
- package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/src/EmscriptenWasm.js +0 -0
- package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/src/OpusMLDecoder.js +0 -253
- package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/src/OpusMLDecoderWebWorker.js +0 -17
- package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/types.d.ts +0 -77
- package/node_modules/audio-decode/node_modules/audio-buffer/.eslintrc.json +0 -44
- package/node_modules/audio-decode/node_modules/audio-buffer/.github/workflows/node.js.yml +0 -31
- package/node_modules/audio-decode/node_modules/audio-buffer/.travis.yml +0 -7
- package/node_modules/audio-decode/node_modules/audio-buffer/index.js +0 -76
- package/node_modules/audio-decode/node_modules/audio-buffer/package.json +0 -37
- package/node_modules/audio-decode/node_modules/audio-buffer/readme.md +0 -56
- package/node_modules/audio-decode/node_modules/node-wav/README.md +0 -35
- package/node_modules/audio-decode/node_modules/node-wav/file.wav +0 -0
- package/node_modules/audio-decode/node_modules/node-wav/index.js +0 -291
- package/node_modules/audio-decode/node_modules/node-wav/package.json +0 -29
- package/node_modules/audio-decode/node_modules/node-wav/tests/file1.wav +0 -0
- package/node_modules/audio-decode/node_modules/node-wav/tests/test.js +0 -66
- package/node_modules/audio-decode/node_modules/node-wav/x.js +0 -12
- package/node_modules/audio-decode/node_modules/node-wav/x.json +0 -86702
- package/node_modules/audio-decode/node_modules/node-wav/x.js~ +0 -13
- package/node_modules/audio-decode/node_modules/ogg-opus-decoder/README.md +0 -320
- package/node_modules/audio-decode/node_modules/ogg-opus-decoder/dist/ogg-opus-decoder.min.js +0 -232
- package/node_modules/audio-decode/node_modules/ogg-opus-decoder/dist/ogg-opus-decoder.min.js.map +0 -1
- package/node_modules/audio-decode/node_modules/ogg-opus-decoder/dist/ogg-opus-decoder.opus-ml.min.js +0 -0
- package/node_modules/audio-decode/node_modules/ogg-opus-decoder/dist/ogg-opus-decoder.opus-ml.min.js.map +0 -1
- package/node_modules/audio-decode/node_modules/ogg-opus-decoder/index.js +0 -8
- package/node_modules/audio-decode/node_modules/ogg-opus-decoder/package.json +0 -74
- package/node_modules/audio-decode/node_modules/ogg-opus-decoder/src/OggOpusDecoder.js +0 -226
- package/node_modules/audio-decode/node_modules/ogg-opus-decoder/src/OggOpusDecoderWebWorker.js +0 -17
- package/node_modules/audio-decode/node_modules/ogg-opus-decoder/types.d.ts +0 -37
- package/node_modules/audio-decode/node_modules/opus-decoder/README.md +0 -265
- package/node_modules/audio-decode/node_modules/opus-decoder/dist/opus-decoder.min.js +0 -232
- package/node_modules/audio-decode/node_modules/opus-decoder/dist/opus-decoder.min.js.map +0 -1
- package/node_modules/audio-decode/node_modules/opus-decoder/index.js +0 -8
- package/node_modules/audio-decode/node_modules/opus-decoder/package.json +0 -56
- package/node_modules/audio-decode/node_modules/opus-decoder/src/EmscriptenWasm.js +0 -0
- package/node_modules/audio-decode/node_modules/opus-decoder/src/OpusDecoder.js +0 -239
- package/node_modules/audio-decode/node_modules/opus-decoder/src/OpusDecoderWebWorker.js +0 -17
- package/node_modules/audio-decode/node_modules/opus-decoder/types.d.ts +0 -74
- package/node_modules/audio-decode/readme.md +0 -49
- 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.html +0 -15
- package/node_modules/audio-decode/test.js +0 -107
- /package/node_modules/typebox/build/guard/{string.d.mts → unicode/unicode_segment.d.mts} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface AudioData {
|
|
2
|
+
channelData: Float32Array[];
|
|
3
|
+
sampleRate: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
interface MpcDecoder {
|
|
7
|
+
/** Decode a chunk of an SV7 (`MP+`) or SV8 (`MPCK`) Musepack stream synchronously. Returns whatever full frames the data seen so far allows; call again as more bytes arrive. */
|
|
8
|
+
decode(data: Uint8Array | ArrayBuffer): AudioData;
|
|
9
|
+
/** Signal end of stream: decode any frames a safety margin was withholding. */
|
|
10
|
+
flush(): AudioData;
|
|
11
|
+
free(): void;
|
|
12
|
+
/** Frames that failed to decode (bitstream desync — stops the decoder) */
|
|
13
|
+
errors: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Decode a complete Musepack (SV7 or SV8) stream. Throws if the stream never parses as Musepack. */
|
|
17
|
+
export default function decode(src: ArrayBuffer | Uint8Array): Promise<AudioData>;
|
|
18
|
+
|
|
19
|
+
/** Initialize WASM and create a decoder with synchronous methods. */
|
|
20
|
+
export function decoder(): Promise<MpcDecoder>;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Musepack (MPC) decoder — libmpcdec compiled to WASM (single-file ES module, host-neutral).
|
|
3
|
+
* Decodes SV7 (`MP+`) and SV8 (`MPCK`) streams, container demuxing included (APEv2/ID3v1
|
|
4
|
+
* tags and seek tables are parsed and skipped; not surfaced).
|
|
5
|
+
*
|
|
6
|
+
* let { channelData, sampleRate } = await decode(mpcBytes)
|
|
7
|
+
*
|
|
8
|
+
* let dec = await decoder()
|
|
9
|
+
* let head = dec.decode(chunk1) // synchronous; returns audio decoded from data seen so far
|
|
10
|
+
* let tail = dec.flush()
|
|
11
|
+
* dec.free()
|
|
12
|
+
*
|
|
13
|
+
* Streaming: SV7 needs only its ~30-byte fixed header before frames start decoding as bytes
|
|
14
|
+
* arrive. SV8 keeps its seek table near the end of the stream (mpcenc can only patch the
|
|
15
|
+
* header's pointer to it after encoding, once the final offset is known) and libmpcdec reads
|
|
16
|
+
* that table during mpc_demux_init() — so an SV8 decoder only starts producing samples once
|
|
17
|
+
* (near) the whole stream has been fed. Either way decode(chunk) never blocks: it returns
|
|
18
|
+
* whatever it can given the bytes seen so far and picks up where it left off on the next call.
|
|
19
|
+
*/
|
|
20
|
+
import createMpc from './src/mpc.wasm.js'
|
|
21
|
+
|
|
22
|
+
const EMPTY = Object.freeze({ channelData: [], sampleRate: 0 })
|
|
23
|
+
// libmpcdec/internal.h MAX_FRAME_SIZE: worst-case compressed frame size. mpc_demux_decode()
|
|
24
|
+
// has no way to signal "not enough data yet" separately from "end of stream", and a failed
|
|
25
|
+
// frame decode leaves the demuxer's bit position permanently desynced (no retry). Keeping
|
|
26
|
+
// this many bytes buffered ahead of the reader's cursor before decoding a frame guarantees
|
|
27
|
+
// the reader is never asked for a short read except at genuine end of stream.
|
|
28
|
+
const SAFE_MARGIN = 4352
|
|
29
|
+
|
|
30
|
+
let modP
|
|
31
|
+
function getMod() {
|
|
32
|
+
if (modP) return modP
|
|
33
|
+
let p = createMpc()
|
|
34
|
+
modP = p
|
|
35
|
+
return p.catch(e => { modP = null; throw e })
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Whole-file decode
|
|
40
|
+
* @param {Uint8Array|ArrayBuffer} src
|
|
41
|
+
* @returns {Promise<{channelData: Float32Array[], sampleRate: number}>}
|
|
42
|
+
*/
|
|
43
|
+
export default async function decode(src) {
|
|
44
|
+
let buf = src instanceof Uint8Array ? src : new Uint8Array(src)
|
|
45
|
+
if (!buf.length) return EMPTY
|
|
46
|
+
let dec = await decoder()
|
|
47
|
+
try {
|
|
48
|
+
let head = dec.decode(buf)
|
|
49
|
+
let tail = dec.flush()
|
|
50
|
+
if (!dec.inited) throw Error('Not a valid Musepack (MPC) stream')
|
|
51
|
+
return merge(head, tail)
|
|
52
|
+
} finally { dec.free() }
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Create streaming decoder instance — decode() and flush() are synchronous. */
|
|
56
|
+
export async function decoder() {
|
|
57
|
+
return new MpcDecoder(await getMod())
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
class MpcDecoder {
|
|
61
|
+
constructor(m) {
|
|
62
|
+
this.m = m
|
|
63
|
+
this.h = m._audio_mpc_create()
|
|
64
|
+
if (!this.h) throw Error('MPC decoder allocation failed')
|
|
65
|
+
this.inited = false
|
|
66
|
+
this.failed = false
|
|
67
|
+
this.done = false
|
|
68
|
+
this.channels = 0
|
|
69
|
+
this.sampleRate = 0
|
|
70
|
+
this.errors = 0
|
|
71
|
+
this.ptr = 0; this.cap = 0
|
|
72
|
+
this.freed = false
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
decode(data) {
|
|
76
|
+
if (this.freed) throw Error('Decoder already freed')
|
|
77
|
+
if (this.failed) throw Error('Not a valid Musepack (MPC) stream')
|
|
78
|
+
if (!data || !data.byteLength) return EMPTY
|
|
79
|
+
let buf = data instanceof Uint8Array ? data : new Uint8Array(data)
|
|
80
|
+
let m = this.m
|
|
81
|
+
let ptr = this.alloc(buf.length)
|
|
82
|
+
m.HEAPU8.set(buf, ptr)
|
|
83
|
+
if (m._audio_mpc_feed(this.h, ptr, buf.length) < 0) throw Error('MPC: out of WASM memory')
|
|
84
|
+
|
|
85
|
+
if (!this.inited) {
|
|
86
|
+
let r = m._audio_mpc_init(this.h)
|
|
87
|
+
if (r < 0) { this.failed = true; throw Error('Not a valid Musepack (MPC) stream') }
|
|
88
|
+
if (r === 0) return EMPTY // header incomplete — retry once more bytes arrive
|
|
89
|
+
this.inited = true
|
|
90
|
+
this.channels = m._audio_mpc_channels(this.h)
|
|
91
|
+
this.sampleRate = m._audio_mpc_sample_rate(this.h)
|
|
92
|
+
}
|
|
93
|
+
return this.drain(false)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Drop the streaming state (see class doc); at real end of stream this decodes any frames the safety margin was withholding. */
|
|
97
|
+
flush() {
|
|
98
|
+
if (this.freed) throw Error('Decoder already freed')
|
|
99
|
+
if (this.failed) throw Error('Not a valid Musepack (MPC) stream')
|
|
100
|
+
if (!this.inited) {
|
|
101
|
+
let r = this.m._audio_mpc_init(this.h) // one last attempt now that no more data is coming
|
|
102
|
+
if (r < 0) { this.failed = true; throw Error('Not a valid Musepack (MPC) stream') }
|
|
103
|
+
if (r === 0) return EMPTY // stream ended before a header could be parsed
|
|
104
|
+
this.inited = true
|
|
105
|
+
this.channels = this.m._audio_mpc_channels(this.h)
|
|
106
|
+
this.sampleRate = this.m._audio_mpc_sample_rate(this.h)
|
|
107
|
+
}
|
|
108
|
+
return this.drain(true)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
drain(final) {
|
|
112
|
+
if (this.done) return EMPTY
|
|
113
|
+
let m = this.m, parts = [], ch = this.channels
|
|
114
|
+
for (; ;) {
|
|
115
|
+
if (!final && m._audio_mpc_avail(this.h) < SAFE_MARGIN) break
|
|
116
|
+
let n = m._audio_mpc_decode(this.h)
|
|
117
|
+
if (n <= 0) { this.done = true; if (n < 0) this.errors++; break }
|
|
118
|
+
let out = m._audio_mpc_output(this.h) >> 2
|
|
119
|
+
parts.push(Array.from({ length: ch }, (_, c) => {
|
|
120
|
+
let a = new Float32Array(n)
|
|
121
|
+
for (let i = 0; i < n; i++) a[i] = m.HEAPF32[out + i * ch + c]
|
|
122
|
+
return a
|
|
123
|
+
}))
|
|
124
|
+
}
|
|
125
|
+
if (!parts.length) return EMPTY
|
|
126
|
+
let total = parts.reduce((s, p) => s + p[0].length, 0)
|
|
127
|
+
let channelData = Array.from({ length: ch }, (_, c) => {
|
|
128
|
+
let o = new Float32Array(total), off = 0
|
|
129
|
+
for (let p of parts) { o.set(p[c], off); off += p[c].length }
|
|
130
|
+
return o
|
|
131
|
+
})
|
|
132
|
+
return { channelData, sampleRate: this.sampleRate }
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
free() {
|
|
136
|
+
if (this.freed) return
|
|
137
|
+
this.freed = true
|
|
138
|
+
this.m._audio_mpc_destroy(this.h); this.h = 0
|
|
139
|
+
if (this.ptr) this.m._free(this.ptr)
|
|
140
|
+
this.ptr = 0; this.cap = 0
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
alloc(len) {
|
|
144
|
+
if (len > this.cap) {
|
|
145
|
+
if (this.ptr) this.m._free(this.ptr)
|
|
146
|
+
this.cap = len
|
|
147
|
+
this.ptr = this.m._malloc(len)
|
|
148
|
+
if (!this.ptr) throw Error('MPC: out of WASM memory')
|
|
149
|
+
}
|
|
150
|
+
return this.ptr
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function merge(a, b) {
|
|
155
|
+
if (!b?.channelData?.length) return a
|
|
156
|
+
if (!a?.channelData?.length) return b
|
|
157
|
+
return { channelData: a.channelData.map((ch, i) => { let m = new Float32Array(ch.length + b.channelData[i].length); m.set(ch); m.set(b.channelData[i], ch.length); return m }), sampleRate: a.sampleRate }
|
|
158
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@audio/decode-mpc",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Decode Musepack (MPC, SV7 and SV8) audio with libmpcdec WASM",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "decode-mpc.js",
|
|
7
|
+
"types": "decode-mpc.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./decode-mpc.js",
|
|
10
|
+
"./audio": {
|
|
11
|
+
"types": "./audio.d.ts",
|
|
12
|
+
"default": "./audio.js"
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "bash build.sh",
|
|
21
|
+
"prepack": "npm run build",
|
|
22
|
+
"test": "node test.js"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"decode-mpc.js",
|
|
26
|
+
"decode-mpc.d.ts",
|
|
27
|
+
"src/mpc.wasm.js",
|
|
28
|
+
"audio.js",
|
|
29
|
+
"audio.d.ts",
|
|
30
|
+
"LICENSE",
|
|
31
|
+
"LICENSE.libmpcdec"
|
|
32
|
+
],
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"tst": "^9.2.2"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=18"
|
|
38
|
+
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"mpc",
|
|
41
|
+
"musepack",
|
|
42
|
+
"mp+",
|
|
43
|
+
"mpck",
|
|
44
|
+
"sv7",
|
|
45
|
+
"sv8",
|
|
46
|
+
"audio",
|
|
47
|
+
"decode",
|
|
48
|
+
"decoder",
|
|
49
|
+
"wasm",
|
|
50
|
+
"libmpcdec"
|
|
51
|
+
],
|
|
52
|
+
"license": "BSD-3-Clause",
|
|
53
|
+
"author": "audiojs",
|
|
54
|
+
"homepage": "https://github.com/audiojs/decode/tree/main/packages/decode-mpc",
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "git+https://github.com/audiojs/decode.git",
|
|
58
|
+
"directory": "packages/decode-mpc"
|
|
59
|
+
},
|
|
60
|
+
"bugs": "https://github.com/audiojs/decode/issues",
|
|
61
|
+
"audio": "./audio.js",
|
|
62
|
+
"sideEffects": false,
|
|
63
|
+
"funding": "https://github.com/sponsors/audiojs"
|
|
64
|
+
}
|
|
@@ -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,44 @@
|
|
|
1
|
+
Copyright 2001-2023 Xiph.Org, Skype Limited, Octasic,
|
|
2
|
+
Jean-Marc Valin, Timothy B. Terriberry,
|
|
3
|
+
CSIRO, Gregory Maxwell, Mark Borgerding,
|
|
4
|
+
Erik de Castro Lopo, Mozilla, Amazon
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions
|
|
8
|
+
are met:
|
|
9
|
+
|
|
10
|
+
- Redistributions of source code must retain the above copyright
|
|
11
|
+
notice, this list of conditions and the following disclaimer.
|
|
12
|
+
|
|
13
|
+
- Redistributions in binary form must reproduce the above copyright
|
|
14
|
+
notice, this list of conditions and the following disclaimer in the
|
|
15
|
+
documentation and/or other materials provided with the distribution.
|
|
16
|
+
|
|
17
|
+
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
|
18
|
+
names of specific contributors, may be used to endorse or promote
|
|
19
|
+
products derived from this software without specific prior written
|
|
20
|
+
permission.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
23
|
+
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
25
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
|
26
|
+
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
27
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
28
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
29
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
30
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
31
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
32
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
33
|
+
|
|
34
|
+
Opus is subject to the royalty-free patent licenses which are
|
|
35
|
+
specified at:
|
|
36
|
+
|
|
37
|
+
Xiph.Org Foundation:
|
|
38
|
+
https://datatracker.ietf.org/ipr/1524/
|
|
39
|
+
|
|
40
|
+
Microsoft Corporation:
|
|
41
|
+
https://datatracker.ietf.org/ipr/1914/
|
|
42
|
+
|
|
43
|
+
Broadcom Corporation:
|
|
44
|
+
https://datatracker.ietf.org/ipr/1526/
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @audio/decode-opus
|
|
2
|
+
|
|
3
|
+
Decode Ogg Opus audio to PCM samples with libopus WASM.
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
import decode, { decoder } from '@audio/decode-opus'
|
|
7
|
+
|
|
8
|
+
let { channelData, sampleRate } = await decode(opusBytes)
|
|
9
|
+
|
|
10
|
+
let dec = await decoder() // initialize WASM
|
|
11
|
+
let a = dec.decode(chunk1)
|
|
12
|
+
let b = dec.decode(chunk2)
|
|
13
|
+
let tail = dec.flush()
|
|
14
|
+
dec.free()
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`decoder()` is asynchronous. Its `decode()` and `flush()` methods are synchronous. `flush()` ends the stream.
|
|
18
|
+
|
|
19
|
+
## Metadata
|
|
20
|
+
|
|
21
|
+
Read OpusTags metadata and cover art without decoding audio:
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
import { parseMeta } from '@audio/decode-opus/meta'
|
|
25
|
+
|
|
26
|
+
let { meta, sampleRate } = parseMeta(opusBytes)
|
|
27
|
+
// meta: { title, artist, album, year, genre, ..., pictures }
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## License
|
|
31
|
+
|
|
32
|
+
[ॐ](https://github.com/krishnized/license/) · [MIT](./LICENSE). Bundled [libopus](https://opus-codec.org/) is [BSD 3-Clause](./LICENSE.libopus).
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Generated from the audio.js manifest (params metadata is the source of truth).
|
|
2
|
+
// Regenerate: node tools/dts.js in @audio/compile. Do not edit by hand.
|
|
3
|
+
|
|
4
|
+
/** Automatable number — scalar, `t => value` fn, or breakpoint curve {t, v} */
|
|
5
|
+
type Auto = number | ((t: number) => number) | { t: number[], v: number[] }
|
|
6
|
+
/** Per-block param values as delivered by hosts (numbers arrive as 1-length Float32Array) */
|
|
7
|
+
type Live = Record<string, Float32Array | string | boolean>
|
|
8
|
+
type Ctx = { sampleRate: number, maxBlockSize: number, maxChannels: number, currentTime: number, duration?: number, events?: readonly any[], emit?: (name: string, ...args: any[]) => void, [k: string]: unknown }
|
|
9
|
+
type Process = (inputs: Float32Array[][], outputs: Float32Array[][], params: Live) => void
|
|
10
|
+
|
|
11
|
+
/** Codec plugin 'opus' — extends audio()'s openable formats / save() targets */
|
|
12
|
+
export declare const opus: {
|
|
13
|
+
codec: 'opus'
|
|
14
|
+
decode(bytes: Uint8Array): { channelData: Float32Array[], sampleRate: number } | Promise<{ channelData: Float32Array[], sampleRate: number }>
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// audio.js manifest — codec atom, decode half: whole-buffer bytes → { channelData,
|
|
2
|
+
// sampleRate }. Hosts merge with the encode half (@audio/encode-opus) by format
|
|
3
|
+
// name. Format detection is magic-byte (audio-type) — no test() needed here.
|
|
4
|
+
|
|
5
|
+
import decodeFn from './decode-opus.js'
|
|
6
|
+
|
|
7
|
+
export const opus = {
|
|
8
|
+
codec: 'opus',
|
|
9
|
+
decode: (bytes) => decodeFn(bytes),
|
|
10
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface OpusOptions {
|
|
2
|
+
sampleRate?: 8000 | 12000 | 16000 | 24000 | 48000;
|
|
3
|
+
channels: number;
|
|
4
|
+
streamCount?: number;
|
|
5
|
+
coupledStreamCount?: number;
|
|
6
|
+
channelMappingTable?: number[] | Uint8Array;
|
|
7
|
+
preSkip?: number;
|
|
8
|
+
outputGain?: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface DecodedOpus {
|
|
12
|
+
errors: Array<{
|
|
13
|
+
message: string;
|
|
14
|
+
frameLength: number;
|
|
15
|
+
frameNumber: number;
|
|
16
|
+
inputBytes: number;
|
|
17
|
+
outputSamples: number;
|
|
18
|
+
}>;
|
|
19
|
+
channelData: Float32Array[];
|
|
20
|
+
samplesDecoded: number;
|
|
21
|
+
sampleRate: number;
|
|
22
|
+
bitDepth: 32;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface OpusPacketDecoder {
|
|
26
|
+
configure(options: OpusOptions): void;
|
|
27
|
+
decodeFrames(frames: Uint8Array[]): DecodedOpus;
|
|
28
|
+
unconfigure(): void;
|
|
29
|
+
free(): void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Initialize libopus WASM without configuring a stream. */
|
|
33
|
+
export function createOpusDecoder(): Promise<OpusPacketDecoder>;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import createOpus from './src/opus.wasm.js'
|
|
2
|
+
|
|
3
|
+
const ERRORS = new Map([
|
|
4
|
+
[-1, 'OPUS_BAD_ARG'],
|
|
5
|
+
[-2, 'OPUS_BUFFER_TOO_SMALL'],
|
|
6
|
+
[-3, 'OPUS_INTERNAL_ERROR'],
|
|
7
|
+
[-4, 'OPUS_INVALID_PACKET'],
|
|
8
|
+
[-5, 'OPUS_UNIMPLEMENTED'],
|
|
9
|
+
[-6, 'OPUS_INVALID_STATE'],
|
|
10
|
+
[-7, 'OPUS_ALLOC_FAIL']
|
|
11
|
+
])
|
|
12
|
+
|
|
13
|
+
let modulePromise
|
|
14
|
+
|
|
15
|
+
async function getModule() {
|
|
16
|
+
if (modulePromise) return modulePromise
|
|
17
|
+
let promise = createOpus()
|
|
18
|
+
modulePromise = promise
|
|
19
|
+
try { return await promise }
|
|
20
|
+
catch (error) { modulePromise = null; throw error }
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export async function createOpusDecoder() {
|
|
24
|
+
return new OpusDecoder(await getModule())
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
class OpusDecoder {
|
|
28
|
+
constructor(module) {
|
|
29
|
+
this.module = module
|
|
30
|
+
this.handle = 0
|
|
31
|
+
this.input = 0
|
|
32
|
+
this.capacity = 0
|
|
33
|
+
this.channels = 0
|
|
34
|
+
this.sampleRate = 0
|
|
35
|
+
this.frameNumber = 0
|
|
36
|
+
this.inputBytes = 0
|
|
37
|
+
this.outputSamples = 0
|
|
38
|
+
this.freed = false
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
configure(options) {
|
|
42
|
+
if (this.freed) throw Error('Decoder already freed')
|
|
43
|
+
let sampleRate = options.sampleRate ?? 48000
|
|
44
|
+
let channels = options.channels
|
|
45
|
+
if (![8000, 12000, 16000, 24000, 48000].includes(sampleRate)) throw RangeError('Invalid Opus sample rate')
|
|
46
|
+
if (!Number.isInteger(channels) || channels < 1 || channels > 255) throw RangeError('Invalid Opus channel count')
|
|
47
|
+
|
|
48
|
+
let streams = options.streamCount ?? 1
|
|
49
|
+
let coupled = options.coupledStreamCount ?? (channels === 2 ? 1 : 0)
|
|
50
|
+
if (!Number.isInteger(streams) || streams < 1 || streams > 255 ||
|
|
51
|
+
!Number.isInteger(coupled) || coupled < 0 || coupled > streams || streams + coupled > 255)
|
|
52
|
+
throw RangeError('Invalid Opus stream layout')
|
|
53
|
+
|
|
54
|
+
let mapping = options.channelMappingTable ?? (channels === 1 ? [0] : channels === 2 ? [0, 1] : null)
|
|
55
|
+
if (!mapping || mapping.length !== channels) throw Error('Invalid Opus channel mapping')
|
|
56
|
+
mapping = Array.from(mapping)
|
|
57
|
+
let codedChannels = streams + coupled
|
|
58
|
+
if (mapping.some(value => !Number.isInteger(value) || value < 0 || value > 255 || (value >= codedChannels && value !== 255)))
|
|
59
|
+
throw Error('Invalid Opus channel mapping')
|
|
60
|
+
|
|
61
|
+
let preSkip = options.preSkip ?? 0
|
|
62
|
+
let outputGain = options.outputGain ?? 0
|
|
63
|
+
if (!Number.isSafeInteger(preSkip) || preSkip < 0 || preSkip > 0x7fffffff) throw RangeError('Invalid Opus pre-skip')
|
|
64
|
+
if (!Number.isInteger(outputGain) || outputGain < -32768 || outputGain > 32767) throw RangeError('Invalid Opus output gain')
|
|
65
|
+
|
|
66
|
+
this.unconfigure()
|
|
67
|
+
let map = this.module._malloc(channels)
|
|
68
|
+
if (!map) throw Error('Unable to allocate Opus channel mapping')
|
|
69
|
+
try {
|
|
70
|
+
this.module.HEAPU8.set(mapping, map)
|
|
71
|
+
this.handle = this.module._audio_opus_create(sampleRate, channels, streams, coupled, map, preSkip, outputGain)
|
|
72
|
+
} finally { this.module._free(map) }
|
|
73
|
+
if (!this.handle) {
|
|
74
|
+
let code = this.module._audio_opus_last_error()
|
|
75
|
+
throw Error('libopus ' + code + ' ' + (ERRORS.get(code) || 'UNKNOWN_ERROR'))
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
this.channels = channels
|
|
79
|
+
this.sampleRate = sampleRate
|
|
80
|
+
this.frameNumber = 0
|
|
81
|
+
this.inputBytes = 0
|
|
82
|
+
this.outputSamples = 0
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
decodeFrames(frames) {
|
|
86
|
+
if (this.freed) throw Error('Decoder already freed')
|
|
87
|
+
if (!this.handle) throw Error('Opus decoder is not configured')
|
|
88
|
+
let chunks = [], errors = [], samplesDecoded = 0
|
|
89
|
+
|
|
90
|
+
for (let packet of frames) {
|
|
91
|
+
if (!(packet instanceof Uint8Array)) throw TypeError('Opus packet must be a Uint8Array')
|
|
92
|
+
if (packet.length > this.capacity) {
|
|
93
|
+
let input = this.module._malloc(packet.length)
|
|
94
|
+
if (!input) throw Error('Unable to allocate Opus input buffer')
|
|
95
|
+
if (this.input) this.module._free(this.input)
|
|
96
|
+
this.input = input
|
|
97
|
+
this.capacity = packet.length
|
|
98
|
+
}
|
|
99
|
+
if (packet.length) this.module.HEAPU8.set(packet, this.input)
|
|
100
|
+
|
|
101
|
+
let decoded = this.module._audio_opus_decode(this.handle, this.input, packet.length)
|
|
102
|
+
if (decoded < 0) {
|
|
103
|
+
errors.push({
|
|
104
|
+
message: 'libopus ' + decoded + ' ' + (ERRORS.get(decoded) || 'UNKNOWN_ERROR'),
|
|
105
|
+
frameLength: packet.length,
|
|
106
|
+
frameNumber: this.frameNumber,
|
|
107
|
+
inputBytes: this.inputBytes,
|
|
108
|
+
outputSamples: this.outputSamples
|
|
109
|
+
})
|
|
110
|
+
} else if (decoded) {
|
|
111
|
+
let offset = this.module._audio_opus_output(this.handle) >> 2
|
|
112
|
+
chunks.push(Array.from({ length: this.channels }, (_, channel) =>
|
|
113
|
+
this.module.HEAPF32.slice(offset + channel * decoded, offset + (channel + 1) * decoded)
|
|
114
|
+
))
|
|
115
|
+
samplesDecoded += decoded
|
|
116
|
+
this.outputSamples += decoded
|
|
117
|
+
}
|
|
118
|
+
this.frameNumber++
|
|
119
|
+
this.inputBytes += packet.length
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
let channelData = samplesDecoded ? Array.from({ length: this.channels }, (_, channel) => {
|
|
123
|
+
let output = new Float32Array(samplesDecoded), offset = 0
|
|
124
|
+
for (let chunk of chunks) { output.set(chunk[channel], offset); offset += chunk[channel].length }
|
|
125
|
+
return output
|
|
126
|
+
}) : []
|
|
127
|
+
|
|
128
|
+
return { errors, channelData, samplesDecoded, sampleRate: this.sampleRate, bitDepth: 32 }
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
unconfigure() {
|
|
132
|
+
if (!this.handle) return
|
|
133
|
+
this.module._audio_opus_destroy(this.handle)
|
|
134
|
+
this.handle = 0
|
|
135
|
+
this.channels = 0
|
|
136
|
+
this.sampleRate = 0
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
free() {
|
|
140
|
+
if (this.freed) return
|
|
141
|
+
this.unconfigure()
|
|
142
|
+
if (this.input) this.module._free(this.input)
|
|
143
|
+
this.input = 0
|
|
144
|
+
this.capacity = 0
|
|
145
|
+
this.freed = true
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface AudioData {
|
|
2
|
+
channelData: Float32Array[];
|
|
3
|
+
sampleRate: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
interface OpusDecoder {
|
|
7
|
+
/** Decode an Ogg Opus chunk synchronously. */
|
|
8
|
+
decode(data: Uint8Array | ArrayBuffer): AudioData;
|
|
9
|
+
/** Finish the stream synchronously. */
|
|
10
|
+
flush(): AudioData;
|
|
11
|
+
free(): void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Decode a complete Ogg Opus file. */
|
|
15
|
+
export default function decode(src: ArrayBuffer | Uint8Array): Promise<AudioData>;
|
|
16
|
+
|
|
17
|
+
/** Initialize WASM and return a decoder with synchronous methods. */
|
|
18
|
+
export function decoder(): Promise<OpusDecoder>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, decoder } from './src/decode-opus.js'
|