[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-users] Two Ctk related questions
Since the 'test' part of while is a function, you can still do things
inside of it, as long as the function returns a boolean:
i = 0;
while({
i = i + 1;
i.postln;
i < 10;
})
i = 0;
while({
i < 10;
}, {
i = i + 1;
i.postln;
})
So, these are basically the same. There is ONE subtle different though:
while({
"test first".postln;
i = i + 1;
i.postln;
i < 10;
})
while({
"test first".postln;
i < 10;
}, {
i = i + 1;
i.postln;
})
Notice that, in the second one, the test function still has to
evaluate after the second runs (this is, of course the case, since the
while look is still true until the test runs).
Josh
On Dec 19, 2007, at 11:37 PM, Alessandro Fogar wrote:
Hi,
no, I would write that in this way...
while({now < duration}, {
note = orch[\test].new(starttime + now, 0.1, target:
thisgroup);
note.freq_(lowfreq.rrand(hifreq));
note.amp_(ampenv[now]); note.dur_(0.1);
note.outbus_(bfbus); note.loc_(0.5pi.rrand(-0.5pi));
note.addTo(score);
now = now + 0.02; ; });
All the best
-- Alessandro Fogar
http://www.fogar.it
2007/12/20, Josh Parmenter <josh@xxxxxxxxxxxxxxxxx>:> Not sure which
shortcuts you mean... do you mean the setters for> SynthDef
parameters?>> .freq_(440)>> This simply sets the freq
argument for the synth to 440. it is the> same as:>> freq =
440>> but you can string them together easier>> The parameter_(val)
is for setting a parameter's value in a class.> CtkNoteObjects look
at the SynthDef (or SynthDesc) that is passed into> it, and creates
methods for setting the values of a note instance, as> well as
getting a current value.>> If that isn't what you mean... let me
know which part.>> Best,>> Josh>> On Dec 19, 2007, at 1:44 PM,
Alessandro Fogar wrote:>> > Hi Josh,> >> > many thanks,> >> > yes,
you answered to my questions...> >> > I only don't know about thes
syntax shortcuts about the following> > section of code:> >> >
while({> > // create a note... add it to the CtkScore>
> note = orch[\test].new(starttime + now, 0.1, ta!
rget:> > thisgroup)> > // the CtkProtoNotes
(and the CtkNoteObjects it> > creates) makes methods to>
> // get and set all arguments in the
synthdef> > .freq_(lowfreq.rrand(hifreq))>
> .amp_(ampenv[now])>
> .dur_(0.1)>
> .outbus_(bfbus)>
> .loc_(0.5pi.rrand(-0.5pi))>
> .addTo(score);> > now = now +
0.02;> > now < duration;> > });> >> >
All the best> >> >> > --> > Alessandro Fogar> >> > http://
www.fogar.it> >> > 2007/12/18, Josh Parmenter
<josh@xxxxxxxxxxxxxxxxx>:> >> Hi Alessandro. I hope the following
answers your questions... let me> >> know if there is anything
else.> >>> >> best,> >>> >> Josh> >
_______________________________________________> > sc-users mailing
list> > sc-users@xxxxxxxxxxxxxxx> > http://www.create.ucsb.edu/mailman/listinfo/sc-users
>> ******!
************************************> /* Joshua D. Parmenter> http://www.realizedsound.net/josh/
>> "Every composer – at all times and in all cases – gives his own>
interpretation of how modern society is structured: whether
actively> or passively, consciously or unconsciously, he makes
choices in this> regard. He may be conservative or he may subject
himself to continual> renewal; or he may strive for a revolutionary,
historical or social> palingenesis." - Luigi Nono> */>>>
_______________________________________________> sc-users mailing
list> sc-users@xxxxxxxxxxxxxxx> http://www.create.ucsb.edu/mailman/listinfo/sc-users
>
_______________________________________________
sc-users mailing list
sc-users@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-users
******************************************
/* Joshua D. Parmenter
http://www.realizedsound.net/josh/
“Every composer – at all times and in all cases – gives his own
interpretation of how modern society is structured: whether actively
or passively, consciously or unconsciously, he makes choices in this
regard. He may be conservative or he may subject himself to continual
renewal; or he may strive for a revolutionary, historical or social
palingenesis." - Luigi Nono
*/