Similar to beat but it reacts immediately to tempo changes.
This requires the ability of ALSA to cancel sent Echo messages
and it requires to know the precise time points of tempo changes,
thus we need the Discrete input instead of Behaviour
and we need a behaviour for the current time.

This process simulates playing chords on a guitar.
If you press some keys like C, E, G on the keyboard,
then this process figures out what tones would be played on a guitar.

Call it like guitar stepTime chords triggers.

stepTime is the delay between to successive notes.
A good value is 0.03 (seconds).
The chords to be played are passed in by chords.
This should be the output of pressed.
Further on the function needs events
that trigger playing the chord in trigger argument.
The trigger consists of the trigger time
and the direction to be played
(True = down from high to low pitches,
False = up from low to high pitches).
The trigger may be derived from a specific key that is pressed and released,
or two keys, one for each direction.

Play sets of notes and
let the human player answer to them according to a given scheme.
Repeat playing the notes sets until the trainee answers correctly.
Then continue with other sequences, maybe more complicated ones.

possible tasks:

replay a RBU.sequence of pitches on the keyboard:
single notes for training abolute pitches,
intervals all with the same base notes,
intervals with different base notes

transpose a set of pitches:
tranpose to a certain base note,
transpose by a certain interval

play a set of pitches in a different order:
reversed order,
in increasing pitch

replay a set of simultaneously pressed keys

The difficulty can be increased by not connecting
the keyboard directly with the sound generator.
This way, the trainee cannot verify,
how the pressed keys differ from the target keys.

Sometimes it seems that you are catched in an infinite loop.
This happens if there were too many keys pressed.
The trainer collects all key press events,
not only the ones that occur after the target set is played.
This way you can correct yourself immediately,
before the target is repeatedly played.
The downside is, that there may be key press events hanging around.
You can get rid of them by pressing a key again and again,
but slowly, until the target is played, again.
Then the queue of registered keys should be empty
and you can proceed training.

Use a MIDI controller for selecting a note from a key set.
Only the pitch class of the keys is respected.
The controller behavior must be in the range 0-127.
This way, it accesses the whole range of MIDI notes.
The output note is stopped and a new note is played
whenever turning the knob alters the note pitch.
The advantage of the effect is that the pitch range of the knob
does not depend on the number of pressed keys.
The disadvantage is that there a distinct distances between the pitches.