Mega Man 3, 4, 5 and 6 is used the same audio engine. So these commands can be used in common.
These commands are based on macros/audio.asm, constants/audio.asm and audio/audio.asm
Note: Mega Man 6 audio engine just little different from 3, 4 and 5 audio engine (Initial SFX and relocate octave table program, Other is same.)
It includes 8 commands to use set an instrument. It must be set for every instruments fully.
Used for note from 0 to max volume rate.
n:
rate [00
, $1F
]
Used for note from max volume to sustain volume rate.
n:
rate [00
, $1F
]
Used for note sustain volume subtract n
from max volume
n:
subtraction volume [0
, $F
]
Used for note from sustain volume to 0 rate.
n:
rate [00
, $1F
]
Used for note vibrato rate.
Used for note pitch vibrato rate.
Used for note vibrato volume rate.
Used for set noise duty cycle.
n
: [0
, 1
]
Note: Unlike square 1 and 2, noise duty cycle must be effected from instruments.
These are available commands used from audio engine.
Set playing music instead of SFX.
Set notes play with 2/3 length. Used by all music channels.
Usage:
Start at the first note, end of the last note after playing.
example: TRIPLET_SET, NOTE, NOTE, NOTE, TRIPLET_SET
Note: It also effected by NOTE_FLAGS
and BREAK_n
commands.
Set connected notes are played. Used by all music channels.
Usage:
Start at the first note, end of the last note.
example: CONNECT_SET, NOTE, NOTE, CONNECT_SET, NOTE
Note: It also effected by NOTE_FLAGS
and BREAK_n
commands.
Set a note play with 1.5 length. Used by all music channels. It only effects current note.
Set notes play with increasing/decreasing 2 octaves. Used by square 1, 2 and triangle.
Once CMD_OCTAVE_JMP
flag is set, it's playing with higher 2 octaves. Unless this flag is NOT set.
Note: It also effected by NOTE_FLAGS
and BREAK_n
commands.
Set notes playing flags. Used by square 1, 2 and triangle. see constants/audio.asm:audio cmd constants. to set n
.
Set tempo for playing all music channels. It only used by square 1.
The formula to convert from TEMPO to BPM: BPM = 75 * (a + b/256).
Also this formula could calculate them: a = floor (BPM / 75), b = ceil ((BPM mod 75) / 75) * 256.
Set attack, decay and sustain total rate. Used by all music channels.
Set max volume for channel playing, it used by square 1, 2 and noise.
n:
[0
, $F
]
Set playing note with n
instrument. Used by all music channels.
Set playing note with base octave. Used by all music channels.
n:
[0
, 7
]
Set playing note with base global octave/note transpose. It only used by square 1.
Note: GLOBAL_TRANSPOSE
is effected square 1, 2 and triangle.
Set playing note with base global octave/note transpose. Used by square 1, 2 and triangle.
Note: Unlike GLOBAL_TRANSPOSE
, CHANNEL_TRANSPOSE
is only effected current channel if it's set.
Adjust playing notes pitch. Used by square 1, 2 and triangle.
Set notes play with pitch slide mode. Used by square 1, 2 and triangle.
Loop a branch of audio playing address with count
times. Used by all music channels.
LOOP_n
's n
is supproted [1
, 4
]
Note: count must be non zero. If count is zero, loop cannot be run well. Please use CHANNEL_JMP
commands.
Similar with LOOP_n count, address
, after finishing same n
, it jumps into the new address
. Used by all music channels.
note_flags is same as NOTE_FLAGS
's n
.
Jump to play address directly.
End of channel playing.
Set duty cycle for square channels. Used by square 1 and 2.
n:
[0
, 3
]
Note: unlike noise channel, noise channle must be set from instrument the last parameters.
Play a note. Used by all music channels.
note_name:
see constants/audio.asm:note_table..
Note: NOISE_NOTE note_name
is only played from 0
to $F
.
length
: Length of note be played, it only accept power of 2.
Accept length table: 1, 2, 4, 8, 16, 32, 64
. Other is NOT accept.
REST
and NOISE_NOTE
length both common usage.
Note: note relocated value also effected by OCTAVE_JMP
, NOTE_FLAGS
, BASE_OCTAVE
and BREAK_n
.
Some of SFX commands are common with music channel commands, but it has different setup usage. It must be set under the rules.
Set SFX playing priority, it must be set n
non zero.
See constants/audio.asm:audio sfx constants. to set n
.
- bit0 = SFX_CHANNEL_LOOP
- bit1 = SFX_ADS_FRACTION
- bit2 = SFX_GLOBAL_TRANSPOSE
Like LOOP_n count, address
, but count is allowed to 0 use for infinity loop.
It must be SFX_CHANNEL_GLOBAL_FLAGS
's n
bit0 set to use.
Same as NOTE_ADS_FRACTION n
, must be SFX_CHANNEL_GLOBAL_FLAGS
's n
bit1 set to use.
Same as GLOBAL_TRANSPOSE n
, must be SFX_CHANNEL_GLOBAL_FLAGS
's n
bit2 set to use.
Set SFX segment playing n
frames.
Set SFX playing channel.
- bit0 = square 1
- bit1 = square 2
- bit2 = triangle
- bit3 = noise
Set channel
commands_bits
total usage.
- bit0 = instrument
- bit1 = duty_cycle
- bit2 = max_volume
- bit3 = pitch_slide
- bit4 = pitch_tune
Like NOTE note_name
, but directly.
Note: Some of original game use it by accident, use SKIP_SFX_NOTE
ignore it.
If not set SFX_channel_NOTE n
to replace a note use this command, it continues playing on current segment.
End of SFX playing.