Commit Graph
233 Commits
Author SHA1 Message Date
4DBug 270eccab0f ws-audio2: merge ws/audio2-tracker (MTM, 669, STM, ULT, OKT, MED, PTM, FAR, UMX; Tracker engine families) 2026-10-31 15:19:31 -05:00
4DBug f6188764b8 ws-audio2: merge ws/audio2-lossless (WavPack, Monkey's Audio, TTA, ApeTag)
codecs/audio/Stream: both branches extended pull(): buffer pcm (adpcm) and scale / ints (lossless); combined.
2026-10-31 15:18:31 -05:00
4DBug 00b36fa14a ws-audio2: lossless: allocation limits (WavPack frame n x channels, APE / TTA frame size: LIMIT above 2^24 samples) 2026-10-31 15:17:36 -05:00
4DBug 703af4cc71 ws-audio2: merge ws/audio2-adpcm (codecs/audio/Adpcm, Qoa; adx, vag, brstm/bcstm/bfstm, raw adpcm, qoa; wav/aiff/caf/xm ADPCM) 2026-10-31 15:10:09 -05:00
4DBug 085e385674 ws-audio2: TTA: codecs/audio/Tta (written from the TTA1 format description; no libtta / ffmpeg code) + audio/tta
TTA1 format 1, 8/16/24 bits, any channel count, header / seek table / frame CRC-32s, seeking, ID3v2 skipped, APEv2
tags; password-protected files -> UNSUPPORTED. 20 fixtures (ttaenc 3.4.1, the FATE inside.tta sample) bit-exact
against ttaenc -d. Branch-free filter steps (LuaJIT: no register-coalescing aborts, 7 -> 40 MB/s).
WavPack: the unary / gamma counts a byte at a time (LuaJIT traces). APE: the predictor rotations as single
assignments. docs/guide/audio.md: the lossless section (+ tools/fixtures/docs_lossless.py inputs) and the Formats
table.
2026-10-31 15:08:47 -05:00
4DBug 39da2f6648 ws-audio2: merge ws/audio2-lossy (Musepack SV7/SV8, AC-3, AudioWrap AC-3 hook) 2026-10-31 14:57:05 -05:00
4DBug 26fa887370 ws-audio2: music/umx (Unreal music packages): the package tables parsed, the music export's module handed to a new api hook opts.decodeModule(buf, format?)
src/Formats/init.luau: withHooks adds opts.decodeModule (F.load of the bytes as music) next to decodeImage /
openAudio, so a format never requires another; docs/API.md lists it. Backward compatible (a new optional hook).
2026-10-31 14:54:54 -05:00
4DBug 62aded60c0 ws-audio2: audio/ac3 sniffs E-AC-3 too (loading one says UNSUPPORTED, not an unknown format); fixture tidy 2026-10-31 14:52:41 -05:00
4DBug ae8ff9d6bf ws-audio2: Monkey's Audio: codecs/audio/Ape (port of the MAC SDK 13.28 decoder, BSD-3) + audio/ape
File versions 3.95+ (3.99+ verified; the 3.95-3.98 range-coder model is ported without a reference fixture), every
level (fast .. insane), 8/16/24/32-bit int and 32-bit float, 1-32 channels, special frames, frame CRCs, seeking,
APEv2 tags, ID3v2 in front. 35 fixtures (mac 13.28, the FATE luckynight sample) bit-exact against mac -d.
tests/audio/_lossless.luau: the per-fixture checks shared by the lossless format tests. tools/bench.luau: the
ws-audio2 lossless block.
2026-10-31 14:52:08 -05:00
4DBug 3d5cf3130e ws-audio2: music/med (MED / OctaMED MMD0..MMD3): xm family with ProTracker periods, MED effects and tempo modes, play sequences, hold / decay envelopes, IFF multi-octave keymaps; engine: EXT tempo > 255, flags.envRowHold
Synthetic / hybrid / MIDI instruments are silent (listed in meta.unsupported).
2026-10-31 14:51:33 -05:00
4DBug 41b72d9b8a ws-audio2: audio/ac3 + codecs/audio/Ac3: AC-3 decoding from ATSC A/52, AC-3 tracks of MKV / MP4 / TS / AVI
Written from the A/52:2018 specification (tables transcribed from it; no liba52 / ffmpeg code): every acmod with LFE,
coupling + phase flags, rematrixing, block switching, delta bit allocation, dither, CRC check, dynamic range off by
default (drc = 0 .. 1). E-AC-3 and bsid 9 / 10 are UNSUPPORTED. 101.8 - 108.6 dB SNR vs ffmpeg's float decode
(liba52's for block-switched streams: the packaged ffmpeg mis-decodes the first short transform).

Outside the folders: containers/AudioWrap passes ac3 tracks to audio/ac3 (one branch); a comment in
src/Formats/init.luau mentions it. The fixture clears the encoders' dithflags (positions from the new
Ac3 decoder field dec.blocks) so reference and decoder decode the same numbers.
2026-10-31 14:45:23 -05:00
4DBug d2c470013d ws-audio2: bench lines for AHX / HVL render; type fixes (no new diagnostics); Types.Module format comment lists ahx / hvl
Types.luau: comment only.
2026-10-31 14:42:03 -05:00
4DBug d418458e2a ws-audio2: music/okt: typed chunk list (type baseline 92) 2026-10-31 14:40:58 -05:00
4DBug 9a5f3796e2 ws-audio2: music/okt (Oktalyzer): it family with ProTracker periods (PAL), mixed channel pairs and their shared volume, three arpeggios, note slides, sustain loops released by R 2026-10-31 14:40:13 -05:00
4DBug 9466c5f471 ws-audio2: music/xm decodes ModPlug ADPCM samples (were silence), through codecs/audio/Adpcm.modplug
Fixture: tools/fixtures/_tracker.py write_xm gains an optional per-sample "adpcm" payload (two lines, shared with
the tracker generators, backward compatible); a new xm case renders the same as openmpt123.
2026-10-31 14:37:23 -05:00
4DBug 6b5e8ec6cf ws-audio2: music/far (Farandole Composer): s3m family with Hz periods (36318 / 1024 Hz per step), auto tone portamento, variable-length patterns with break rows 2026-10-31 14:36:44 -05:00
4DBug 2717292366 ws-audio2: AIFF-C and CAF ima4 (Apple IMA ADPCM) decode through codecs/audio/Adpcm
aiff: COMM counts ima4 packets; caf: ima4 through Adpcm/Decoder.blocks (exact seeking), and a constant-size
packet stream whose pakt lists no packets now uses bytesPerPacket (was 0 frames). Bit-exact with ffmpeg.
2026-10-31 14:34:28 -05:00
4DBug bac37fb157 ws-audio2: music/ptm: split the pattern / effect parsing (type checker complexity; baseline 92 kept) 2026-10-31 14:34:09 -05:00
4DBug d3ea84bb57 ws-audio2: api renderMusic uses a Module's own render method for non-tracker engines (AHX / HVL); docs/guide/music.md: AHX / HVL and MIDI variants section, Formats rows (docs inputs: tools/fixtures/docs_chip.py)
src/Formats/init.luau: renderMusic: a kind "music" value whose format is not mod/s3m/xm/it and that has a render
method renders through it (a failed render's .err becomes the error). Backward compatible.
2026-10-31 14:32:05 -05:00
4DBug 60544a3a77 ws-audio2: music/ptm (PolyTracker): it family, MOD letters with S3M fine slides, note slides, delta 8 / 16-bit samples; engine flags.panLaw = ft2 (square-root panning)
ops/MusicOps: accept modules of the other tracker formats by their engine family (Tracker.family), a one-line
backward-compatible change.
2026-10-31 14:29:01 -05:00
4DBug 3f6823cbe5 ws-audio2: audio/brstm variant() names bcstm / bfstm for F.detect 2026-10-31 14:28:31 -05:00
4DBug 71bb89763e merge master (ws/apifix) into ws/audio2-chip 2026-10-31 14:28:00 -05:00
4DBug a3e234cc0d ws-audio2: MUS, XMI, HMP / HMI (music/mus, music/xmi, music/hmp) -> Types.Midi through codecs/audio/MidiRender (merge, tempoBytes); event streams match wildmidi -x 2026-10-31 14:27:51 -05:00
4DBug 66c3819063 merge master (ws/apifix) 2026-10-31 14:26:53 -05:00
4DBug 5e64334e85 Merge branch 'master' into ws/audio2-adpcm 2026-10-31 14:26:41 -05:00
4DBug f765763537 ws-audio2: codecs/audio/Qoa and audio/qoa (QOA read / write, port of qoa.h, MIT)
Decode bit-exact with ffmpeg and qoa.h; encode byte-for-byte qoa.h's qoa_encode (fixtures compile the committed
qoa.h reference with nix gcc).
2026-10-31 14:26:33 -05:00
4DBug f6349219d8 Merge branch 'master' into ws/audio2-lossy 2026-10-31 14:26:22 -05:00
4DBug 48b4b4cc4e merge master (ws/apifix) 2026-10-31 14:26:11 -05:00
4DBug f3299bf70f ws-audio2: music/ult (UltraTracker): it family, two effect columns folded into the IT volume column, sustain loops, auto tone portamento (also from the volume column) 2026-10-31 14:25:08 -05:00
4DBug 5dfaaf7524 ws-audio2: audio/brstm (BRSTM / BCSTM / BFSTM read: DSP ADPCM, PCM16, PCM8, loops)
Bit-exact with vgmstream; forward seeks start from the ADPC / SEEK history. codecs/audio/Adpcm/Decoder.interleaved
also lays out block-interleaved PCM (s16be / s16le / s8); snapshots take precedence over a format's history table.
2026-10-31 14:22:46 -05:00
4DBug 967b91db91 ws-audio2: WavPack: codecs/audio/WavPack (port of WavPack 5.9.0's decoder, BSD) + audio/wavpack
Lossless and hybrid (lossy, and lossless with the .wvc via opts.correction / opts.resolve), 8-32 bit int (int32 modes,
wvx) and 32-bit float, 1-8+ channels, every decorrelation pass, joint stereo, cross decorrelation, noise shaping,
block CRCs; APEv2 tags; sample-accurate seeking. 58 fixtures (wavpack -f..-hhx6, ffmpeg) bit-exact against wvunpack.

codecs/audio/Stream (shared, backward compatible): Stream.packets takes optional spec.scale (read() writes pcm values
times scale) and spec.ints (adds dec:readInt for bit-exact integer reads).
2026-10-31 14:19:23 -05:00
4DBug 80f5fd2c5b ws-audio2: music/stm (Scream Tracker 2): s3m family with the ST2 tempo byte, deferred Bxx, no effect memory 2026-10-31 14:19:23 -05:00
4DBug fd9175883d ws-audio2: audio/adx (CRI ADX read / write, loops) and audio/vag (VAGp / VAGi / KVAG read, VAGp / VAGi write)
Bit-exact with vgmstream (ADX, PS-ADPCM) and ffmpeg (KVAG IMA); ADX and PS-ADPCM encoders in codecs/audio/Adpcm.
2026-10-31 14:17:57 -05:00
4DBug 22615b503e ws-audio2: audio/mpc + codecs/audio/Musepack: Musepack SV7 / SV8 decoding (libmpcdec r475 port, BSD)
Gapless (synthesis delay, SV8 leading silence, SV7 last frame length), seeking (SV8 by packet with one packet of
pre-roll: exact; SV7 by frame with 32 frames of pre-roll like libmpcdec), APEv2 tags via codecs/audio/ApeTag (merged
from ws/audio2-lossless), ID3v2 skipped. Fixtures build mpcenc / mppenc / a float libmpcdec dumper from the pinned
upstream tarballs through nix; 132-140 dB SNR vs libmpcdec float, 82.7 dB vs ffmpeg's s16 decode.
2026-10-31 14:14:29 -05:00
4DBug 5bbb4227c2 ws-apifix: API.md / STYLE.md / README: music as audio, video as animated image, F.save extra files, variant(r), caps.extraFiles, F.music builder, bitrate in bit/s; type baseline 92 2026-10-31 14:14:11 -05:00
4DBug 33d87e0c4d ws-audio2: music/669 (Composer 669 / UNIS 669): s3m family with Hz periods, fast + auto slides, frequency adjust, per-pattern speed and break rows 2026-10-31 14:13:48 -05:00
4DBug 6274eedd12 ws-apifix: MP4 AAC length matches ffmpeg: the edit list's length (Track.playDuration) cuts the end padding as well as the priming (codecDelay); a 1 s clip decodes to 44100 frames, not 45056. AudioWrap.trim(dec, skip, length?); the MP4 writer keeps the edit length of copied audio. Video tests compare the whole decoded audio length with ffmpeg (not yet for Matroska) 2026-10-31 14:13:08 -05:00
4DBug 384cdc407d ws-audio2: music/mtm (MultiTracker) on the tracker engine; engine: m.engine family, m.preamp, flags (periods amiga/hz, fastPortas, autoTonePorta, autoReset, st2Tempo, oktSlides), extension effects (note slides, auto portamento, frequency adjust), codecs/audio/Tracker/Load helpers (OpenMPT BSD)
Engine changes are backward compatible: m.engine defaults to m.format; the channel / sample / instrument
global volumes now apply in every family (defaults leave MOD / S3M / XM unchanged); mod/s3m/xm/it tests green.
2026-10-31 14:11:20 -05:00
4DBug 363b14932f ws-audio2: codecs/audio/Adpcm (IMA / ima4 / IMA WAV / MS / ADX / PS-ADPCM / DSP decode, IMA + MS encode, Decoder layouts) and audio/adpcm (raw streams)
- codecs/audio/Adpcm: decoder kernels bit-exact with ffmpeg (IMA, ima4, MS) and vgmstream (ADX, PS-ADPCM, DSP);
  IMA nibble / IMA WAV / MS block encoders. Adpcm/Decoder: streaming Decoders over the shared layouts (channel
  interleaved frames, nibble streams, self-contained blocks) with exact seeking through state snapshots.
- audio/wav: its IMA / MS block decoders moved to codecs/audio/Adpcm (wav tests unchanged and green).
- codecs/audio/Stream (shared, small and backward compatible): pcm() may return a buffer of f32 (copied with
  buffer.copy) instead of a table.
- audio/adpcm: headerless ima / ima_wav / ms / ima_qt / psx streams by options; encode ima / ima_wav / ms.
- licenses: vgmstream (ISC).
2026-10-31 14:10:23 -05:00
4DBug 848e4bfff6 ws-audio2: AHX and HVL (music/ahx, music/hvl) over codecs/audio/Hively, a port of hvl2wav's replay.c (BSD-3): bit-exact vs hvl2wav 2026-10-31 14:09:29 -05:00
4DBug ac47545aa3 ws-apifix: one bitrate unit: every encoder's bitrate option is bit/s (MP3 now too), values below 1000 are kbit/s (the old MP3 values keep working; Opus accepts them too); the MP3 Decoder's bitrate field is bit/s as the Decoder contract says (was kbit/s) 2026-10-31 14:06:51 -05:00
4DBug 3c2a646365 ws-apifix: type fixes (no new diagnostics) 2026-10-31 14:04:21 -05:00
4DBug 2f0ff81c95 ws-apifix: an outline font saved as BMFont writes its pages (opts.files; without a destination F.save returns them as a third value { [page file] = PNG bytes }; caps.extraFiles); pages named after the destination 2026-10-31 14:03:45 -05:00
4DBug d73b93c740 ws-apifix: videos save as animated images (F.save(video, gif | apng | webp), F.convert(avi, "gif"): frames / fps / maxFrames (300) / maxPixels (2^25)); VideoFrame.index restarts at the seek position; F.detect names WebM files "webm"
api: encoderFor finds image formats for a VideoDecoder, videoToImage() collects the frames; F.detect asks a
format's optional variant(r) for a more precise name (video/mkv: Mkv.variant, from Parse.docType).
codecs/video/Video: index after seek = round(pts * frameRate) + 1.
2026-10-31 14:00:36 -05:00
4DBug 4dd6cd1400 ws-audio2: move music/midi/Render to codecs/audio/MidiRender (attach: summary + render method, shared by the MIDI variants); .kar lyrics -> meta.lyrics / karaoke / tags 2026-10-31 13:57:25 -05:00
4DBug 10bd6b021f ws-apifix: music is audio (F.save / F.convert of a Module or Midi to an audio format renders it, render options from opts; F.audio.open / load render music bytes), F.music builder (ops/MusicOps: new, addPattern, setCell / getCell, addSample, addInstrument, note; also F.ops.music), MIDI writer writes track.name as a 0x03 event
api (init.luau): detectFor() falls back from audio to rendering music formats; encoderFor finds audio formats for
music values; renderMusic() through codecs/audio/Tracker or music/midi render.
2026-10-31 13:56:21 -05:00
4DBug b7006dbbed ws-audio2: codecs/audio/ApeTag: APEv1 / APEv2 tags -> Types.Tags (find / parse / tagKey), shared by WavPack, APE, TTA, Musepack 2026-10-31 13:54:05 -05:00
4DBug 25d8e4ff25 ws-apifix: F.ops.layers.flatten applies the mask of a passThrough group (codecs/image/Blend lerp takes a mask) 2026-10-31 13:50:05 -05:00
4DBug 7cfec05eeb ws-cleanup: Pcm.collect reads a known length in one call into the result (no copy); README links the guide
Measured in an A/B of the touched paths (best of 3-4, one core): LuaJIT wav decode through Pcm.drain was ~10%
slower than the old single read; now within noise.
2026-10-31 13:19:43 -05:00
4DBug 9941113b7b ws-cleanup: audio codecs out of the format folders (codecs/audio/Opus, Vorbis, Flac, Mpa)
The decoders / encoders are libraries, not the file format: audio/opus/{Celt, CeltTables, CeltEncoder, Mdct, Packet,
Silk, SilkTables, Decoder} -> codecs/audio/Opus; audio/vorbis/{Codebook, Packet, Setup, Tables} ->
codecs/audio/Vorbis; audio/flac/{Frame, Encode} -> codecs/audio/Flac; audio/mp3/{Core, Tables, Header, Encode2,
Encode3, EncTables, Analysis} -> codecs/audio/Mpa (tools/move.py; code unchanged). Each gets an index init.luau.
The format folders keep the file mapping: Ogg Opus / Ogg Vorbis (headers, granules, seeking, the Vorbis encoder's
Ogg writer), native / Ogg FLAC streams and metadata, ID3 / Xing / the MP3 frame index. docs: STYLE says a codec is
not the format. Full suite: 248 runs pass on both runtimes, lint green.
2026-10-31 12:47:02 -05:00