audio formats: comments are specs only
This commit is contained in:
1 parent
0bd7b87d2b
commit
6ffbdbe0be
29 files changed
+143
-442
No files matched your search
@@ -1,20 +1,8 @@
|
||||
--!strict
|
||||
-- audio/adpcm: headerless ADPCM streams (.adpcm / .ima / .vox-style dumps), over codecs/audio/Adpcm. New in
|
||||
-- rosetta. A raw stream has no header, so nothing identifies it: sniff is always 0, F.detect only finds it by
|
||||
-- extension, and the layout comes from the options (codec, sampleRate, channels, blockAlign). vgmstream plays such
|
||||
-- files only through a .txth description and ffmpeg not at all (its adpcm_* codecs need a container), so the codecs
|
||||
-- here are the layouts those containers use:
|
||||
-- "ima" IMA nibbles from predictor 0 / step index 0, channels interleaved by nibble, the high nibble first
|
||||
-- (DVI order, as KVAG / adpcm_ima_ssi); lowFirst = true for the other order
|
||||
-- "ima_wav" Microsoft IMA blocks (the WAV / AVI data chunk), blockAlign bytes each (default 1024)
|
||||
-- "ms" Microsoft ADPCM blocks with the 7 standard coefficient pairs (default blockAlign 1024)
|
||||
-- "ima_qt" Apple ima4 packets (34 bytes per channel, 64 frames), as in AIFF-C / CAF / QuickTime
|
||||
-- "psx" Sony PS-ADPCM frames (16 bytes, 28 samples), channels interleaved every `interleave` bytes (default 16)
|
||||
-- Encode: "ima", "ima_wav" and "ms" (from an Audio or a Decoder). Not supported: raw DSP / ADX (their coefficients
|
||||
-- live in a header: see audio/brstm and audio/adx).
|
||||
--
|
||||
-- local a = Adpcm.decode(Bytes.reader(buf), { codec = "ms", sampleRate = 22050, channels = 2, blockAlign = 512 })
|
||||
-- local raw = Adpcm.encode(a, { codec = "ima" })
|
||||
-- audio/adpcm: headerless ADPCM (.adpcm / .ima / .vox) via codecs/audio/Adpcm; sniff is 0, the layout comes from opts.
|
||||
-- "ima": DVI nibbles, high first; "ima_wav": MS IMA blocks; "ms": MS ADPCM, 7 standard coefficient pairs; "ima_qt":
|
||||
-- Apple ima4 (34-byte packets, 64 frames); "psx": PS-ADPCM (16-byte frames, 28 samples). Encode: ima, ima_wav, ms.
|
||||
-- Not supported: raw DSP / ADX (their coefficients live in a header).
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ requires
|
||||
local Err = require("@rosetta/core/Err")
|
||||
@@ -40,10 +28,10 @@ export type Options = {
|
||||
codec: Codec?, -- default "ima"
|
||||
sampleRate: number?, -- default 22050 (decode)
|
||||
channels: number?, -- default 1 (decode)
|
||||
blockAlign: number?, -- ima_wav / ms: bytes per block (default 1024 when decoding; 256 * channels when encoding)
|
||||
lowFirst: boolean?, -- ima: the low nibble first
|
||||
interleave: number?, -- psx: bytes per channel before the next channel (default 16)
|
||||
maxFrames: number?, -- decode(): Err.LIMIT past this (default 2^28)
|
||||
blockAlign: number?, -- ima_wav / ms; default 1024 decoding, 256 * channels encoding
|
||||
lowFirst: boolean?,
|
||||
interleave: number?, -- psx: bytes per channel (default 16)
|
||||
maxFrames: number?, -- default 2^28
|
||||
}
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ constants
|
||||
@@ -51,7 +39,7 @@ local CODECS = { ima = true, ima_wav = true, ms = true, ima_qt = true, psx = tru
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ sniff
|
||||
function Raw.sniff(_r: Bytes.Reader): number
|
||||
return 0 -- no header: found by extension or opts.format only
|
||||
return 0
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ decode
|
||||
|
||||
Reference in new issue
Block a user