Well… section A simple, algorithmic, midi follower is still to be written
In the file midi_follower.asco.txt (4.5 KB) there is a simple algorithmic midi follower. The example is monophonic but can be easily extended to handle chords. There are three advantages with the approach developed in this file.
- You write your score as usual in antescofo.
You launch a ::midi_follower($XXX)
process in your score when you want to take midi events into account, and you specify with $XXX
when it should stop (uncomment the TEST part and you will see how it how it works). This allows you to switch between normal tracking and algorithmic midi tracking if needed.
To specify the posiion (in beat) where the midi follower should stop, we use the following trick: the position of a musical event with a label XXX
is denoted by $XXX
if this variable is not used elsewhere in the score.
The events to follow are received by the variable $pitch_in
which receives the midi note from Max via a message setvar.
Take a look at function @make_pitch_tab to understand how we access to the list of the pitches of the musical events in the score.
- There is no difference in transport management.
As the midi score is rendered by the antescofo score, you can use antescofo::nextevent
during the performance to advance antescofo in case the musician missed a note, use start_from as you like during rehearsals, etc.
- This algorithmic midi follower manages a notion of error.
If we receive the the right midi note, we do nextevent. Otherwise, we go into error mode and wait for the next notes. In error mode, we accept all the notes from the current note up to a horizon (here defined as 2 notes ahead). If the note sent is one of these two notes, we advance to the note to the received note and continue in normal mode.
You can easily invent other strategies according to your needs, or deactivate this management.
The score handled here is monophonic (only NOTE as musical events). You can make evolve the algorithmic midi follow-up to treat the CHORDs (for example one can wait 2/3 of the notes of the chord starting from the the first note received from the chord, in a time which corresponds to the half of the duration of the chord). This is not done in the current example.
Handling TRILL or MULTI is more problematic. You can “unfold” such event “by hand” to have only NOTEs and CHORDs.
Hope this helps.