<div dir="ltr"><p class="">Hello list,<br><br>   I’m working on translating some old CM code and am stumbling on how to do a case statement in Grace. I’m giving a pared-down example. Currently the problems (likely all related) are:<br></p>
<p class="">1. I do get one note out (yay) in addition to the error:</p>
<p class="">&gt;&gt;&gt; Error: attempt to apply the integer 1 to ({s7-error}-11 80 8.1 #&lt;unspecified&gt; 8.1 8.1 {s7-error}-11 {s7-error}-11)?</p><p class="">casethejoint: (ffi_cm_print args)                 ; args: (&quot;attempt to apply ~A ~S t...</p>
<p class="">casethejoint: ((set! {v}-567 (+ {v}-567 1)) {w...</p>
<p class="">casethejoint: (call-with-exit (lambda (return)... ; thecase: 0, newdur: 8.1</p>
<p class="">                                                   ; newkeynum: 80</p>
<p class="">                                                   ; waittime: 8.1</p>
<p class="">                                                   ; thetime: 8.1</p>
<p class="">casethejoint: (sprout (casethejoint))          </p>
<p class="">No success single quoting. </p>
<p class="">2. It seems to always pick the second case, whether “thecase” picks 0 or 1, or whether I switch the numbers (make case 1 come first and case 0 second).</p>
<p class="">3. When I use the commented line (process while (&lt;= theme 100) to control the length of the process, it is clear that time doesn’t update. (This update method works fine when not part of the attempted case statement.)</p>
<p class="">Any leads on documentation appreciated—I’ve been through the examples that come with Grace, and of course, the online documentation, without success. </p><p class="">Please pardon the formatting and many thanks for any tips. </p><p class="">;;; -*- syntax: Lisp; font-size: 16; line-numbers: no; -*-</p>(define speeds (make-cycle &#39;(0.2 0.3 0.4 0.2 4 3.5 1 1.2 2.4 3.9 0.3 8.2 7.8 5.2 0.2 5.4 3.4 5.8 6.1 2.2 4.8 2.4 0.3 4.7 4.4 4.4 0.1<br>7.2 3.7 9 1.8 10.1 4.2 4.6 4.9 4.8 1.9 4.8 0.9 5.6 3.5 3 3.6 3 4.3 2.8 5.5 5.6 5.1 1.2 1.2 7.6 5.6 5<br>3.5 3.1 4.6 3 4.2 4.4 4.4 5.8 3.4 4.9 3.9 0.2 9.2 12.5 5 0.5 3.6 6.2 11.9 11.3 1.2 0.3 2.3 1.9 2.5 4.7<br>3.6 3.9 3.6 0.4 6.9 2.3 2.6 2.5 4.3 4 4.1 1 0.7 8 3.3 2 5.8 3.4 2 4.8 0.4 8.8 1.6 0.4 6.6 5.1 2.5 6.2<br>6.3 0.3 7.1 8.3 10.7 13.3 3.8 6.3 0.4 2.8 5.6 1.1 10.5 4.3 0.2 4.2 2.8 1.8 6 5.5 3 7.7 1.7 8.4 11.5<br>5.5 1.3 2.4 0.1 8 5.2 2.8 2.1 5.4 2.8 3.9 4.9 3.2 0.4 5.8 0.4 6 4.5 4.4 1.7 4.6 3.4 1.2 6.1 7.1 0.1 2<br>1.3 0.8 1.6 5.1 5.9 6 0.5 3.3 0.8 3.9 2.2 5 5.4 4 1.8 4.1 5.6 2.5 4 5 2.7 0.6 8.1 2.2 3.2 3.9 4.1 3.1<br>1.5 0.3 0 0.1 0.4 0.4 2.3 3.3 2.3 1.5 4.3 4.4 3.9 2 4.8 4.1 3.8 1.7 5.6 4.5 2.5 1.8 7.1 2.1 2.3 1.5 0.5<br>1 0.9 3.2 0.3 0.1 0.2 0 )))<div><br>(define (casethejoint)<br>(let* (<div>      (currenttime 0)<br>       (newkeynum 0)<br>       (waittime 0)<br>       (thetime 0)<br>       (newdur 0)<br>       (thecase 0)<br>      )<br><br> ;(process  while (&lt;= thetime 100) ;--&gt;time not currently updating, making this potentially dangerous <br><br>(process repeat 50<br>         do<br>         (set! thecase (pick 0 1))<br>         (print &quot;thecase is&quot;) (print thecase)<br>         (set! newdur (next speeds))<br>;append ;--&gt;was necessary in the old code<br>         (case thecase    <br>           (        <br>               (0<br>                 (print &quot;case is 0&quot;)<br>                 (set! newkeynum (between 40 42))<br>                 (set! waittime newdur)<br>                 (mp:midi :key  newkeynum)<br>                 (wait waittime)<br>                 (set! thetime (+ thetime waittime))<br>                 (print &quot;thetime is&quot;)  (print thetime)<br>                 )<br><br>                (1<br>                 (print &quot;case is 1&quot;)<br>                 (set! newkeynum  (between 80 82))<br>                 (set! waittime newdur)<br>                 (mp:midi :key  newkeynum)<br>                 (wait waittime)<br>                 (set! thetime (+ thetime waittime))<br>                 (print &quot;thetime is&quot;)  (print thetime)<br>                 )<br>           )<br>           )<br>         )<br>)<br>)<br><br><br>(sprout (casethejoint))<p class="">







































































</p><p class=""><br></p><p class=""><br></p></div></div></div>