@openclaw/whatsapp 2026.9.5 → 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/{agent-tools-login-B6MAs75N.mjs → agent-tools-login-CL5C1rA2.mjs} +5 -1
- 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-CSclZYjU.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-ddGY37w8.mjs → channel.runtime-C94goLw9.mjs} +4 -4
- package/dist/.setup/{channel.setup-CqUl8COe.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-BblvzLpX.mjs → monitor-CGpV2VNN.mjs} +391 -509
- 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-BYEgU0hb.mjs → setup-finalize-DmPX4EaW.mjs} +32 -70
- package/dist/.setup/setup-plugin-api-vJlxKzca.mjs +3 -0
- package/dist/.setup/{setup-surface-Cd3wN5HD.mjs → setup-surface-43fj197P.mjs} +3 -3
- package/dist/.setup/{shared-C9OEtKgc.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 +6 -13
- 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 +3 -3
- package/dist/login-qr-runtime.js +1 -1
- package/dist/runtime-api.js +10 -10
- 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 +3 -2
- package/node_modules/baileys/node_modules/file-type/readme.md +5 -0
- package/node_modules/baileys/node_modules/file-type/source/detectors/zip.js +9 -4
- package/node_modules/baileys/node_modules/file-type/source/index.js +28 -1
- package/node_modules/baileys/node_modules/file-type/source/supported.js +2 -0
- package/node_modules/baileys/node_modules/p-timeout/index.js +3 -0
- package/node_modules/baileys/node_modules/p-timeout/package.json +1 -1
- 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-CXfU-7vN.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,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 audiojs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
decode-tta.js is an original JavaScript implementation (MIT, see LICENSE), written from the
|
|
2
|
+
TTA1 format and algorithm as described by the following BSD-licensed reference sources:
|
|
3
|
+
|
|
4
|
+
ttadec.c, filter.h, ttadec.h, ttalib.h — TTAv1 decoder library
|
|
5
|
+
Developed by: Alexander Djourik <ald@true-audio.com>
|
|
6
|
+
Pavel Zhilin <pzh@true-audio.com>
|
|
7
|
+
Copyright (c) 2004 True Audio Software. All rights reserved.
|
|
8
|
+
(retrieved via the Rockbox project's libtta port, which preserves this license:
|
|
9
|
+
https://github.com/Rockbox/rockbox/tree/master/lib/rbcodec/codecs/libtta)
|
|
10
|
+
|
|
11
|
+
Redistribution and use in source and binary forms, with or without
|
|
12
|
+
modification, are permitted provided that the following conditions
|
|
13
|
+
are met:
|
|
14
|
+
|
|
15
|
+
1. Redistributions of source code must retain the above copyright
|
|
16
|
+
notice, this list of conditions and the following disclaimer.
|
|
17
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
18
|
+
notice, this list of conditions and the following disclaimer in the
|
|
19
|
+
documentation and/or other materials provided with the distribution.
|
|
20
|
+
3. Neither the name of the True Audio Software nor the names of its
|
|
21
|
+
contributors may be used to endorse or promote products derived
|
|
22
|
+
from this software without specific prior written permission.
|
|
23
|
+
|
|
24
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
25
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
26
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
27
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
28
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
29
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
30
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
31
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
32
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
33
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
34
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
35
|
+
|
|
36
|
+
The container/bitstream conventions actually emitted by `ffmpeg -c:a tta` were cross-checked
|
|
37
|
+
(read-only) against ffmpeg's libavcodec/tta.c, libavcodec/ttadata.c and libavformat/tta.c
|
|
38
|
+
(LGPL-2.1-or-later, Copyright (c) 2006 Alex Beregszaszi and FFmpeg contributors); no code from
|
|
39
|
+
those files is reproduced here.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# @audio/decode-tta [](https://www.npmjs.com/package/@audio/decode-tta) [](https://github.com/krishnized/license)
|
|
2
|
+
|
|
3
|
+
Decode TTA (True Audio) lossless audio to PCM samples, in pure JavaScript
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npm install @audio/decode-tta
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
import decode, { decoder } from '@audio/decode-tta'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
TTA1 is Alexander Djourik's lossless codec: per channel, an adaptive two-state Rice coder feeds an 8-tap sign-sign-LMS "hybrid" filter and a fixed first-order predictor; multichannel streams decorrelate the last channel against the rest with a cascading half-sum/difference. Written from the [TTA project](https://sourceforge.net/projects/tta/) and the BSD-licensed reference decoder — Djourik & Zhilin, True Audio Software (2004): `ttadec.c` / `filter.h` / `ttadec.h` / `ttalib.h`, via [Rockbox's libtta port](https://github.com/Rockbox/rockbox/tree/master/lib/rbcodec/codecs/libtta) which retains the original license — see [LICENSE.ttadec](./LICENSE.ttadec). Decodes exactly what `ffmpeg -c:a tta` writes: 8/16/24-bit PCM, mono through 16 channels.
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
let { channelData, sampleRate } = decode(ttaBytes)
|
|
17
|
+
|
|
18
|
+
let dec = decoder()
|
|
19
|
+
let head = dec.decode(chunk1) // synchronous; header/seek-table/frame boundaries carry over
|
|
20
|
+
let tail = dec.flush()
|
|
21
|
+
dec.free()
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## API
|
|
25
|
+
|
|
26
|
+
### `decode(src: Uint8Array | ArrayBuffer): AudioData`
|
|
27
|
+
|
|
28
|
+
Decode a complete stream.
|
|
29
|
+
|
|
30
|
+
### `decoder(): TTADecoder`
|
|
31
|
+
|
|
32
|
+
Synchronous streaming decoder. `decode(chunk)` returns the samples of every complete frame in the data so far — frame byte lengths are known from the seek table, so a chunk boundary anywhere (even mid-header) just carries over to the next call. `flush()` drops a trailing incomplete header/seek-table/frame. `free()` releases state and is idempotent. `errors` counts frames dropped for a CRC32 mismatch.
|
|
33
|
+
|
|
34
|
+
### `AudioData`
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
{ channelData: Float32Array[], sampleRate: number }
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## CRC32
|
|
41
|
+
|
|
42
|
+
TTA1 checksums the header, the seek table, and every frame independently. A header or seek-table mismatch throws — those describe the stream's shape and can't be decoded around. A frame mismatch is not fatal: since each frame resets its filter/predictor/Rice state from scratch, one bad frame can't corrupt its neighbors, so that frame's samples are dropped, `errors` increments, and decoding continues.
|
|
43
|
+
|
|
44
|
+
## Notes
|
|
45
|
+
|
|
46
|
+
- Only format 1 (plain PCM) is decoded; format 2 (password-encrypted TTA) throws.
|
|
47
|
+
- Channel order is kept exactly as encoded — TTA does not reorder channels the way AC-3/DTS do, so `channelData[i]` is stream channel `i`.
|
|
48
|
+
- A leading ID3v2 tag (some encoders other than ffmpeg prepend one) is detected and skipped before the `TTA1` signature; a trailing APEv2 tag is ignored.
|
|
49
|
+
- A truncated file loses its final incomplete frame silently, matching `flush()`'s "drop the partial" behavior in the other atoms in this umbrella.
|
|
50
|
+
- 60 s of 44.1 kHz stereo decodes in ~225 ms on a current laptop (~265× real-time).
|
|
51
|
+
|
|
52
|
+
**Use when:** opening `.tta` files, or decoding a TTA track pulled out of a container.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
Part of [@audio/decode](https://github.com/audiojs/decode) — the decode family umbrella.
|
|
57
|
+
|
|
58
|
+
MIT © [audiojs](https://github.com/audiojs), algorithm ported from the BSD-licensed TTA reference decoder — see [LICENSE.ttadec](./LICENSE.ttadec)
|
|
@@ -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 'tta' — extends audio()'s openable formats / save() targets */
|
|
12
|
+
export declare const tta: {
|
|
13
|
+
codec: 'tta'
|
|
14
|
+
decode(bytes: Uint8Array): { channelData: Float32Array[], sampleRate: number } | Promise<{ channelData: Float32Array[], sampleRate: number }>
|
|
15
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// audio.js manifest — codec atom, decode half: whole-buffer bytes → { channelData,
|
|
2
|
+
// sampleRate }. Format detection is magic-byte (audio-type) — no test() needed here.
|
|
3
|
+
|
|
4
|
+
import decodeFn from './decode-tta.js'
|
|
5
|
+
|
|
6
|
+
export const tta = {
|
|
7
|
+
codec: 'tta',
|
|
8
|
+
decode: (bytes) => decodeFn(bytes),
|
|
9
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Decoded PCM: planar channel data + rate. */
|
|
2
|
+
export interface AudioData { channelData: Float32Array[], sampleRate: number }
|
|
3
|
+
|
|
4
|
+
interface TTADecoder {
|
|
5
|
+
/** Decode a chunk synchronously. Header/seek-table/frame boundaries carry over across calls. */
|
|
6
|
+
decode(data: Uint8Array | ArrayBuffer): AudioData
|
|
7
|
+
/** Drop any trailing incomplete header/seek-table/frame bytes. */
|
|
8
|
+
flush(): AudioData
|
|
9
|
+
free(): void
|
|
10
|
+
/** Frames dropped so far for a CRC32 mismatch. */
|
|
11
|
+
readonly errors: number
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Decode a complete TTA (True Audio) stream synchronously. */
|
|
15
|
+
export default function decode(src: Uint8Array | ArrayBuffer): AudioData
|
|
16
|
+
/** Create a synchronous streaming decoder. */
|
|
17
|
+
export function decoder(): TTADecoder
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TTA (True Audio) decoder — pure JS / ESM.
|
|
3
|
+
*
|
|
4
|
+
* TTA1 container: 22-byte header (format, channels, bps, sample rate, sample count, CRC32),
|
|
5
|
+
* a seek table (per-frame byte length + CRC32), then CRC32-checked frames of
|
|
6
|
+
* floor(sampleRate*256/245) samples each. Per channel, per sample: two-state adaptive Rice
|
|
7
|
+
* coding (k0/k1 with sum/threshold adaptation) feeds an 8-tap sign-sign-LMS "hybrid" filter,
|
|
8
|
+
* then a fixed first-order predictor; the last channel is then decorrelated against the rest
|
|
9
|
+
* by a cascading half-sum/difference (mid/side style, generalized to N channels).
|
|
10
|
+
*
|
|
11
|
+
* Written from the TTA1 format and the BSD-licensed reference decoder — Alexander Djourik,
|
|
12
|
+
* Pavel Zhilin, True Audio Software (2004): ttadec.c / filter.h / ttadec.h / ttalib.h, via the
|
|
13
|
+
* Rockbox libtta port which retains the original license — see LICENSE.ttadec and README.
|
|
14
|
+
* Cross-checked (read-only, not copied) against ffmpeg's libavcodec/tta.c (LGPL) for the exact
|
|
15
|
+
* container/bitstream conventions ffmpeg's own `-c:a tta` encoder emits, since bit-exactness
|
|
16
|
+
* against ffmpeg's decode is this package's correctness bar.
|
|
17
|
+
*
|
|
18
|
+
* let { channelData, sampleRate } = decode(ttaBytes)
|
|
19
|
+
* let dec = decoder(); let r = dec.decode(chunk); dec.flush(); dec.free()
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const EMPTY = Object.freeze({ channelData: [], sampleRate: 0 })
|
|
23
|
+
|
|
24
|
+
// ---- CRC32 (IEEE 802.3 / zlib variant: poly 0xEDB88320, init/xorout 0xFFFFFFFF) ----
|
|
25
|
+
|
|
26
|
+
const CRC_TABLE = (() => {
|
|
27
|
+
let t = new Uint32Array(256)
|
|
28
|
+
for (let n = 0; n < 256; n++) {
|
|
29
|
+
let c = n
|
|
30
|
+
for (let k = 0; k < 8; k++) c = c & 1 ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)
|
|
31
|
+
t[n] = c >>> 0
|
|
32
|
+
}
|
|
33
|
+
return t
|
|
34
|
+
})()
|
|
35
|
+
|
|
36
|
+
function crc32(buf, start = 0, end = buf.length) {
|
|
37
|
+
let crc = 0xFFFFFFFF
|
|
38
|
+
for (let i = start; i < end; i++) crc = CRC_TABLE[(crc ^ buf[i]) & 0xFF] ^ (crc >>> 8)
|
|
39
|
+
return (crc ^ 0xFFFFFFFF) >>> 0
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ---- LSB-first bit reader (TTA packs bits into bytes starting from bit 0) ----
|
|
43
|
+
|
|
44
|
+
function makeBits(buf) {
|
|
45
|
+
let pos = 0, cache = 0, n = 0
|
|
46
|
+
function fill() { cache = (cache | (buf[pos++] << n)) >>> 0; n += 8 }
|
|
47
|
+
function bit() { if (!n) fill(); let b = cache & 1; cache >>>= 1; n--; return b }
|
|
48
|
+
function unary() { let c = 0; while (bit()) c++; return c }
|
|
49
|
+
function read(k) {
|
|
50
|
+
if (!k) return 0
|
|
51
|
+
while (n < k) fill()
|
|
52
|
+
let mask = k === 32 ? 0xFFFFFFFF : (1 << k) - 1
|
|
53
|
+
let v = (cache & mask) >>> 0
|
|
54
|
+
cache = (cache >>> k) >>> 0
|
|
55
|
+
n -= k
|
|
56
|
+
return v
|
|
57
|
+
}
|
|
58
|
+
return { unary, read }
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// ---- adaptive Rice code tables (ff_tta_shift_1 / ff_tta_shift_16 in the reference: powers
|
|
62
|
+
// of two 2^0..2^31, then a saturating tail so k can never index past the table) ----
|
|
63
|
+
|
|
64
|
+
const SHIFT1 = new Uint32Array(41)
|
|
65
|
+
for (let i = 0; i < 32; i++) SHIFT1[i] = (1 << i) >>> 0
|
|
66
|
+
for (let i = 32; i < 40; i++) SHIFT1[i] = 0x80000000
|
|
67
|
+
SHIFT1[40] = 0xFFFFFFFF
|
|
68
|
+
const SHIFT16 = SHIFT1.subarray(4)
|
|
69
|
+
|
|
70
|
+
// filter shift by byte size (1/2/3 = 8/16/24-bit): flt_set in the reference
|
|
71
|
+
const FILTER_SHIFT = [10, 9, 10]
|
|
72
|
+
|
|
73
|
+
function initChannel(shift) {
|
|
74
|
+
return {
|
|
75
|
+
qm: new Int32Array(8), dx: new Int32Array(8), dl: new Int32Array(8),
|
|
76
|
+
error: 0, shift, round: 1 << (shift - 1),
|
|
77
|
+
k0: 10, k1: 10, sum0: SHIFT16[10], sum1: SHIFT16[10],
|
|
78
|
+
predictor: 0,
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// 8-tap adaptive "hybrid" filter: sign-sign LMS on qm, driven by the sign of the previous
|
|
83
|
+
// prediction error; dl holds a running 2nd/3rd-order difference of past filtered samples.
|
|
84
|
+
function hybridFilter(ch, value) {
|
|
85
|
+
let { qm, dx, dl } = ch
|
|
86
|
+
if (ch.error < 0) for (let i = 0; i < 8; i++) qm[i] -= dx[i]
|
|
87
|
+
else if (ch.error > 0) for (let i = 0; i < 8; i++) qm[i] += dx[i]
|
|
88
|
+
|
|
89
|
+
let sum = ch.round
|
|
90
|
+
for (let i = 0; i < 8; i++) sum = (sum + Math.imul(dl[i], qm[i])) | 0
|
|
91
|
+
|
|
92
|
+
dx[0] = dx[1]; dx[1] = dx[2]; dx[2] = dx[3]; dx[3] = dx[4]
|
|
93
|
+
dl[0] = dl[1]; dl[1] = dl[2]; dl[2] = dl[3]; dl[3] = dl[4]
|
|
94
|
+
|
|
95
|
+
dx[4] = (dl[4] >> 30) | 1
|
|
96
|
+
dx[5] = ((dl[5] >> 30) | 2) & ~1
|
|
97
|
+
dx[6] = ((dl[6] >> 30) | 2) & ~1
|
|
98
|
+
dx[7] = ((dl[7] >> 30) | 4) & ~3
|
|
99
|
+
|
|
100
|
+
ch.error = value
|
|
101
|
+
value = (value + (sum >> ch.shift)) | 0
|
|
102
|
+
|
|
103
|
+
dl[4] = -dl[5]
|
|
104
|
+
dl[5] = -dl[6]
|
|
105
|
+
dl[6] = value - dl[7]
|
|
106
|
+
dl[7] = value
|
|
107
|
+
dl[5] += dl[6]
|
|
108
|
+
dl[4] += dl[5]
|
|
109
|
+
|
|
110
|
+
return value
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// one sample: adaptive-Rice decode -> sign unfold -> hybrid filter -> order-1 predictor
|
|
114
|
+
function decodeValue(br, ch, predShift) {
|
|
115
|
+
let unary = br.unary(), depth, k
|
|
116
|
+
if (unary === 0) { depth = 0; k = ch.k0 }
|
|
117
|
+
else { depth = 1; k = ch.k1; unary-- }
|
|
118
|
+
let value = k ? (unary << k) + br.read(k) : unary
|
|
119
|
+
|
|
120
|
+
if (depth === 1) {
|
|
121
|
+
ch.sum1 = (ch.sum1 + value - (ch.sum1 >>> 4)) >>> 0
|
|
122
|
+
if (ch.k1 > 0 && ch.sum1 < SHIFT16[ch.k1]) ch.k1--
|
|
123
|
+
else if (ch.sum1 > SHIFT16[ch.k1 + 1]) ch.k1++
|
|
124
|
+
value += SHIFT1[ch.k0]
|
|
125
|
+
}
|
|
126
|
+
ch.sum0 = (ch.sum0 + value - (ch.sum0 >>> 4)) >>> 0
|
|
127
|
+
if (ch.k0 > 0 && ch.sum0 < SHIFT16[ch.k0]) ch.k0--
|
|
128
|
+
else if (ch.sum0 > SHIFT16[ch.k0 + 1]) ch.k0++
|
|
129
|
+
|
|
130
|
+
value = (value & 1) ? (value + 1) >> 1 : -(value >> 1) // zigzag unfold
|
|
131
|
+
|
|
132
|
+
value = hybridFilter(ch, value)
|
|
133
|
+
|
|
134
|
+
let p = ch.predictor
|
|
135
|
+
value = (value + (((p << predShift) - p) >> predShift)) | 0
|
|
136
|
+
ch.predictor = value
|
|
137
|
+
|
|
138
|
+
return value
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function scale(v, byteSize) {
|
|
142
|
+
if (byteSize === 1) return v < 0 ? v / 128 : v / 127
|
|
143
|
+
if (byteSize === 2) return v < 0 ? v / 32768 : v / 32767
|
|
144
|
+
return v < 0 ? v / 8388608 : v / 8388607 // 24-bit
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// decode exactly one frame's payload (including its trailing 4-byte CRC32); null on CRC fail
|
|
148
|
+
function decodeFrame(bytes, hdr, nSamples) {
|
|
149
|
+
let n = bytes.length
|
|
150
|
+
if (n < 4 || crc32(bytes, 0, n - 4) !== readU32(bytes, n - 4)) return null
|
|
151
|
+
|
|
152
|
+
let { channels, byteSize, filterShift, predShift } = hdr
|
|
153
|
+
let chans = new Array(channels)
|
|
154
|
+
for (let c = 0; c < channels; c++) chans[c] = initChannel(filterShift)
|
|
155
|
+
|
|
156
|
+
let out = new Array(channels)
|
|
157
|
+
for (let c = 0; c < channels; c++) out[c] = new Float32Array(nSamples)
|
|
158
|
+
|
|
159
|
+
let br = makeBits(bytes), raw = new Int32Array(channels)
|
|
160
|
+
for (let s = 0; s < nSamples; s++) {
|
|
161
|
+
for (let c = 0; c < channels; c++) raw[c] = decodeValue(br, chans[c], predShift)
|
|
162
|
+
if (channels > 1) {
|
|
163
|
+
// decorrelate: last channel gets a half-sum with its neighbor, then a cascading
|
|
164
|
+
// difference chain runs the correction back down to channel 0 (mid/side, N-ary)
|
|
165
|
+
raw[channels - 1] = (raw[channels - 1] + ((raw[channels - 2] / 2) | 0)) | 0
|
|
166
|
+
for (let c = channels - 2; c >= 0; c--) raw[c] = (raw[c + 1] - raw[c]) | 0
|
|
167
|
+
}
|
|
168
|
+
for (let c = 0; c < channels; c++) out[c][s] = scale(raw[c], byteSize)
|
|
169
|
+
}
|
|
170
|
+
return out
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// ---- container: header, seek table, ID3v2 skip, CRC32 ----
|
|
174
|
+
|
|
175
|
+
function readU16(b, o) { return b[o] | (b[o + 1] << 8) }
|
|
176
|
+
function readU32(b, o) { return (b[o] | (b[o + 1] << 8) | (b[o + 2] << 16) | (b[o + 3] << 24)) >>> 0 }
|
|
177
|
+
|
|
178
|
+
// ID3v2 header: 'ID3' + version(2) + flags(1) + syncsafe size(4, 7 bits/byte); + 10 if a
|
|
179
|
+
// footer is flagged (bit 4 of the flags byte).
|
|
180
|
+
function id3v2Size(b) {
|
|
181
|
+
let size = ((b[6] & 0x7f) << 21) | ((b[7] & 0x7f) << 14) | ((b[8] & 0x7f) << 7) | (b[9] & 0x7f)
|
|
182
|
+
return 10 + size + ((b[5] & 0x10) ? 10 : 0)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function parseHeader(b, off) {
|
|
186
|
+
let format = readU16(b, off + 4)
|
|
187
|
+
let channels = readU16(b, off + 6)
|
|
188
|
+
let bitsPerSample = readU16(b, off + 8)
|
|
189
|
+
let sampleRate = readU32(b, off + 10)
|
|
190
|
+
let dataLength = readU32(b, off + 14)
|
|
191
|
+
let crc = readU32(b, off + 18)
|
|
192
|
+
if (crc32(b, off, off + 18) !== crc) throw Error('TTA: header CRC mismatch')
|
|
193
|
+
if (format !== 1) throw Error('TTA: unsupported format ' + format + ' (only PCM streams are decoded)')
|
|
194
|
+
if (!channels || channels > 16) throw Error('TTA: invalid channel count ' + channels)
|
|
195
|
+
let byteSize = Math.ceil(bitsPerSample / 8)
|
|
196
|
+
if (byteSize < 1 || byteSize > 3) throw Error('TTA: unsupported bit depth ' + bitsPerSample + ' (8/16/24-bit only)')
|
|
197
|
+
if (!(sampleRate > 0 && sampleRate <= 0x7FFFFF)) throw Error('TTA: invalid sample rate ' + sampleRate)
|
|
198
|
+
|
|
199
|
+
let frameLen = Math.floor(sampleRate * 256 / 245) // FRAME_TIME = 256/245 s, in samples
|
|
200
|
+
let totalFrames, lastFrameLen
|
|
201
|
+
if (dataLength === 0) { totalFrames = 0; lastFrameLen = 0 }
|
|
202
|
+
else {
|
|
203
|
+
lastFrameLen = (dataLength % frameLen) || frameLen
|
|
204
|
+
totalFrames = Math.floor(dataLength / frameLen) + (lastFrameLen < frameLen ? 1 : 0)
|
|
205
|
+
}
|
|
206
|
+
if (totalFrames < 0 || totalFrames > 5_000_000) throw Error('TTA: implausible frame count ' + totalFrames)
|
|
207
|
+
|
|
208
|
+
return {
|
|
209
|
+
channels, bitsPerSample, byteSize, sampleRate, dataLength, frameLen, lastFrameLen, totalFrames,
|
|
210
|
+
filterShift: FILTER_SHIFT[byteSize - 1], predShift: byteSize === 1 ? 4 : 5,
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function cat(a, b) {
|
|
215
|
+
let r = new Uint8Array(a.length + b.length)
|
|
216
|
+
r.set(a); r.set(b, a.length)
|
|
217
|
+
return r
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function merge(parts, hdr) {
|
|
221
|
+
if (!parts.length) return EMPTY
|
|
222
|
+
let total = parts.reduce((s, p) => s + p[0].length, 0)
|
|
223
|
+
let channelData = Array.from({ length: hdr.channels }, (_, c) => {
|
|
224
|
+
let o = new Float32Array(total), off = 0
|
|
225
|
+
for (let p of parts) { o.set(p[c], off); off += p[c].length }
|
|
226
|
+
return o
|
|
227
|
+
})
|
|
228
|
+
return { channelData, sampleRate: hdr.sampleRate }
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** Create a synchronous streaming decoder. */
|
|
232
|
+
export function decoder() {
|
|
233
|
+
let skip = null // bytes of a leading ID3v2 tag to drop, once known
|
|
234
|
+
let hdr = null // parsed TTA1 header, once complete
|
|
235
|
+
let frameSizes = null // per-frame byte length, from the seek table
|
|
236
|
+
let frameIdx = 0
|
|
237
|
+
let left = null // carried-over incomplete header/seektable/frame bytes
|
|
238
|
+
let freed = false
|
|
239
|
+
let errors = 0 // frames dropped for a CRC32 mismatch
|
|
240
|
+
|
|
241
|
+
function decode(data) {
|
|
242
|
+
if (freed) throw Error('Decoder already freed')
|
|
243
|
+
if (!data || !data.byteLength) return EMPTY
|
|
244
|
+
let chunk = data instanceof Uint8Array ? data : new Uint8Array(data)
|
|
245
|
+
if (left) { chunk = cat(left, chunk); left = null }
|
|
246
|
+
|
|
247
|
+
if (!hdr) {
|
|
248
|
+
if (skip === null) {
|
|
249
|
+
if (chunk.length < 3) { left = chunk.slice(); return EMPTY }
|
|
250
|
+
if (chunk[0] === 0x49 && chunk[1] === 0x44 && chunk[2] === 0x33) { // 'ID3'
|
|
251
|
+
if (chunk.length < 10) { left = chunk.slice(); return EMPTY }
|
|
252
|
+
skip = id3v2Size(chunk)
|
|
253
|
+
} else skip = 0
|
|
254
|
+
}
|
|
255
|
+
if (chunk.length < skip + 4) { left = chunk.slice(); return EMPTY }
|
|
256
|
+
if (!(chunk[skip] === 0x54 && chunk[skip + 1] === 0x54 && chunk[skip + 2] === 0x41 && chunk[skip + 3] === 0x31))
|
|
257
|
+
throw TypeError('Not a TTA file')
|
|
258
|
+
if (chunk.length < skip + 22) { left = chunk.slice(); return EMPTY }
|
|
259
|
+
hdr = parseHeader(chunk, skip)
|
|
260
|
+
chunk = chunk.subarray(skip + 22)
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (!frameSizes) {
|
|
264
|
+
let need = hdr.totalFrames * 4 + 4
|
|
265
|
+
if (chunk.length < need) { left = chunk.slice(); return EMPTY }
|
|
266
|
+
let sizes = new Uint32Array(hdr.totalFrames)
|
|
267
|
+
for (let i = 0; i < hdr.totalFrames; i++) sizes[i] = readU32(chunk, i * 4)
|
|
268
|
+
if (crc32(chunk, 0, hdr.totalFrames * 4) !== readU32(chunk, hdr.totalFrames * 4))
|
|
269
|
+
throw Error('TTA: seek-table CRC mismatch')
|
|
270
|
+
frameSizes = sizes
|
|
271
|
+
chunk = chunk.subarray(need)
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
let parts = []
|
|
275
|
+
while (frameIdx < hdr.totalFrames) {
|
|
276
|
+
let want = frameSizes[frameIdx]
|
|
277
|
+
if (chunk.length < want) { left = chunk.slice(); return merge(parts, hdr) }
|
|
278
|
+
let nSamples = frameIdx === hdr.totalFrames - 1 ? hdr.lastFrameLen : hdr.frameLen
|
|
279
|
+
let out = decodeFrame(chunk.subarray(0, want), hdr, nSamples)
|
|
280
|
+
if (out) parts.push(out); else errors++
|
|
281
|
+
chunk = chunk.subarray(want)
|
|
282
|
+
frameIdx++
|
|
283
|
+
}
|
|
284
|
+
return merge(parts, hdr)
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
return {
|
|
288
|
+
decode,
|
|
289
|
+
/** Drop any trailing incomplete header/seek-table/frame bytes. */
|
|
290
|
+
flush() { left = null; return EMPTY },
|
|
291
|
+
free() { freed = true; left = null },
|
|
292
|
+
/** Frames dropped so far for a CRC32 mismatch. */
|
|
293
|
+
get errors() { return errors },
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/** Decode a complete TTA stream synchronously. */
|
|
298
|
+
export default function decode(src) {
|
|
299
|
+
let dec = decoder()
|
|
300
|
+
try { return dec.decode(src instanceof Uint8Array ? src : new Uint8Array(src)) }
|
|
301
|
+
finally { dec.free() }
|
|
302
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@audio/decode-tta",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Decode TTA (True Audio) lossless audio to PCM samples",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "decode-tta.js",
|
|
7
|
+
"types": "decode-tta.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./decode-tta.js",
|
|
10
|
+
"./audio": {
|
|
11
|
+
"types": "./audio.d.ts",
|
|
12
|
+
"default": "./audio.js"
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"decode-tta.js",
|
|
18
|
+
"decode-tta.d.ts",
|
|
19
|
+
"audio.js",
|
|
20
|
+
"audio.d.ts",
|
|
21
|
+
"LICENSE",
|
|
22
|
+
"LICENSE.ttadec"
|
|
23
|
+
],
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"tst": "^9.4.0"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"test": "node test.js"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"tta",
|
|
32
|
+
"true-audio",
|
|
33
|
+
"lossless",
|
|
34
|
+
"audio",
|
|
35
|
+
"decode",
|
|
36
|
+
"decoder",
|
|
37
|
+
"pcm",
|
|
38
|
+
"rice-coding"
|
|
39
|
+
],
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"author": "Dmitry Iv. <dfcreative@gmail.com>",
|
|
42
|
+
"homepage": "https://github.com/audiojs/decode/tree/main/packages/decode-tta",
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "git+https://github.com/audiojs/decode.git",
|
|
46
|
+
"directory": "packages/decode-tta"
|
|
47
|
+
},
|
|
48
|
+
"bugs": "https://github.com/audiojs/decode/issues",
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=18"
|
|
51
|
+
},
|
|
52
|
+
"audio": "./audio.js",
|
|
53
|
+
"sideEffects": false,
|
|
54
|
+
"publishConfig": {
|
|
55
|
+
"access": "public"
|
|
56
|
+
},
|
|
57
|
+
"funding": "https://github.com/sponsors/audiojs"
|
|
58
|
+
}
|
|
@@ -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,33 @@
|
|
|
1
|
+
# @audio/decode-vorbis
|
|
2
|
+
|
|
3
|
+
Decode Ogg Vorbis audio with [@wasm-audio-decoders/ogg-vorbis](https://github.com/eshaz/wasm-audio-decoders).
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
import decode, { decoder } from '@audio/decode-vorbis'
|
|
7
|
+
|
|
8
|
+
let { channelData, sampleRate } = await decode(oggBytes)
|
|
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()` initializes asynchronously. `decode()` and `flush()` are synchronous.
|
|
18
|
+
`decode()` accepts consecutive complete Ogg files. For chunked input, `flush()` ends
|
|
19
|
+
the decoder.
|
|
20
|
+
|
|
21
|
+
## Metadata
|
|
22
|
+
|
|
23
|
+
Read Vorbis comments and cover art without decoding audio:
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
import { parseMeta } from '@audio/decode-vorbis/meta'
|
|
27
|
+
|
|
28
|
+
let { meta, sampleRate } = parseMeta(oggBytes)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## License
|
|
32
|
+
|
|
33
|
+
[ॐ](https://github.com/krishnized/license/) · [MIT](./LICENSE)
|
|
@@ -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 'vorbis' — extends audio()'s openable formats / save() targets */
|
|
12
|
+
export declare const vorbis: {
|
|
13
|
+
codec: 'vorbis'
|
|
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-vorbis) by format
|
|
3
|
+
// name. Format detection is magic-byte (audio-type) — no test() needed here.
|
|
4
|
+
|
|
5
|
+
import decodeFn from './decode-vorbis.js'
|
|
6
|
+
|
|
7
|
+
export const vorbis = {
|
|
8
|
+
codec: 'vorbis',
|
|
9
|
+
decode: (bytes) => decodeFn(bytes),
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface AudioData {
|
|
2
|
+
channelData: Float32Array[];
|
|
3
|
+
sampleRate: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
interface VorbisDecoder {
|
|
7
|
+
/** Decode a chunk synchronously. */
|
|
8
|
+
decode(data: Uint8Array | ArrayBuffer): AudioData;
|
|
9
|
+
/** Finish chunked input synchronously. This ends the decoder. */
|
|
10
|
+
flush(): AudioData;
|
|
11
|
+
free(): void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Decode a complete Ogg Vorbis file. */
|
|
15
|
+
export default function decode(src: ArrayBuffer | Uint8Array): Promise<AudioData>;
|
|
16
|
+
|
|
17
|
+
/** Initialize WASM and create a decoder with synchronous methods. */
|
|
18
|
+
export function decoder(): Promise<VorbisDecoder>;
|