Skip to content

MIDI Customizations

Tom M edited this page Aug 28, 2017 · 12 revisions

Unfortunaltely, MIDI is very old and limited, esp. when wanting to use it to recreate soundtracks from videogames:

  1. MIDI doesnt support loop markers
  2. Allow overlapping notes
  3. MIDI is limited to 16 channels

To handle those issues, ANMP tweaks the MIDI standard in a special way described below.

1. Supporting loop markers

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).

2. Allow overlapping notes

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 handles notes in a FIFO way, i.e. it makes sure, that the first noteon is killed by the first noteoff.

3. Supporting more than 16 channels

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)

Clone this wiki locally