Tutorial 29 - MIDI II:

Channel parsing


Converting a standard MIDIfile into a CHORD-SEQ with correct microintervals.


Functions used

MIDIFILE, omloop, om-if, repeat-n.




Most of commercial MIDI sequencers don't support microintervals. When working with these environnments, one must use multichannels in order to simulate microintervals, by "pitchbending" specific channels as it is done automatically in Openmusic. In this tutorial we will show how to convert one of these Midifiles into a CHORD-SEQ whicih will play correct microintervals.

Patch structure

In our example we have created deliberatly a simple multitrack MIDIfile. It represents a chromatical segment of a scale in 1/4 th of a tone starting from C3. The first MIDI track is on channel 1 which is the normaly tuned track, and the second oneon the second channel which is supposed to be tuned 1/4th of a tone higher.


A: The MIDIfile is openned (or dragged into an OpenMusic patch.


Each color represents a different MIDI channel. (Here blue= channel 1- green=channel 2

B: Now if we open the CHORD-SEQ (B) editor and check the <chan> popup menu, we can see each note's channel.


C: In the first omloop (C) we will use omif in order to 'correct' each note, and turn it into the right pitch:


D: Again , in case we are dealing with chords we have to calculate their corresponding onsets. That is, because we have dealt in C with chords note by note. Outputing the corresponding onset to each note will automatically merge all notes falling on the same onset in a chord. You may have noticed that the <lonsets> is a simple list output. Each element reffers to a note or a chord.


E: Durations is a list of lists. Each integer is a duration to single note . So all we have to do is flaten tyhe list using the flat function.

F: After this computation the result will look like this:

Each note is correctly parsed to the right channel according to its tuning.

Of course this tutorial shows a cery particular case, but is useful if you want to use channel parsing. All you have to do is change the predicate in the C loop and its arguments.