Use Non-Frames Version Previous Page Next Page
Appendix: DirectCsound

Score Loops

  {  num NN

     ...... body........

  }

Description

Loop sections of score.

Initialization

{ - start of a loop

} - end of a loop

Performance

Score loops are a very powerful tool. Derived from repeats (r opcode), they may define any parameter, and the score events inside the loop, are not separated by a section terminations in each iteration. Thus it is possible to implement overlapping loops. Loops can be nested.

The syntax is similar to that of repeats: the macro $NN is incremented with each iteration. Notice that, unlike repeats, the count starts with a zero value. The number argument must be set to the number of iterations.

NB: The exponential ramp symbol has been changed to '(' or ')' in order to allow curly-brace characters to be used for loops.

Example

{ 10 nn
	i1	[$nn/2]  .5  [$Line(10, $nn , 10000, 4000)]  [$Line(10,$nn,440,110)]
	{ 5 bb
		i1 [$nn/2+$bb/10] .1 [(1+$nn/4)*$Line(10 , $bb, 2000, 500)] [$Line(10,  $bb, 400, 600)]
	}
}

Use Non-Frames Version Previous Page Next Page
Appendix: DirectCsound