-
Notifications
You must be signed in to change notification settings - Fork 3
MIDI Customizations
Unfortunaltely, MIDI is very old and limited, esp. when wanting to use it to recreate soundtracks from videogames:
- MIDI doesnt support loop markers
- Allow overlapping notes
- MIDI is limited to 16 channels
To handle those issues, ANMP tweaks the MIDI standard in a special way described below.
ANMP supports making use of individually looped midi tracks. This can be achieved by inserting midi controllers 102 (loop start) and 103 (loop end) into a track. In-between these two CCs, all events in the corresponding midi track and for the corresponding midi channel (i.e. midi channel from CC 102 and CC 103) get looped.
How these controllers have to be inserted, is described in detail in the Nintendo 64 SDK section 20.5.1 Loops in the Sequence. However ANMP does currently (Nov. 2016) not support CC 104 (i.e. loop count) and will probably also never support CC 105.
Note: The longest loop found inside a MIDI will be used as master loop, i.e. for looping back the playhead (might not always be correct, but mostly works pretty well).
ANMP uses fluidsynth for MIDI synthesization. Using fluidsynth's API in a naive manner would kill notes that are playing on the same key and channel (i.e. overlapping).
ANMP stacks notes on top of each other (LIFO treatment), i.e. it makes sure, that the first noteon is switched off by the last noteoff, the second noteon is switched off by the second last noteoff, etc.
NOT YET IMPLEMENTED!
Idea: Let each midi track play on its own channel. Therefore MIDI CCs dont update on midi channel but only on the track they are in. NoteOns dont trigger on their channel, but for their track. (TODO: verify that this works for BanjoTooie). To remain backward compatibility to usual midi files, name those specially treated midi files .mid64 or .midi64 (because this method will initially be used for midi files that were taken from the N64)