From: owner-sc-users-digest@lists.io.com (sc-users-digest) To: sc-users-digest@lists.io.com Subject: sc-users-digest V1 #343 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 Tuesday, August 14 2001 Volume 01 : Number 343 ---------------------------------------------------------------------- Date: Sun, 12 Aug 2001 15:33:38 -0400 From: "felix" <---@---.---> Subject: Re: Reference/SoundFile question > ( > /* a lot of this is borrowed from SoundFiles.sc */ > var files, size, snd, sig, dataLen; > > files = [ > ":Sounds:comm-crunch", > ":Sounds:nn_loop.aif", > ":Sounds:sealedin.aif", > ":Sounds:swank,aif", > ":Sounds:violin/horn.aif" > ]; > size = files.size; > snd = Array.fill(size, SoundFile.new); > sig = Array.fill(size); > dataLen = Array.fill(size); > > size.do ({ > arg i; > > if( snd.at(i).read(files.at(i)), > { > # a = snd.at(i).data; note: # is used to separate items in a list and put them into variables eg: # a , b = [ 12,23]; a is 12 b is 23 SoundFile::data returns an array of signals ( usually 2 : stereo ) so you may or may not realize that what you did here is make a = the left channel signal only. a= snd.at(i).data; // stereo > c = (a.size * 0.5.rand).ceil; as james mentioned, a.size is an integer, but you end up with a float at the end of this. c = rrand(0, a.size.div(2)); // would also work random starting point between 0 and half way through the file ? if you keep a as a stereo array of signals: c = rrand(0, a.at(0).size.div(2));// check the size of the left > sig.put(i, snd.at(i).data.at(0, c)); so you want to take an excerpt of the signal from 0 to c ? you already have the signal in variable a sig.put(i, a.collect({ arg channel; channel.copyRange(0,c) }) ) i'm not so sure that's what you are trying to do. > /* size-2, cause i saw it in SoundFiles.sc */ > dataLen.put(i, sig.at(i).size-2); > }, > { > (files.at(i) ++ " not found.n").postln; > } > ); > }); > > i = size.rand; > j = size.rand; > > play({ arg synth; > PlayBuf.ar( sig.at(1) ++ sig.at(j), 1 was probably supposed to be i, right ? if you have these as stereo, you would have to say [sig.at(1).at(0) ++ sig.at(j).at(0) , sig.at(1).at(1) ++ sig.at(j).at(1)] to pair the left and right properly otherwise sig.at(1) ++ sig.at(j) is a four channel array of signals > snd.at(i).sampleRate, 1, 0, 0, (dataLen.at(1) + dataLen.at(j)) ) rather than bothering to build dataLen you can at this point compute your end loop point from the signals you have chosen: sig.at(1).at(0).size + sig.at(j).at(0).size - 2 > }) > ) ------------------------------ Date: Sun, 12 Aug 2001 14:43:10 -0500 From: James McCartney <---@---.---> Subject: Re: free memory space on 8/12/01 1:41 PM, Paul C Koonce koonce@Princeton.EDU at koonce@Princeton.EDU wrote: > The error suggests to me that the memory used by the previously interrupted > run has not been made free. Is this true? Maybe. You should set any references to the sound to nil. Otherwise it will not get garbage collected. The other possibility is that memory got fragmented and there is not a contiguous block of that size. - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Mon, 13 Aug 2001 06:31:34 -0400 (EDT) From: "Paul C. Koonce" <---@---.---> Subject: Re: free memory space James: Thanks. It was my careless use of automatic variables a-z which were collecting garbage. Seems to work fine now with proper declarations. Paul Koonce ------------------------------ Date: Mon, 13 Aug 2001 19:21:21 +0200 From: John Eacott <---@---.---> Subject: swing dammit How can i get a pattern to read a changing value from a GUI? this doesn't work......... (SC2.2.10) ( var pats, swing, w; w = GUIWindow.new("swing dammit!!"); swing = NumericalView.new(w, Rect.newBy(80, 70, 40, 20), "Swing", 0.25, 0.01, 0.49, 0.01); pats = Pbind( \dur, Pseq([swing.value, (0.5-swing.value)], inf) ); Synth.play({ arg synth; pats.asSpawn(nil, 2) }); ) ....................... If I do: \dur, Pseq([swing.value, (0.5-swing.value)], inf) the pattern will not read new values of swing while running. If I do: \dur, Pseq(Pfunc({ [swing.value, 0.5-(swing.value)]}), inf) it crashes. j - -- john eacott ======================================== composer - interactive sound design informal.org --- strangeattraction.com --- wmin.ac.uk eacottj@wmin.ac.uk --- john@informal.org ------------------------------ Date: Mon, 13 Aug 2001 12:46:56 -0500 From: James McCartney <---@---.---> Subject: Re: swing dammit on 8/13/01 12:21 PM, John Eacott at john@informal.org wrote: > If I do: > \dur, Pseq([swing.value, (0.5-swing.value)], inf) > > the pattern will not read new values of swing while running. Your code above gets the value from swing to build the array. That array now contains a value. It will not change. The more direct fix to what you have above: Pseq([ Pfuncn({ swing.value }), Pfuncn({ (0.5-swing.value) }) ], inf) Another more general (and faster) way is this: Prout({ loop({ swing.value.yield; (0.5 - swing.value).yield; }) }); - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Mon, 13 Aug 2001 22:02:13 +0200 From: Julian Rohrhuber <---@---.---> Subject: Parcel/Plib/Pout for runtime coding and adjusting parameters I have spent some more time on the Library patterns although i know that Library still might be not present anymore in the final SC3 version. Anyway this is just another design suggestion.. http://swiki.hfbk.uni-hamburg.de:8080/MusicTechnology/324 ------------------------------ Date: Mon, 13 Aug 2001 16:49:12 -0400 From: "felix" <---@---.---> Subject: Re: swing dammit > How can i get a pattern to read a changing value from a GUI? > > this doesn't work......... (SC2.2.10) > ( > var > pats, swing, w; > > w = GUIWindow.new("swing dammit!!"); > > swing = NumericalView.new(w, Rect.newBy(80, 70, 40, 20), "Swing", 0.25, > 0.01, 0.49, 0.01); > > pats = Pbind( > dur, Pseq([swing.value, (0.5-swing.value)], inf) > ); > > Synth.play({ arg synth; > pats.asSpawn(nil, 2) }); > ) > > ....................... > If I do: > dur, Pseq([swing.value, (0.5-swing.value)], inf) > > the pattern will not read new values of swing while running. > > If I do: > dur, Pseq(Pfunc({ > [swing.value, 0.5-(swing.value)]}), inf) > > it crashes. It crashes (somewhat) because you are returning an array of durations from the Pfunc, and the Pseq is trying to read that Pfunc as though it were itself an array. you want: \dur,Pseq([ Pfunc({swing.value}), Pfunc({ 0.5 - (swing.value)} ]),inf); or alternately use my NumberEditor: swing = NumberEditor(0.25,[0.01,0.49]); swing.gui; Pbind( \dur,Pseq([ swing, Pfunc({ 0.5 - swing.value}) ]) ).play; > > > j > > -- > john eacott > ======================================== > composer - interactive sound design > informal.org --- strangeattraction.com --- wmin.ac.uk > eacottj@wmin.ac.uk --- john@informal.org > > > ------------------------------ Date: Wed, 24 Jan 2001 16:45:50 -0500 From: Chris Sattinger <---@---.---> Subject: classvars was Re: SC 101 / - --Apple-Mail-1907508015-1 Content-Transfer-Encoding: 7bit Content-Type: text/plain; format=flowed; charset=us-ascii On Wednesday, August 8, 2001, at 08:52 AM, James McCartney wrote: > on 8/8/01 12:32 AM, christian adam hresko at godpup@ix.netcom.com wrote: > >>I don't like that * means multiply. It looks like an asterix to me. James can I change >>that ? In C++ you can change it... > ^("*&*%#@!") > // UGen's instance variables: > Post <<< UGen.instVarNames; > [ 'synth', 'inputs', 'rate', 'state' ] > > // UGen's instance prototype array for initializing those variables: > Post <<< UGen.iprototype; > [ nil, nil, 'audio', 0 ] > my ObjectInspector uses .instVarAt(index) to oh-so-naughtily peep at instVars without going through the front door interfaces (no christian, don't do that in your class constructor). was trying to list classvars in ClassInspector. can't figure out how to get at classvars ! the instvars of the class object are the inst vars of a Class object (name, filenameSymbol,....) are they in the basic slots ? where are they ? > > --- james mccartney james@audiosynth.com > SuperCollider - a real time synthesis programming language for the > PowerMac. > > > > > - --Apple-Mail-1907508015-1 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=us-ascii On Wednesday, August 8, 2001, at 08:52 AM, James McCartney wrote: on 8/8/01 12:32 AM, christian adam hresko at godpup@ix.netcom.com wrote: >>0000,63D6,124DI don't like that * means multiply. It looks like an asterix to me. James can I change >>that ? In C++ you can change it... > ^("*&*%#@!") // UGen's instance variables: Post <<<<<< UGen.instVarNames; [ 'synth', 'inputs', 'rate', 'state' ] // UGen's instance prototype array for initializing those variables: Post <<<<<< UGen.iprototype; [ nil, nil, 'audio', 0 ] my ObjectInspector uses .instVarAt(index) to oh-so-naughtily peep at instVars without going through the front door interfaces (no christian, don't do that in your class constructor). was trying to list classvars in ClassInspector. can't figure out how to get at classvars ! the instvars of the class object are the inst vars of a Class object (name, filenameSymbol,....) are they in the basic slots ? where are they ? 0000,0000,DEB7 - --- james mccartney james@audiosynth.com < SuperCollider - a real time synthesis programming language for the PowerMac. < - --Apple-Mail-1907508015-1-- ------------------------------ Date: Mon, 13 Aug 2001 17:46:04 -0500 From: James McCartney <---@---.---> Subject: Re: classvars was Re: SC 101 / on 1/24/01 4:45 PM, Chris Sattinger at felix@crucial-systems.com wrote: > > On Wednesday, August 8, 2001, at 08:52 AM, James McCartney wrote: > >> on 8/8/01 12:32 AM, christian adam hresko at godpup@ix.netcom.com wrote: >> >>> I don't like that * means multiply. It looks like an asterix to me. > James can I change >>> that ? In C++ you can change it... > >> ^("*&*%#@!") Very funny.. > my ObjectInspector uses .instVarAt(index) to oh-so-naughtily peep at > instVars without going through the front door interfaces (no christian, > don't do that in your class constructor). > > was trying to list classvars in ClassInspector. > can't figure out how to get at classvars ! > the instvars of the class object are the inst vars of a Class object > (name, > filenameSymbol,....) > > are they in the basic slots ? where are they ? They are stored in an array of arrays in the Process object. By putting the classvars not in the class, the entire class library can be immutable data and thus shared by multiple copies of the virtual machine. The array is indexed by the class' classIndex. And stored in that location is an array of the classvar values. For the following to work, a getter method has to be added to Process for the classVars instance variable. // Get the values of the classvars for class Synth: thisProcess.classVars.at(Synth.classIndex).postln; - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Mon, 13 Aug 2001 17:53:18 -0500 From: James McCartney <---@---.---> Subject: Re: classvars was Re: SC 101 / on 1/24/01 4:45 PM, Chris Sattinger at felix@crucial-systems.com wrote: > my ObjectInspector uses .instVarAt(index) to oh-so-naughtily peep at > instVars without going through the front door interfaces (no christian, > don't do that in your class constructor). Just a warning that you can seriously break things if you use instVarAt to access some things, especially anything leading off from someThread.frame or someThread.stack. Those should never have getters either. Doing thisProcess.classVars.put(index, someNewArray) would also be not good. The comments at the top of Thread.sc and Kernel.sc apply. - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Tue, 14 Aug 2001 09:29:26 +0200 From: Alessandro Fogar <---@---.---> Subject: The stars circle - Sonic meditation #1 FRIDAY 17 AUGUST 10PM COLONOS - Villacaccia di Lestizza (Ud) - Italy free admission THE STARS CIRCLE - SONIC MEDITATION #1 with live Supercollider sound projection by Alessandro Fogar More info: http://www.fogar.it/Tsc.pdf (italian) If you need further informations please ask... Enjoy Regards Alessandro - ------------------------------------------------------- /\ Alessandro Fogar mailto:sfogar@inwind.it / \ / Electronic Musician Software Developer \/ Grado (Go) / Italy http://www.fogar.it - ------------------------------------------------------- ------------------------------ Date: Mon, 13 Aug 2001 21:59:57 +0200 From: John Eacott <---@---.---> Subject: Re: swing dammit Brilliant, thanks. j - -- john eacott ======================================== composer - interactive sound design informal.org --- strangeattraction.com --- wmin.ac.uk eacottj@wmin.ac.uk --- john@informal.org ------------------------------ Date: Tue, 14 Aug 2001 18:33:55 +0200 From: Julian Rohrhuber <---@---.---> Subject: pass by value as there have been so many problems around assignment, I have written a small tutorial on assignment in supercollider. http://swiki.hfbk.uni-hamburg.de:8080/MusicTechnology/326 please tell me if anything is wrong or unclear. ------------------------------ Date: Tue, 14 Aug 2001 12:06:46 -0500 From: matrix6k@yahoo.com Subject: port how do i get portamento from within a voicer ? (or a pbind for that matter...) i threw Lag in there, but the spawner keeps giving me a new instance of the instrument instead of using the old one. thank you, - -mike _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com ------------------------------ Date: Tue, 14 Aug 2001 19:31:27 +0200 From: Julian Rohrhuber <---@---.---> Subject: Re: port >how do i get portamento from within a voicer ? (or a pbind for that >matter...) >i threw Lag in there, but the spawner keeps giving me a new instance of >the instrument instead of >using the old one. > >thank you, > >-mike > >_________________________________________________________ >Do You Yahoo!? >Get your free @yahoo.com address at http://mail.yahoo.com if you want to use lag, you have to use a Plug outside of the Voicer that you set from within. freq = Plug.kr(440, 0.5) Voicer.ar({ arg... freq.source = note.midicps SinOsc.ar(freq, 0, velocity/255) ... }) to get the other midi data you can still make a MIDIController listening to portamento. ------------------------------ Date: Tue, 14 Aug 2001 12:32:12 -0500 From: James McCartney <---@---.---> Subject: Re: port on 8/14/01 12:06 PM, matrix6k@yahoo.com at matrix6k@yahoo.com wrote: > how do i get portamento from within a voicer ? (or a pbind for that > matter...) > i threw Lag in there, but the spawner keeps giving me a new instance of > the instrument instead of > using the old one. > > thank you, If you want a mono voice, then create the instrument's ugens outside of the Voicer and use the Voicer's function to set values of Plugs in your instrument. - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Tue, 14 Aug 2001 12:38:56 -0500 From: James McCartney <---@---.---> Subject: Re: pass by value on 8/14/01 11:33 AM, Julian Rohrhuber at sa6a014@rzaixsrv2.rrz.uni-hamburg.de wrote: > as there have been so many problems around assignment, I have written > a small tutorial on assignment in supercollider. > http://swiki.hfbk.uni-hamburg.de:8080/MusicTechnology/326 > please tell me if anything is wrong or unclear. > I think there is still misunderstanding?? In the following the Ref makes no difference: With the Ref: //___________reference misconception: a = 0; //a now contains the number zero b = Ref(a); // b is a reference to what a contains, the number zero. (equivalent: b = `a) [a, b].postln; [ 0, `(0) ] a = 8.0; //a now contains the value 8.0 [a, b].postln; // b still is a refernce to what b previously contained, zero [ 8, `(0) ] without the Ref: a = 0; //a now contains the number zero b = a; // b is a reference to what a contains, the number zero. (equivalent: b = `a) [a, b].postln; [ 0, 0 ] a = 8.0; //a now contains the value 8.0 [a, b].postln; // b still is a refernce to what b previously contained, zero [ 8, 0 ] - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Tue, 14 Aug 2001 12:54:13 -0500 From: James McCartney <---@---.---> Subject: Re: pass by value //__________similarly, an array can be used: a = [0];   //a now contains the an array containing the number zero b = a; // b is a reference to what a contains, the array. I would say instead that "a and b now refer to the same object". [a, b].postln; a.put(0, 8.0); //change the value in the array thar a contains [a, b].postln; // also b has changed. And similarly for the others: a = Date.getDate; //create a new instance of Date and store it in a b = a;  // b is a reference to what a contains, a date. "a and b now refer to the same object". [a.year, b.year].postln; //so a and b are still pointing to the same object. I do not prefer the words pointer or pointing, as it leads to C programmers to make concrete assumptions rather than abstract ones. Abstraction is the path to conceptual nirvana. Concreteness leads to the damnation of continuous rebirth as a C++ programmer shoveling bits for an eternity (my current dharma). ------------------------------ Date: Tue, 14 Aug 2001 20:37:58 +0200 From: Julian Rohrhuber <---@---.---> Subject: Re: pass by value >on 8/14/01 11:33 AM, Julian Rohrhuber at >sa6a014@rzaixsrv2.rrz.uni-hamburg.de wrote: > >> as there have been so many problems around assignment, I have written >> a small tutorial on assignment in supercollider. >> http://swiki.hfbk.uni-hamburg.de:8080/MusicTechnology/326 >> please tell me if anything is wrong or unclear. >> > >I think there is still misunderstanding?? >In the following the Ref makes no difference: >With the Ref: > >//___________reference misconception: >a = 0; //a now contains the number zero >b = Ref(a); // b is a reference to what a contains, the number zero. >(equivalent: b = `a) >[a, b].postln; >[ 0, `(0) ] >a = 8.0; //a now contains the value 8.0 >[a, b].postln; // b still is a refernce to what b previously contained, zero >[ 8, `(0) ] > >without the Ref: > >a = 0; //a now contains the number zero >b = a; // b is a reference to what a contains, the number zero. (equivalent: >b = `a) >[a, b].postln; >[ 0, 0 ] >a = 8.0; //a now contains the value 8.0 >[a, b].postln; // b still is a refernce to what b previously contained, zero >[ 8, 0 ] > yes exactly. well I like walking off to know how I'm wrong. (And not to become attached to rightness..) this was just one wrong way of thinking that I wanted to dempstrate, so I called it 'misconception'. I think in this case it doesn't make a difference if I used it unnecessarily wrong. You think I better leave it away? ------------------------------ Date: Tue, 14 Aug 2001 20:41:28 +0200 From: Julian Rohrhuber <---@---.---> Subject: Re: pass by value > >[a.year, b.year].postln; //so a and b are still pointing to the same object. > >I do not prefer the words pointer or pointing, as it leads to C programmers >to make concrete assumptions rather than abstract ones. Abstraction is the >path to conceptual nirvana. Concreteness leads to the damnation of >continuous rebirth as a C++ programmer shoveling bits for an eternity (my >current dharma). work diligently and persistently .. (I'll correct my impure tutorial quickly) ------------------------------ Date: Tue, 14 Aug 2001 14:05:20 -0500 From: James McCartney <---@---.---> Subject: Re: pass by value on 8/14/01 1:37 PM, Julian Rohrhuber at sa6a014@rzaixsrv2.rrz.uni-hamburg.de wrote: > this was just one wrong way of thinking that I wanted to dempstrate, > so I called it 'misconception'. I think in this case it doesn't make > a difference if I used it unnecessarily wrong. You think I better > leave it away? > But since it makes no difference, then I don't understand what is being illustrated by it? Anyway, just my editorial comments. Maybe I'm the one confused. - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Tue, 14 Aug 2001 17:03:52 -0400 From: felix@crucial-systems.com Subject: re: port(amento) >how do i get portamento from within a voicer ? (or a pbind for that matter...) >i threw Lag in there, but the spawner keeps giving me a new instance of >the instrument instead of >using the old one. actually its the same instrument, but it gets valued each time for each event. > >thank you, > >-mike You should/could also look at my Patch/Instr class, and also at StreamKr with that there is only one event, and you pass in all the values as either simple floats, kr signals, audio inputs, trig (kr) inputs etc. StreamKr turns a value stream into a kr signal, and can be passed in as input to a Patch. a trig signal can be passed into a patch to trigger an envelope. its quite different than doing Event stream patterns. to my ears, I like it a lot more. Its very fluid, and in fact uses less cpu. in code terms, its also simpler. > >_________________________________________________________ >Do You Yahoo!? >Get your free @yahoo.com address at http://mail.yahoo.com > > > _____(( http://crucial-systems.com _________________))_______ ------------------------------ End of sc-users-digest V1 #343 ******************************