Users Manual

CLASS 4
90
TORI Piano playback coding
Let’s continue with the explanation for the script on the previous page.
Should we take a look into the script inside the ‘repeat to~’ block? The timer is initialized and continues to flow
when it is played. And wait until the timer is larger than the item value of 'Beats' pointed to by the value stored
in 'Pointer' (initially 1). The moment it gets bigger, it gets out of the ‘waiting’ block. After that, if the item value in
‘note’ list that is pointed by ‘pointer’ is ‘C’, you will play 60th notes.
Do you understand? Let me give you an example to help you understand. Assume that the files recorded in the
pre-recorded file include 'C' in the item at position 1 in the 'note' list, '3.000' in the item at position 1 in the 'Beats'
list, and the total number of items in both lists is 10. Try it. When playback starts, the first 'pointer' is set to 1, and
the timer is initialized and continues to flow.
Now let’s go to ‘repeat to ~’ block. Repeat the inner script until the total number of item in ‘Beats’ is less than the
value stored in ‘pointer’ variable. Currently, the total number of item in ‘Beats’ is 10, and the ‘pointer’ value is 1,
which satisfies the condition. Now you are running an internal script. The “Wait until ‘Timer> Beats ‘pointer’ posi-
tion item’” block means that the timer that is running now is waiting for the current timer to be larger than the
item in the ‘pointer’ position in the ‘Beats’ list. Currently, the value of 'pointer' is 1, which means that the timer
waits until it is larger than the item at position 1 in the 'Beats' list (3.000 seconds). As the timer goes down, the
moment you pass '3.000' seconds, you exit the 'Waiting' block. And compare it to the condition of the if block. If
it satisfies the condition, it plays 60th note.
The whole script can be found at http://www.robotori.com/web_eng -> Moretips -> Man-
ual ->EDU ->Logic boost CODING CLASS 4 ->download whole script
TORI Piano coding activity