Csound Csound-dev Csound-tekno Search About

[Csnd] If statements, loops, for loops etc in score

Date2010-01-23 22:18
FromChristopher Micallef
Subject[Csnd] If statements, loops, for loops etc in score
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"

Date2010-01-23 22:34
Fromjoachim heintz
Subject[Csnd] Re: If statements, loops, for loops etc in score
can you give an example why you want it to use in the score?


Am 23.01.2010 um 23:18 schrieb Christopher Micallef:

> 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"



Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2010-01-23 22:41
FromChristopher Micallef
Subject[Csnd] Re: Re: If statements, loops, for loops etc in score
I just want to know if it can be done :) thank you :)

On 24/01/2010, at 9:35 AM, "joachim heintz"  wrote:

> can you give an example why you want it to use in the score?
>
>
> Am 23.01.2010 um 23:18 schrieb Christopher Micallef:
>
>> 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"
>
>
>
> 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"

Date2010-01-23 22:59
FromChuckk Hubbard
Subject[Csnd] Re: If statements, loops, for loops etc in score
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"


Date2010-01-23 23:13
FromChristopher Micallef
Subject[Csnd] Re: Re: If statements, loops, for loops etc in score
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"

Date2010-01-23 23:40
FromChristopher Micallef
Subject[Csnd] Re: Re: Re: If statements, loops, for loops etc in score
Another quick one

Can "opcode" be used in the score? My guess is no

On 24/01/2010, at 10:14 AM, "Christopher Micallef"  wrote:

> 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"

Date2010-01-24 00:16
Fromjoachim heintz
Subject[Csnd] Re: Re: Re: If statements, loops, for loops etc in score
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"

Date2010-01-26 00:36
FromTobiah
Subject[Csnd] Re: If statements, loops, for loops etc in score
On Sat, Jan 23, 2010 at 2:18 PM, 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...

It is time for you to decide on a scripting language (Ok, python it is)
to generate your scores.  Even if you just did:

print "i1 0 2 10000 440"
print "i1 0 2 10000 440"

etc...    At least now you have all of the control structure that
you need in your scripting language.  It seems out of place to rely on
the csound score to
provide those things.  It's just a list of floats - although it
does have some minuscule measure of added facilities for the hand-edit user.

To go further, you will find that the event itself should not be
opaque to your score generation program.  There is no limit to
the way that your music can be represented in the data structures
of your scripting language.  Some trivial process can be used to
coerce the data into the simple representation that is the csound score.

I find my psycops library to be the cat's meow, although I haven't heard
that anyone else is using it.  It's just a bit of glue to marry
python with csound scores.

Tobiah


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2010-01-26 00:39
FromChristopher Micallef
Subject[Csnd] Re: Re: If statements, loops, for loops etc in score
Yeah seriously lookin at python yo generate the score files :) easy to  
do

What's this psycops library you speak of?

Sent from my Maria's iPhone

On 26/01/2010, at 11:37 AM, "Tobiah"  wrote:

> On Sat, Jan 23, 2010 at 2:18 PM, 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...
>
> It is time for you to decide on a scripting language (Ok, python it  
> is)
> to generate your scores.  Even if you just did:
>
> print "i1 0 2 10000 440"
> print "i1 0 2 10000 440"
>
> etc...    At least now you have all of the control structure that
> you need in your scripting language.  It seems out of place to rely on
> the csound score to
> provide those things.  It's just a list of floats - although it
> does have some minuscule measure of added facilities for the hand- 
> edit user.
>
> To go further, you will find that the event itself should not be
> opaque to your score generation program.  There is no limit to
> the way that your music can be represented in the data structures
> of your scripting language.  Some trivial process can be used to
> coerce the data into the simple representation that is the csound  
> score.
>
> I find my psycops library to be the cat's meow, although I haven't  
> heard
> that anyone else is using it.  It's just a bit of glue to marry
> python with csound scores.
>
> Tobiah
>
>
> 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"

Date2010-01-26 00:42
FromTobiah
Subject[Csnd] Re: Re: Re: If statements, loops, for loops etc in score
> What's this psycops library you speak of?

The docs are probably weak, but if you go through
the console session example carefully you may
take to psycops:

http://sourceforge.net/projects/psycops/


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"