ws-audio: MP3 layer III encoder (Encode3: shine-style CBR, MPEG-1/2/2.5, mono/stereo/joint MS, global-gain rate loop, region/table choice, count1 A/B) + MP2 layer II encoder (Encode2: standard alloc tables, greedy noise allocation, grouping), shared polyphase Analysis, EncTables (PDMP3 public-domain window + Huffman trees -> codeword tables); mp3 init encode() with ID3v2.4; fixtures decode with ffmpeg + lame (no errors, SNR floors); bench lines

This commit is contained in:
4DBug committed 2026-10-31 09:18:23 -05:00
1 parent 4dbd236962
commit e817053a40
14 files changed
+1859 -12

No files matched your search

+3 -3
View File
@@ -82,7 +82,7 @@ local rand = T.rng(12345)
t:eq(Mp3.name, "mp3", "name")
t:eq(Mp3.category, "audio", "category")
t:check(table.find(Mp3.extensions, "mp3") ~= nil and table.find(Mp3.extensions, "mp2") ~= nil, "extensions")
t:check(Mp3.caps.decode and not Mp3.caps.encode and Mp3.open ~= nil, "caps")
t:check(Mp3.caps.decode and Mp3.caps.encode and Mp3.open ~= nil, "caps") -- encode: ws-audio (tests/audio/mp3_encode.luau)
-- ------------------------------------------------------------------------------------------------ decode vs references
for _, c in Cases do
@@ -487,8 +487,8 @@ do
t:check(a and a.kind == "audio" and a.frames == 22050 and a.tags.title == "Test Title", "F.audio.load: " .. tostring(err))
local dec = F.audio.open(data)
t:check(dec and dec.sampleRate == 44100 and dec.frames == 22050, "F.audio.open")
local _, serr = F.save(a, nil, { format = "mp3" })
t:check(serr and serr.code == Err.UNSUPPORTED, "F.save mp3: read-only")
local saved, serr = F.save(a, nil, { format = "mp3" }) -- the layer III encoder (ws-audio)
t:check(saved and F.audio.load(saved).sampleRate == 44100, "F.save mp3: " .. tostring(serr))
end
-- ------------------------------------------------------------------------------------------------ fuzz