Expand description
The two containers: a song (PSQ1) and a bank set (PSQB).
A song is the sequence bytecode, byte for byte, behind a short header. The bytecode keeps its original big-endian operands and absolute offsets, because jumps, calls, layer loads and envelope pointers all refer to positions inside it. The header is little-endian.
0 "PSQ1"
4 u16 version = 1
6 u16 flags bit0 patches itself, bit1 reads IO, bit2 uses runseq
8 u8 n_fonts u8 peak_voices u16 code_len u16 channels_used u16 reserved
16 u8 font_id[n_fonts] padded with zeros to a multiple of 4
.. bytecode (code_len bytes)A bank is everything a scene’s songs play: instrument and drum tables, envelopes, a sample table and the SPU-ADPCM data, laid out so the ADPCM region goes to SPU RAM in one transfer. All little-endian except the envelope words, which keep the bytecode’s big-endian layout so a song’s own envelopes and the bank’s read through one reader.
0 "PSQB" u16 version = 1 u16 flags u32 total_bytes
12 u16 n_fonts u16 n_samples u16 n_env_words u16 reserved
20 u32 off_fonts u32 off_samples u32 off_env u32 off_adpcm u32 adpcm_bytes
FontDesc[n_fonts] (12 B) u8 id, u8 n_inst, u8 n_drum, u8 pad, u32 off_inst, u32 off_drum
InstDesc (32 B) u8 lo, u8 hi, u8 decay, u8 present, u16 env, u16 pad,
3 x { u16 sample, u16 pad, u32 tuning_q16 } (low, normal, high)
DrumDesc (16 B) u8 decay, u8 pan, u16 env, u16 sample, u16 present, u32 tuning_q16, u32 pad
SampleDesc (16 B) u32 adpcm_off, u32 end_samples, u16 blocks, u16 rate_hz, u16 loop_block, u16 flagstuning_q16 already includes the ratio of the original 32 kHz playback
rate to the cooked rate and the loop-stretch correction, so the runtime
multiplies one number. 0xFFFF means “none” for sample and envelope
indices.
Structs§
- Bank
- A parsed bank.
- Drum
- A drum.
- Instrument
- An instrument.
- Sample
Info - One cooked sample.
- Song
Header - The parsed header of a song.
- Tuned
- A sample and its tuning, as an instrument or drum names it.
Enums§
- Format
Error - Reasons a container is rejected.
Constants§
- BANK_
MAGIC - Bank magic.
- FLAG_
SELF_ MODIFYING - Song flag: the bytecode writes to itself.
- NONE16
- “No sample” / “no envelope” marker.
- SONG_
MAGIC - Song magic.