ws-audio2: merge ws/audio2-tracker (MTM, 669, STM, ULT, OKT, MED, PTM, FAR, UMX; Tracker engine families)
This commit is contained in:
commit
270eccab0f
43 files changed
+4907
-65
No files matched your search
@@ -84,6 +84,8 @@ A format never requires another format, so the api passes these to decoders / en
|
||||
|
||||
- `opts.decodeImage(buf) -> Image | nil, Err` and `opts.encodeImage(img, format) -> buffer | nil, Err`: images inside
|
||||
other files (ICO PNG entries, PSD / glTF / 3MF textures, MJPEG frames, ...).
|
||||
- `opts.decodeModule(buf, format?) -> Module | nil, Err`: tracker modules inside other files (the module of an Unreal
|
||||
`.umx` package), loaded as music.
|
||||
- `opts.openAudio(demuxer, track) -> Decoder | nil, Err`: audio tracks of video containers (wrapped by
|
||||
`containers/AudioWrap` and opened as the matching audio format).
|
||||
- `opts.plugins` (default `F.plugins`): injected optional dependencies, e.g. `F.plugins.brep` (a B-rep kernel for
|
||||
|
||||
+10
-1
@@ -83,15 +83,24 @@ is tested under both runtimes (luau `--codegen -O2` and LuaJIT through the build
|
||||
| subtitle | ass | .ass .ssa | yes | yes | styles: true | `tests/subtitle/ass.luau` |
|
||||
| subtitle | srt | .srt | yes | yes | styles: false | `tests/subtitle/srt.luau` |
|
||||
| subtitle | vtt | .vtt .webvtt | yes | yes | styles: true | `tests/subtitle/vtt.luau` |
|
||||
| music | 669 | .669 | yes | - | render: true, channels: 8, 8 | `tests/music/669.luau` |
|
||||
| music | ahx | .ahx .thx | yes | - | render: true, channels: 4, 4, subsongs: true | `tests/music/ahx.luau` |
|
||||
| music | far | .far | yes | - | render: true, channels: 16, 16 | `tests/music/far.luau` |
|
||||
| music | hmp | .hmp .hmi | yes | - | render: true, hmi: true | `tests/music/hmp.luau` |
|
||||
| music | hvl | .hvl | yes | - | render: true, channels: 4, 16, subsongs: true | `tests/music/hvl.luau` |
|
||||
| music | it | .it | yes | - | render: true, channels: 1, 64, compressedSamples: true | `tests/music/it.luau` |
|
||||
| music | med | .med .mmd0 .mmd1 .mmd2 .mmd3 .omed | yes | - | render: true, channels: 1, 64 | `tests/music/med.luau` |
|
||||
| music | midi | .mid .midi .smf .kar .rmi | yes | yes | formats: 0, 1, 2, render: true, streaming: true, rmid: true | `tests/music/midi.luau` |
|
||||
| music | mod | .mod .m15 .stk .nst | yes | yes | render: true, channels: 1, 32 | `tests/music/mod.luau` |
|
||||
| music | mtm | .mtm | yes | - | render: true, channels: 1, 32 | `tests/music/mtm.luau` |
|
||||
| music | mus | .mus | yes | - | render: true | `tests/music/mus.luau` |
|
||||
| music | okt | .okt .okta | yes | - | render: true, channels: 4, 8 | `tests/music/okt.luau` |
|
||||
| music | ptm | .ptm | yes | - | render: true, channels: 1, 32 | `tests/music/ptm.luau` |
|
||||
| music | s3m | .s3m | yes | - | render: true, channels: 1, 32 | `tests/music/s3m.luau` |
|
||||
| music | sf2 | .sf2 | yes | - | sm24: true, sf3: false | `tests/music/sf2.luau` |
|
||||
| music | stm | .stm | yes | - | render: true, channels: 4, 4 | `tests/music/stm.luau` |
|
||||
| music | ult | .ult | yes | - | render: true, channels: 1, 32 | `tests/music/ult.luau` |
|
||||
| music | umx | .umx | yes | - | render: true, container: true | `tests/music/umx.luau` |
|
||||
| music | xm | .xm | yes | yes | render: true, channels: 1, 64 | `tests/music/xm.luau` |
|
||||
| music | xmi | .xmi .xmidi | yes | - | render: true, songs: true | `tests/music/xmi.luau` |
|
||||
| playlist | m3u | .m3u .m3u8 | yes | yes | hls: true | `tests/playlist/m3u.luau` |
|
||||
@@ -119,7 +128,7 @@ Codecs (layer 3, shared by formats; not loadable on their own), by domain:
|
||||
- codecs/audio/Resample: audio sample-rate conversion by band-limited (Kaiser-windowed sinc) interpolation, streaming or
|
||||
- codecs/audio/SoundFont: SoundFont 2 banks and the sample synth that plays MIDI through them. A codec (layer 1) shared by
|
||||
- codecs/audio/Stream: the streaming Decoder (Types.Decoder: read / seek / position) over a packetised codec, the part
|
||||
- codecs/audio/Tracker: the shared tracker engine behind music/mod, music/s3m, music/xm and music/it. The four loaders read
|
||||
- codecs/audio/Tracker: the shared tracker engine behind music/mod, music/s3m, music/xm and music/it, and the loaders
|
||||
- codecs/audio/Tta: the TTA1 (True Audio) lossless codec. A codec (layer 3). Written from the TTA1 format description
|
||||
- codecs/audio/Vorbis: the Vorbis I decoder without its container: identification / comment / setup headers (Setup),
|
||||
- codecs/audio/VorbisComment: Vorbis comment fields ("KEY=value", the tag block of Vorbis, Opus and FLAC) <-> Types.Tags.
|
||||
|
||||
+49
-2
@@ -1,6 +1,7 @@
|
||||
# Music
|
||||
|
||||
Music files hold notes and instruments, not a recording. Tracker modules (MOD, S3M, XM, IT) load as a **Module**:
|
||||
Music files hold notes and instruments, not a recording. Tracker modules (MOD, S3M, XM, IT, and the
|
||||
[other trackers](#more-tracker-formats): MTM, 669, STM, ULT, OKT, MED, PTM, FAR, UMX) load as a **Module**:
|
||||
the patterns, the order list, the samples and the instruments. Standard MIDI files load as a **Midi**: tracks of
|
||||
timed events. Both render to the standard audio [Decoder](audio.md#decoder), so every music file can also be
|
||||
played, analysed or saved as audio. MIDI renders through a SoundFont 2 bank, or through a small built-in set of
|
||||
@@ -26,7 +27,8 @@ assert(audio.channels == 2 and audio.sampleRate == 44100)
|
||||
| Field | Type | Meaning |
|
||||
|---|---|---|
|
||||
| `kind` | `"music"` | |
|
||||
| `format` | string | `"mod"`, `"s3m"`, `"xm"` or `"it"`: the effect family the engine plays |
|
||||
| `format` | string | the format it was read from: `"mod"`, `"s3m"`, `"xm"`, `"it"`, `"mtm"`, `"669"`, `"med"`, ... |
|
||||
| `engine` | string? | the effect family the engine plays (`"mod"`, `"s3m"`, `"xm"`, `"it"`); absent: the same as `format`. Set by the [other trackers](#more-tracker-formats) |
|
||||
| `title` | string | |
|
||||
| `channels` | number | pattern channels |
|
||||
| `speed`, `tempo` | number | initial ticks per row, and BPM (a tick lasts `2.5 / tempo` seconds) |
|
||||
@@ -314,9 +316,52 @@ assert(F.music.load(assert(F.save(xm))).instruments[1].name == "lead")
|
||||
| sf2 | yes | - | SoundFont |
|
||||
| ahx (AHX / THX), hvl (HivelyTracker) | yes | - | Module (own synth engine) |
|
||||
| mus (Doom), xmi (Miles XMIDI), hmp (HMP, HMI) | yes | - (save as midi) | Midi |
|
||||
| mtm (MultiTracker) | yes | - | Module (xm family) |
|
||||
| 669 (Composer 669, UNIS 669) | yes | - | Module (s3m family) |
|
||||
| stm (Scream Tracker 2) | yes | - | Module (s3m family) |
|
||||
| ult (UltraTracker) | yes | - | Module (it family) |
|
||||
| okt (Oktalyzer) | yes | - | Module (it family) |
|
||||
| med (MED / OctaMED MMD0..MMD3) | yes | - | Module (xm family) |
|
||||
| ptm (PolyTracker) | yes | - | Module (it family) |
|
||||
| far (Farandole Composer) | yes | - | Module (s3m family) |
|
||||
| umx (Unreal package) | yes | - | the embedded IT / S3M / XM / MOD Module |
|
||||
|
||||
See [FORMATS.md](../FORMATS.md) for each format's capabilities.
|
||||
|
||||
### More tracker formats
|
||||
|
||||
MultiTracker, Composer 669, Scream Tracker 2, UltraTracker, Oktalyzer, MED / OctaMED, PolyTracker and Farandole
|
||||
modules load as Modules too (ported from OpenMPT's loaders). Each keeps its own `format` name and plays through one of
|
||||
the four effect families (`engine`), with the format's quirks in `flags`: 669 and Farandole slide in Hz, Scream
|
||||
Tracker 2 has its own tempo byte, MED its tempo modes and hold / decay, Oktalyzer its mixed channel pairs. Their
|
||||
cells use the family's effect coding (an MTM cell reads like an XM cell, an OKT cell like an IT cell); a few effects
|
||||
of these formats have no family equivalent and use the engine's extension codes (0x40 and up: note slides, auto
|
||||
portamentos, ...).
|
||||
|
||||
```luau
|
||||
local song = assert(F.music.load(mtmBytes))
|
||||
assert(song.format == "mtm" and song.engine == "xm" and song.channels == 6)
|
||||
local med = assert(F.music.load(medBytes))
|
||||
assert(med.format == "med" and med.meta.source.version == "MMD1" and med.instrumentMode) -- hold / decay: instruments
|
||||
local audio = assert(F.ops.audio.toAudio(med:render({ sampleRate = 22050 })))
|
||||
assert(audio.frames > 0)
|
||||
```
|
||||
|
||||
An Unreal `.umx` package holds a module (usually IT, S3M or XM). `F.load` unwraps it and returns that module, with
|
||||
the package in `meta.container`; `F.format("umx").extract` lists the embedded modules without loading them.
|
||||
|
||||
```luau
|
||||
local m = assert(F.music.load(umxBytes))
|
||||
assert(m.format == "s3m" and m.meta.container.format == "umx" and m.meta.container.name == "theme")
|
||||
local list = assert(F.format("umx").extract(F.Bytes.reader(umxBytes)))
|
||||
assert(#list == 1 and list[1].format == "s3m")
|
||||
local dec = assert(F.open(umxBytes)) -- rendered, like any module
|
||||
assert(dec.channels == 2)
|
||||
```
|
||||
|
||||
These formats are read only. Their Modules render to audio like any other (`F.save(song, nil, { format = "wav" })`),
|
||||
and the module of an UMX keeps its own format, so `F.save(m)` works when that format has a writer (MOD, XM).
|
||||
|
||||
### AHX / HVL and MIDI variants
|
||||
|
||||
AHX and HivelyTracker modules carry no samples: their instruments are small synth programs (waveforms, filter and
|
||||
@@ -381,4 +426,6 @@ assert(table.concat(line) == "\\Hello /karaoke" and kar.meta.lyrics[2].time == 0
|
||||
- Without a SoundFont, MIDI plays on simple built-in waveforms, which is fine for testing but not General MIDI.
|
||||
SF3 banks (Ogg-compressed samples) are not supported.
|
||||
- Pattern cells keep the file's own effect numbering, which differs between MOD / XM (0..35) and S3M / IT (1..26).
|
||||
The other tracker formats use their engine family's numbering (`m.engine`), not their file's.
|
||||
- A Module's `meta.unsupported` lists what was read but plays silent (MED synth / hybrid / MIDI instruments).
|
||||
- A module's `duration` is one pass. `render({ loop = true })` keeps playing past it.
|
||||
Reference in new issue
Block a user