Anyway, i spent some time figuring out the music format, not fully of course but enough to get some idea of how it works.
The first channel of the intro tune ended up being a bit of a red herring, as it is silent for the duration of the track. Anyway...
Just to make things clear, the SH2 processor used in CPS3 is big endian. That means 16-bit values (and so on) are read with the most significant byte first. (opposite to Intel processors)
C0-FF are song commands. These are like MIDI CCs like pan, master volume and that stuff. Also includes loop and jump commands, but i haven't come that far. These take zero or more bytes as arguments.
80-BF plays a note with velocity. Subtract 80 from the first byte to get velocity, then the second byte is the note number (you mentioned that the title track uses an instrument with chopped samples, that is true and each part corresponds to a note in this case). Third (or fourth) byte contains the gate time (note duration). If this value is >80 then it should be read as 16-bit (2 bytes). Fourth (or fifth) byte is the note duration plus articulation.
Examples:
Code: Select all
bf 3c 81 40 01 40
play note C4 (0x3c) with velocity 63 (0xbf-0x80) for 320 (0x140) frames. Both gate time and note duration are read as 16-bit values if bit 7 is set.
c7 7f
set panning to 127 (full right)
b2 3e 18 24
play note D4 (0x3e) with velocity 50 (0xb2-0x80) for 24 (0x18) frames, then rest for 12 (0x24-0x18) frames.