(new on OpenMusic, maybe the code already exists somewhere or the question has already been asked)
In OpenMusic I would like to reproduce the 1st example found in Grace/Scheme tutorial (Common Music http://commonmusic.sourceforge.net/ by Heinrich TAUBE):
; Steve Reich’s Piano Phase
(define (piano-phase endtime keys rate)
with pat = (make-cycle keys)
while (< (elapsed) endtime)
(mp:midi :key (next pat) :dur rate)
(keynums (keynum '(e4 fs4 b4 cs5 d5 fs4 e4 cs5 b4 fs4 d5 cs5)))
(piano-phase stoptime keynums .167)
(piano-phase stoptime keynums .170)
There are several elements that I can’t reproduce (I don’t know if it’s possible anyway):
1- The musical notation “(e4 fs4 b4 cs5 d5 fs4 e4 cs5 b4 fs4 d5 cs5)” instead of (6400 6600…)
2- Time management in a loop " while (< (elapsed) endtime "
3- Patterns with infinite repetition “(make-cycle keys)”
4- Launching tasks (“sprout” in Grace) with time shift “(piano-phase stoptime keynums .167)” followed by “(piano-phase stoptime keynums .170)” which is fundamental in the Reich’s piece.
5- Calling midi functions with various parameters “(mp:midi :key (next pat) :dur rate :amp 0.8 )”
In Grace (Scheme), it’s really very very simple (a lot of things are missing, but the language remains very concise).
Looking forward to your answers.
Thanks in advance.
Translated from french with www.DeepL.com/Translator (free version)