Using rests in a duration list of a CHORD-SEQ.
CHORD-SEQ, omloop,omif, om-abs,dx->x and remove
We have seen in tutorial22 the use of onset and duration lists. These concerned only plain durations. What if we wanted to use rests or an offset time for our rhythmical sequence? In this tutorial we will show a practical way in dealing with durations in milliseconds and this by using only one list of consecutive durations and rests. All the programing will be done inside an omloop method which will return correct onsets and durations.
A: After adding an input in our omloop (select + right arrow) for our incoming list of durations, we will use a listloop (A) in order to enumerate each member of this list and to test them to know if they are durations or rests (rests being negative integers).
B: In B we will construct the onset time of this list. We will use om-abs in order to transform negative integers into positive ones. Then using dx->x we will get the equivalent onsets of our initial list including our rests.
C: We will use two omif methods (D), one for onsets, the other for durations. These will be used as filters: If an element of our list is < 0 (meaning it is a rest), both omifs will return nil. If the first omif will return the onset time, the other returning the duration. This small trick is necessary because CHORD-SEQ doesn't recognize negative integers as rests.
Note: We could have used the om> predicate instead of om<. In this case you should connect the output of dx->x in the second input of omif instead of the third one, and the same with the second omif method.
D: The results will be collected in two collect objects.
E: Here two remove lisp functions are used to remove every nil result collected.
G: We will add an extra input to eachtime and finally objects (select + alt-left arrow) in order to have two outputs. The first one will be connected to the onsets input of CHORD-SEQ and the second one into the fourth input of CHORD-SEQ , the duration slot.
The result will be:
the first note starting after 1000 millisecond. Both notes are separated by a 1000 milllisecond rest.