| Well, you can trigger score events in an instrument, and use if and
loop statements for these events, for example:
IF:
-odac
ksmps=128
instr 1
ktrig random 0, 1
if ktrig > 0.99 then; if ktrig
event "i", -1, 0, -1; turn off previous instance of i1
kfreq random 400, 800; calculate new frequency
event "i", 1, 0, -1, kfreq; turn on next instance of i1
endif
asin oscils 0dbfs/10, p4, 0
aenv linenr asin, .01, .1, .01
out aenv
endin
i 1 0 -1 400
e 3600
or LOOP (for):
-odac
seed 0
instr 1
inum=1
loop:
idur random 5, 10
iranddev random -inum/10, inum/10
event_i "i", 2, 0, idur, (inum+iranddev)*55
loop_lt inum, 1, 11, loop
endin
instr 2
asin oscils 0dbfs/10, p4, 0
aout linen asin, p3/2, p3, p3/2
out aout
endin
i 1 0 .1
e
But I don't know if this has something to do with your question ...
ciao -
joachim
Am 24.01.2010 um 00:13 schrieb Christopher Micallef:
> Thanks Chuck :)
>
> Just as I thought. Bit of a shame :-/ it would be nice to use if
> statements and for loops in the score.
>
> On 24/01/2010, at 10:00 AM, "Chuckk Hubbard"
> wrote:
>
>> Loops, yes; look under score statements and check both r statements
>> and { and } statements in the manual; {---} loops a certain number of
>> times, incrementing a certain variable each time, and this variable
>> can be used in expressions enclosed in [ ].
>> I don't know of any way to use if statements or for loops, besides
>> using the API with some other programming language.
>>
>> -Chuckk
>>
>>
>> On Sun, Jan 24, 2010 at 12:18 AM, Christopher Micallef
>> wrote:
>>> Is it possible to use if statments, for loops and loops within the
>>> score?
>>>
>>> I've tried without success. It seems they only work when defining
>>> instruments...
>>>
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>>> "unsubscribe csound"
>>
>>
>>
>> --
>> http://www.badmuthahubbard.com
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>> "unsubscribe csound"
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body
> "unsubscribe csound"
Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" |