ws-m4a: codecs/Aac (AAC-LC decoder: ASC / PCE / ADTS, all tools, SBR/PS extension hook), codecs/Alac (decoder + encoder), audio/m4a (AAC + ALAC read, ALAC write, tags, gapless, seek), audio/aac (ADTS), audio/caf (lpcm/alac/aac/ulaw/alaw read, lpcm/alac write); fixtures checked by ffmpeg / fdkaac / MP4Box

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
4DBugandClaude Opus 5.5 committed 2026-10-31 09:03:04 -05:00
1 parent 8b29568e0f
commit f66594908c
22 files changed
+5380

No files matched your search

+42
View File
@@ -0,0 +1,42 @@
-- tests/audio/_signal: the deterministic integer test signal of tools/fixtures/_m4a_signal.py (the same numbers), as
-- an interleaved integer array and as a Types.Audio (f32, exact for up to 24 bits). Used by the m4a / caf tests and the
-- fixture-time encoder runs (tools/fixtures/_m4a_encode.luau).
local Types = require("@formats/Types")
local Signal = {}
function Signal.ints(frames: number, channels: number, bits: number, seed: number): { number }
local s = seed
local peak = 2 ^ (bits - 1) - 1
local out = table.create(frames * channels, 0)
local k = 1
for i = 0, frames - 1 do
for c = 0, channels - 1 do
s = (s * 48271) % 2147483647
local p1 = 97 + 31 * c
local tri = math.abs((i % p1) * 2 - p1) * 2 - p1
local v = tri * (peak // (4 * p1))
local p2 = 1500 + 200 * c
v += if (i // p2) % 2 == 0 then peak // 6 else -(peak // 6)
v += ((s // 65536) % 4096 - 2048) * (peak // 65536 + 1)
if i % 7001 < 3 then
v += peak // 2
end
out[k] = math.clamp(v, -peak - 1, peak)
k += 1
end
end
return out
end
function Signal.audio(rate: number, frames: number, channels: number, bits: number, seed: number): Types.Audio
local ints = Signal.ints(frames, channels, bits, seed)
local a = Types.Audio.new(rate, channels, frames)
local scale = 1 / 2 ^ (bits - 1)
for i, v in ints do
buffer.writef32(a.samples, (i - 1) * 4, v * scale)
end
return a
end
return Signal