Csound Csound-dev Csound-tekno Search About

r statement (Re: simple repeat command? HOW?)

Date1999-03-07 02:52
Fromrasmus ekman
Subjectr statement (Re: simple repeat command? HOW?)
SONICMAN wrote:
> 
> How would I have a line in a score repeat say 10, 20, 30 times? 

For simple repetitions you can fake it with the r statement.
You get a counter with it. This actually repeats score *sections*, 
which limits the processing in some ways, but it does what you ask for. 
See the file Version3_48.Notes at bath/newest for info and example. 

Something like this:

r42 COUNT               ; "COUNT" will change value 1...42 for each repetition
i1 0 3 $COUNT.          ; p4 gets COUNT value in instr 1
i2 .5 1.5 75 $COUNT.    ; p5 gets COUNT value
s                       ; end of repeated section

Note that COUNT is a macro variable (works by textual replacement when 
the score file is read, ie before the csound score parser "actually" 
gets to see the score), so you use it with the dollar macro usage prefix.


Date1999-03-07 04:07
FromBill DeWitt
SubjectRE: r statement (Re: simple repeat command? HOW?)
Now this is good. I think one could go a long way with this. I would like to
see some more examples if anyone has them, but so far it looks good! I am
having a little trouble with the [math] thing that I would like to use, but
everything else is all I could have expected. (I can't seem to get it to
recognize a macro inside brackets, and it won't do math with the macro
without brackets i.e.: [COUNT*3] gives me an undefined macro name error and
COUNT*3 gives me the value zero)

Now I am going to look at the #include and #macro sections to see what else
might be done.

BTW, since I was using the online version of The CSound Manual
 http://emu.music.ufl.edu/csman/TITLE.html ) it's no wonder I couldn't find
the method! Thanks for pointing out the newer versions!


> For simple repetitions you can fake it with the r statement.
> You get a counter with it. This actually repeats score *sections*,
> which limits the processing in some ways, but it does what you ask for.
> See the file Version3_48.Notes at bath/newest for info and example.
>
> Something like this:
>
> r42 COUNT               ; "COUNT" will change value 1...42 for
> each repetition
> i1 0 3 $COUNT.          ; p4 gets COUNT value in instr 1
> i2 .5 1.5 75 $COUNT.    ; p5 gets COUNT value
> s                       ; end of repeated section
>
> Note that COUNT is a macro variable (works by textual replacement when
> the score file is read, ie before the csound score parser "actually"
> gets to see the score), so you use it with the dollar macro usage prefix.
>