From: owner-sc-users-digest@lists.io.com (sc-users-digest) To: sc-users-digest@lists.io.com Subject: sc-users-digest V1 #108 Reply-To: sc-users Sender: owner-sc-users-digest@lists.io.com Errors-To: owner-sc-users-digest@lists.io.com Precedence: bulk sc-users-digest Saturday, April 15 2000 Volume 01 : Number 108 ---------------------------------------------------------------------- Date: Tue, 11 Apr 2000 11:29:43 +0000 From: julian rhrhbr <---@---.---> Subject: Re: iteration question extra thanks, that is a good explanation. So it makes most of the difference to change the collection itself or the values it points to.(if there is no change in the datatypes). James McCartney wrote: > However in either example what you are doing looks OK since wrapAt will > insure that you never index out of bounds. The problems come when you are > trying to do something like remove items from a list and you remove them > from the list you are iterating over. In this case you should return a new > list without those items. If you use the Collection 'reject' method, then > that is what it does. ------------------------------ Date: Wed, 12 Apr 2000 20:33:21 -0700 From: cramakrishnan@acm.org Subject: Function semantics Hi James. A question concerning functions in SC. Executing: ( var soundGen; soundGen = SinOsc.ar(200); {soundGen.postln }.value ) returns: a SinOsc but when I try to play the function: ( var soundGen; soundGen = SinOsc.ar(200); {soundGen }.play ) there are no UGens in the synth it it makes a very high pitched sound. On the other hand, when I move the var declaration and assignment into the function, it plays fine: ( { var soundGen; soundGen = SinOsc.ar(200); soundGen }.play ) Why does it behave this way? - - sekhar - -- C. Ramakrishnan cramakrishnan@acm.org ------------------------------ Date: Wed, 12 Apr 2000 23:35:55 -0500 From: James McCartney <---@---.---> Subject: Re: Function semantics on 4/12/00 10:33 PM, cramakrishnan@acm.org at cramakrishnan@acm.org wrote: > > Hi James. A question concerning functions in SC. > > Executing: > ( > var soundGen; > soundGen = SinOsc.ar(200); > {soundGen.postln > }.value > ) > > returns: a SinOsc > > but when I try to play the function: > ( > var soundGen; > soundGen = SinOsc.ar(200); > {soundGen > }.play > ) > > there are no UGens in the synth it it makes a very high pitched sound. > > On the other hand, when I move the var declaration and assignment into > the function, it plays fine: > ( > { > var soundGen; > soundGen = SinOsc.ar(200); > soundGen > }.play > ) > > Why does it behave this way? > > - sekhar > > -- > C. Ramakrishnan cramakrishnan@acm.org > In order to be installed in a Synth a UGen has to be created by the Synth. func.play is really executing Synth.new(func).play The Synth in its 'new' method collects all of the UGens being created. If you create a UGen outside of the ugenGraph function, then it is not installed in a Synth and does not get executed. - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Sat, 15 Apr 2000 22:49:48 -0400 (EDT) From: Paul Lansky <---@---.---> Subject: array question Hi, Sorry for the dumb question, but I'm beating my head against it and need help I have a two dimensional array, e.g. x = [[3,6,9],[8,2],[1,2,3,4]]; and want to create a second array which individually indexes each element in the first array, e.g. y = [[0,0],[0,1],[0,2],[1,0],[1,1],[2,0],[2,1],[2,2],[2,3]]; the following fails because it keeps the innter arrays intact. y = Array.fill(x.size, {arg a; Array.fill(x.at(a).size,{arg b; [a,b]})}); yields [[[0,0],[0,1],[0,2]],[[1,0],[1,1]],[[2,0],[2,1],[2,2],[2,3]]] I'm sure the solution is obvious, but I'm too old and stoopid... thanks paul lansky ------------------------------ End of sc-users-digest V1 #108 ******************************