mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-06-06 13:38:30 +09:00
tracker impl, s3m converter, larger tracker sample bin
This commit is contained in:
107
terranmon.txt
107
terranmon.txt
@@ -1985,25 +1985,25 @@ Synchronisation between playheads are not guaranteed. Do not play music in multi
|
||||
|
||||
Memory Space
|
||||
|
||||
0..114687 RW: Sample bin
|
||||
114688..131071 RW: Instrument bin (256 instruments, 64 bytes each)
|
||||
131072..196607 RW: Play data 1
|
||||
196608..262143 RW: Play data 2
|
||||
262144..327679 RW: TAD Input Buffer
|
||||
327680..393215 RW: TAD Decode Output
|
||||
0..770047 RW: Sample bin (752k)
|
||||
770048..786431 RW: Instrument bin (256 instruments, 64 bytes each; 16k)
|
||||
786432..851967 RW: Play data 1 (currently exposed bank; 64k)
|
||||
851968..917503 RW: Play data 2 (currently exposed bank; 64k)
|
||||
917504..983039 RW: TAD Input Buffer (64k)
|
||||
983040..1048575 RW: TAD Decode Output (64k)
|
||||
|
||||
Sample bin: just raw sample data thrown in there. You need to keep track of starting point for each sample
|
||||
|
||||
Instrument bin: Registry for 256 instruments, formatted as:
|
||||
Uint16 Sample Pointer
|
||||
Uint16 Sample length
|
||||
Uint16 Sampling rate at C3
|
||||
Uint16 Sampling rate at C3 (note number 0x4000)
|
||||
Uint16 Play Start (usually 0 but not always)
|
||||
Uint16 Loop Start (can be smaller than Play Start)
|
||||
Uint16 Loop End
|
||||
Bit32 Flags
|
||||
0b hhhh 00pp
|
||||
h: sample pointer high bit (only the lowest bit is used, keep upper 3 bits unset)
|
||||
h: sample pointer high bit
|
||||
pp: loop mode. 0-no loop, 1-loop, 2-backandforth, 3-oneshot (ignores note length unless overridden by other notes)
|
||||
Bit16x24 Volume envelopes
|
||||
Byte 1: Volume
|
||||
@@ -2012,7 +2012,7 @@ Instrument bin: Registry for 256 instruments, formatted as:
|
||||
Play Data: play data are series of tracker-like instructions, visualised as:
|
||||
|
||||
rr||NOTE|Ins|E.Vol|E.Pan|EE.ff|
|
||||
63||FFFF|255|3 63|3 63|FF FFFF| (8 bytes per line, 512 bytes per pattern, 256 patterns on 128 kB block)
|
||||
63||FFFF|255|3 63|3 63|FF FFFF| (8 bytes per line, 512 bytes per pattern, 128 patterns on 64 kB bank, 32 banks available (pattern 0xFFF -- bank 31, pattern 127 is a sentinel value for no-pattern))
|
||||
|
||||
notes are tuned as 4096 Tone-Equal Temperament. Tuning is set per-sample using their Sampling rate value.
|
||||
|
||||
@@ -2025,13 +2025,19 @@ note 0x0000: key-off
|
||||
|
||||
Sound Adapter MMIO
|
||||
|
||||
0..1 RW: Play head #0 position (how many samples has been queued)
|
||||
0..1 RW: Play head #0 position
|
||||
PCM mode: number of buffers uploaded and received by the adapter (writing does nothing)
|
||||
Tracker mode: current position in the cuesheet (writing changes current position in the cuesheet and resets pattern cursor back to zero)
|
||||
2..3 RW: Play head #0 length param
|
||||
PCM mode: length of the samples to upload to the speaker
|
||||
Tracker mode:
|
||||
Byte 2: Play data 1 bank
|
||||
Byte 3: Play data 2 bank
|
||||
4 RW: Play head #0 master volume
|
||||
5 RW: Play head #0 master pan
|
||||
6..9 RW: Play head #0 flags
|
||||
6..9 RW: Play head #0 flags (see below)
|
||||
|
||||
10..11 RW:Play head #1 position (how many samples has been queued)
|
||||
10..11 RW:Play head #1 position
|
||||
12..13 RW:Play head #1 length param
|
||||
14 RW: Play head #1 master volume
|
||||
15 RW: Play head #1 master pan
|
||||
@@ -2043,17 +2049,16 @@ Sound Adapter MMIO
|
||||
Write 16 to initialise the MP2 context (call this before the decoding of NEW music)
|
||||
Write 1 to decode the frame as MP2
|
||||
|
||||
When called with byte 17, initialisation will precede before the decoding
|
||||
Calling with more than one bit set will result in UNDEFINED BEHAVIOUR
|
||||
|
||||
41 RO: MP2 Decoder Status
|
||||
Non-zero value indicates the decoder is busy
|
||||
|
||||
Non-zero value indicates the decoder is busy. Different value may indicate different decoder status.
|
||||
42 WO: TAD Decoder Control
|
||||
Write 1 to decode TAD data
|
||||
43 RW: TAD Quality
|
||||
Must be set to appropriate value before decoding
|
||||
44 RW: TAD Decoder Status
|
||||
|
||||
Non-zero value indicates the decoder is busy. Different value may indicate different decoder status.
|
||||
45 RW: Select PCM Bin for playhead (writing causes side effects)
|
||||
|
||||
64..2367 RW: MP2 Decoded Samples (unsigned 8-bit stereo)
|
||||
@@ -2065,14 +2070,6 @@ Sound Hardware Info
|
||||
- Bit depth: 8 bits/sample, unsigned
|
||||
- Always operate in stereo (mono samples must be expanded to stereo before uploading)
|
||||
|
||||
Play Head Position
|
||||
- Tracker mode: Cuesheet Counter
|
||||
- PCM mode: Number of buffers uploaded and received by the adapter
|
||||
|
||||
Length Param
|
||||
PCM Mode: length of the samples to upload to the speaker
|
||||
Tracker mode: unused
|
||||
|
||||
Play Head Flags
|
||||
Byte 1
|
||||
- 0b mrqp ssss
|
||||
@@ -2117,18 +2114,20 @@ Play Head Flags
|
||||
If the queue is full, any more uploads will be silently discarded.
|
||||
|
||||
|
||||
32768..65535 RW: Cue Sheet (2048 cues)
|
||||
Byte 1..15: pattern number for voice 1..15
|
||||
Byte 16: instruction
|
||||
1 xxxxxxx - Go back (128, 1-127) patterns to form a loop
|
||||
01 xxxxxx -
|
||||
001 xxxxx -
|
||||
0001 xxxx - Skip (16, 1-15) patterns
|
||||
00001 xxx -
|
||||
000001 xx -
|
||||
0000001 x -
|
||||
0000000 1 -
|
||||
0000000 0 - No operation
|
||||
32768..65535 RW: Cue Sheet (1024 cues)
|
||||
Byte 1..10: Pattern number low nybble for voice 1..20
|
||||
Byte 11..20: Pattern number middle nybble for voice 1..20
|
||||
Byte 21..30: Pattern number high nybble for voice 1..20
|
||||
To recap:
|
||||
Byte 1..10: 0b loV1 loV2, 0b loV3 loV4, 0b loV5 loV6, ... 0b loV19 loV20
|
||||
Byte 11..20: 0b miV1 miV2, 0b miV3 miV4, 0b miV5 miV6, ... 0b miV19 miV20
|
||||
Byte 21..30: 0b hiV1 hiV2, 0b hiV3 hiV4, 0b hiV5 hiV6, ... 0b hiV19 hiV20
|
||||
Byte 31..32: instruction
|
||||
1000xxxx yyyyyyyy - Go back 0bxxxxyyyyyyyy patterns
|
||||
1001xxxx yyyyyyyy - Skip forward 0bxxxxyyyyyyyy patterns
|
||||
1111xxxx yyyyyyyy - Go to absolute pattern number 0bxxxxyyyyyyyy
|
||||
00000001 - Halt
|
||||
00000000 - No operation
|
||||
|
||||
65536..131071 RW: PCM Sample buffer
|
||||
|
||||
@@ -2168,7 +2167,43 @@ Table of 3.5 Minifloat values (CSV)
|
||||
11111,0.96875,1.96875,3.9375,7.875,15.75,31.5,63,126
|
||||
LSB
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Taud serialisation format
|
||||
|
||||
This is a file format for Taud tracker data.
|
||||
|
||||
# File Structure
|
||||
\x1F T S V M a u d
|
||||
[HEADER]
|
||||
[SAMPLE+INSTRUMENT BIN IMAGE (GZip or Zstd compressed. Read 4-byte magic to determine)]
|
||||
[SONG TABLE]
|
||||
[PATTERN BIN for SONG 0]
|
||||
[CUE SHEET for SONG 0]
|
||||
[PATTERN BIN for SONG 1]
|
||||
[CUE SHEET for SONG 1]
|
||||
[PATTERN BIN for SONG 2]
|
||||
[CUE SHEET for SONG 2]
|
||||
...
|
||||
|
||||
## Header
|
||||
Byte[8] Magic
|
||||
Uint8 Format version (always 1)
|
||||
Uint8 Number of songs in SONG TABLE
|
||||
Uint32 Compressed size of SAMPLE+INST section (used to calculate offset to SONG TABLE)
|
||||
Uint16 Reserved for future versions
|
||||
Byte[16]Tracker/Converter signature
|
||||
|
||||
## SONG TABLE
|
||||
Rows of 16 bytes:
|
||||
Uint32 Song offset
|
||||
Uint8 Number of voices
|
||||
Uint16 Number of patterns (0 is invalid. pattern bin length = numPats * 8 bytes)
|
||||
Uint8 Initial BPM (bias of -24. 0x00=24, 0xFF=280)
|
||||
Uint8 Initial Tickrate(0 is invalid)
|
||||
Byte[7] Reserved for future versions
|
||||
|
||||
Taud device can queue up to 2 "playdata" in its buffer, which can be interpreted as a song.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user