112
edits
Changes
Jump to navigation
Jump to search
Add description of custom instrument map
=== Channel Commands [AKAO Opcodes] ===
For every channels in an AKAO sequence, there is a set of commands to perform. This is similar to Field opcodes. Here I will call this sound commands "opcodes". Every opcode has its own number of arguments.
=== Custom Instrument Map Table ===
When a song uses custom instruments with [[FF9/Sound/Opcodes/0xfe14|opcode 0xFE 0x14]], a custom instrument map table will be placed after the end of AKAO opcode sequence.
This table consists of a collection of zones representing performance settings for a particular key range. A zone is an 8-byte item, and an instrument can have one or more regions.
struct AkaoInstrumentZoneAttr
{
uint8_t instrument; // corresponding to opcode 0xA1
uint8_t low_key; // lowest key (in note number)
uint8_t high_key; // highest key (in note number)
uint8_t ar; // ADSR: attack rate (0-127)
uint8_t sr; // ADSR: sustain rate (0-127)
uint8_t s_mode; // ADSR: sustain mode (1: linear increase, 3: linear decrease, 5: exponential increase, 7: exponential decrease)
uint8_t rr; // ADSR: release rate (0-31)
uint8_t volume; // adjust the note volume to n/128 of the original volume (0 will keep the original volume)
}
- Zones must be ordered from low key to high key
- The final zone of the instrument must be a terminator filled with 0s (more precisely, a zone with ADSR sustain mode of 0 is considered a terminator)
=== Drum Instrument Map Table ===
uint8_t sr; // ADSR: sustain rate (0-127)
uint8_t s_mode; // ADSR: sustain mode (1: linear increase, 3: linear decrease, 5: exponential increase, 7: exponential decrease)
uint8_t rr; // ADSR: release rate (0-12731)
uint8_t volume; // adjust the percussion volume to n/128 of the original volume (0 will keep the original volume)
uint8_t pan : 7; // corresponding to opcode 0xAA