From: owner-sc-users-digest@lists.io.com (sc-users-digest) To: sc-users-digest@lists.io.com Subject: sc-users-digest V1 #350 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, September 1 2001 Volume 01 : Number 350 ---------------------------------------------------------------------- Date: Wed, 29 Aug 2001 22:19:11 -0400 From: "crucial" <---@---.---> Subject: Re: timers There isn't one, but it would be useful. check thisSynth.time, then check it again later. subtract. >Hi, > >I am new to SC, so please excuse this possibly naive post. > >I am trying to time a process, for now just the interval between GUI button >pushes. Is there a quick and dirty way to do this, like the "timer" object >in Max? I couldn't find anything in the docs, so I've been trying (somewhat >unsuccessfully) to rig up a clock source (impulse oscillator) to a >PulseCount, etc. etc. But it seems more complicated than necessary. > >So is there a timer class like this in the default library, or perhaps >online somewhere? > >Thanks, >Jamie Forrest >honksandsirens@yahoo.com > > >_________________________________________________________ >Do You Yahoo!? >Get your free @yahoo.com address at http://mail.yahoo.com > > > _____(( http://crucial-systems.com _________________))_______ ------------------------------ Date: Thu, 30 Aug 2001 21:48:51 +0200 From: jr@xs4all.nl (joel ryan) Subject: variable space limits on the Danube what is the limit on variable space in SC2? I have a medium size program of about 1000lines with many global variables at a certain point today along the Donau I hit an avalanche of "variable xxx not defined" error messages for variables which have been in place for some time. when I comment out a newly defined set of variables the messages ceased is there any remedy I presume there is more memory for classes and messages but working quickly on a project there isnt often time to factor of the top code into classes especially if they have to refer to existing globals etc plexed - -- - -=-=-=-=---=-=-=-=-===-----=-==-=-=-====---=------=-------- Joel Ryan STEIM :: Ballett Frankfurt :: Institute of Sonology Achtergracht 19, 1017WL Amsterdam +31 (20) 624-3886 +31 (20) 626-4262 fax http://www.frankfurt-ballett.de/joel.html http://www.steim.nl ------------------------------ Date: Thu, 30 Aug 2001 16:00:00 -0400 From: James Forrest <---@---.---> Subject: *new method returning nil? Hi, Why does this return a valid object: Foo { var <>synth; *new { var newsynth; newsynth = Synth.new({FSinOsc.ar(440,0)}); ^super.new.synth_(newsynth) } } but this returns nil?: Foo { var <>synth; *new { var newsynth; newsynth = Synth.new({FSinOsc.ar(440, 0)}); newsynth.play; ^super.new.synth_(newsynth) } } Jamie Forrest honksandsirens@yahoo.com _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com ------------------------------ Date: Thu, 30 Aug 2001 18:02:08 -0400 (EDT) From: "Paul C. Koonce" <---@---.---> Subject: Median filter at K-rate I have an external MIDI controller that has noise spikes that I'd like to get rid of. The best way would be a median or mode filter running at the K-rate. While Median takes a .kr message, it would appear to do its thing at the audio rate. Is there a ugen or codable Median filter method I could easily implement on a k-rate signal for this? I can and have utilized lowpass strategies--the best being to put it into LeakDC and remove the output from the original signal--but these approaches sacrifice responsiveness, and never entirely rid the signal of its scourge. Paul Koonce ------------------------------ Date: Thu, 30 Aug 2001 18:59:00 -0400 From: "crucial" <---@---.---> Subject: Re: timers >> There isn't one, but it would be useful. >> check thisSynth.time, then check it again later. >> subtract. > >this is pretty much what i need, but is there a way to get the time without >running a uGen? well if you're not playing, than there isn't much point in measuring the time between button pushes. if you are playing, then thisSynth.time gives the time that that synth has been running. there is no overhead at all, you are just checking the synth that is playing whatever stuff you are really running. it knows what time it is, word. thisSynth: the pseudo variable that always gives you the immediately enclosing synth. watch out if you are inside a spawn, then the synth that thisSynth gives you has only been playing as long as that spawn's event. you probably need to save a reference to a synth that is running the whole course of whatever you are doing. such as the one given to you in { arg synth; // this one Yada.ar( Yada.kr, Yada.kr); // note : its a joke }.play > >or, is there a uGen that I can run that won't eat up much CPU? so you aren't running a ugen for this purpose, you are just querying the Synth's clock. > >thanks, >jamie > > >_________________________________________________________ >Do You Yahoo!? >Get your free @yahoo.com address at http://mail.yahoo.com > > > _____(( http://crucial-systems.com _________________))_______ ------------------------------ Date: Thu, 30 Aug 2001 21:03:29 -0400 (EDT) From: "Ronald J. Kuivila" <---@---.---> Subject: Re: timers Hi all, The timer discussion raises an interesting question I had not considered: Is it true that "thisSynth" is always the root synth when queried from the interpreter or from a GUI action? Or, conversely, thisSynth is not the root synth only inside of Spawning sounds and scheduled functions. RJK ------------------------------ Date: Fri, 31 Aug 2001 05:31:44 -0400 (EDT) From: Matthew Rogalsky <---@---.---> Subject: error reading from text file hi Within a spawn, I am trying to read sequential characters from a text file. I get an error message telling me I'm trying to acquire a semaphore at interrupt level. the text file is quite huge so I don't want to read it all into memory. is there a way I can read from an open file within a spawn or is it not allowed at all? thanks matt ------------------------------ Date: Fri, 31 Aug 2001 08:00:59 -0400 (EDT) From: "Ronald J. Kuivila" <---@---.---> Subject: Re: error reading from text file Hi Matt, You will need to do the character reading from within a Task, which can acquire the MacOS Toolbox semaphore. I believe that you can simply use an array as a FIFO buffer for communication between the spawn and the task: a = []; //what the task does a = a.addFirst(322); a = a.addFirst(222); a = a.addFirst(122); // what the Spawn does a.pop.post RJK On Fri, 31 Aug 2001, Matthew Rogalsky wrote: > hi > > Within a spawn, I am trying to read sequential characters from a text > file. I get an error message telling me I'm trying to acquire a semaphore > at interrupt level. > > the text file is quite huge so I don't want to read it all into memory. > > is there a way I can read from an open file within a spawn or is it not > allowed at all? > > thanks > matt > > ------------------------------ Date: Fri, 31 Aug 2001 09:33:49 -0500 (CDT) From: "AUDIOSYNTH.COM" <---@---.---> Subject: Re: variable space limits on the Danube On Thu, 30 Aug 2001, joel ryan wrote: > what is the limit on variable space in SC2? > I have a medium size program of about 1000lines > with many global variables There are no global variables in SuperCollider. There are class variables, instance variables, local variables and a few special pseudo variables (thisThread, ..). no more. There may be a limit of 256 in any one function or class. I need to have a look. > at a certain point today along the Donau > I hit an avalanche of "variable xxx not defined" error messages > for variables which have been in place for some time. > when I comment out a newly defined set of variables the messages ceased > is there any remedy > I presume there is more memory for classes and messages but > working quickly on a project there isnt often time to factor > of the top code into classes > especially if they have to refer to existing globals etc > plexed > ------------------------------ Date: Fri, 31 Aug 2001 09:57:31 -0500 (CDT) From: "AUDIOSYNTH.COM" <---@---.---> Subject: Re: fft2nn On Wed, 29 Aug 2001, Arie van Schutterhoef wrote: > >on 8/23/01 12:36 AM, Arie van Schutterhoef at arsche@xs4all.nl wrote: > > > >> Is there a way to use tthe magnitude or > >> the real of a FFT as discrete values to train > >> Martin Robinson's Neural Nets? > >> or to rephrase that: > >> to convert the real part of the input > >> spectra to an array? > > > >Doing it in SC code would be too slow. You'd need to write C code. > > We realize this is not possible on audio rate, > but is it possible to do this once a second? > There by more or less solving the problem of the slower > SC code you mentioned. Doing something less often does not make it any less expensive. There is not really an easy way to amortize it over time. You could do some scheduling I guess and work on the computation in bits. But you'd be on your own here. > > However therefore it is necessary at certain times to have > the fft output available as real value (see code). > The mentioned CONVERTER is supposed to > convert the fft real values to an array > of numbers, it also has to do this for > 'flipje' (LFPulse.ar). > > Is there a way of doing this? > > > > //NEURAL FANTASIES-Hans van Eck > > ( > // > var filename, sound, signal,net; > filename = ":Sounds:floating_1"; > sound = SoundFile.new; > > // create NeuralNet : > net = NeuralNetFFBP.new(64, 64, 1); > if (sound.read(filename), { > signal = sound.data.at(0); > Synth.play({ > var stem, stoor, laagpuls, flipje, miks, miksfft, out; > var fftsize, cosineTable, src, fft, ifft; > fftsize = 64; > cosineTable = Signal.fftCosTable(fftsize); > > /*create flipflop in order to switch on/off the voice > that has to be recognized*/ > > flipje = LFPulse.ar(0.837, 0.5, 1, 0) ; > > //create distort (=stoor) signal: > stoor = BrownNoise.ar(FSinOsc.ar(0.673, 0.4, 0.4), 0); > //create voice (=stem) sound > stem = PlayBuf.ar(signal, sound.sampleRate, 1, 0, 0, > signal.size-2, flipje); > //mix (=miks) both signals > miks = Mix.ar([stoor,stem]); > //fft (=miksfft) that has to be recognized > miksfft = FFT.ar(fftsize, 0, cosineTable, nil, nil, miks, 0.0); > > //Now the net on non-realtime: > laagpuls = LFPulse.ar(1,0,1,0); > if(laagpuls == 1,{ Cannot do the above. 'if' is not a UGen expression. See file "misconception". Use Sequencer for triggered functions. > /*CONVERTER = function that takes a snapshot of the output value > of a audio rate UGEN; This what we wany*/ > net.train (CONVERTER([ miksfft.real ]), CONVERTER([ > flipje ])); > net; > // output net, if necessary ??? > }, {nil}); > > //to be sure that there is a FFT and something happens. > > out = IFFT.ar(cosineTable, nil, nil, miksfft.real, miksfft.imag); > out.real; > }) > > },{ (filename ++ " not found.\n").post }); > ) > > Arie van Schutterhoef/Hans van Eck > > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . > .................................................................. > > ^ Arie van Schutterhoef | arsche@xs4all.nl > ^_北北北北北北北北北北北盻_""""""""""""""""""""""""""""""""" | > ` |Schreck Ensemble http://www.xs4all.nl/~schreck/ | > ` |# -laboratory for live electro-acoustic music- # | > ` |Tel: 00-31-71-5612287 Fax: 00-31-70-3859268 | > > *========================================================++ > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . > .................................................................. > > ------------------------------ Date: Fri, 31 Aug 2001 10:58:07 -0400 (EDT) From: "Ronald J. Kuivila" <---@---.---> Subject: Re: variable space limits on the Danube I guess that Joel is talking about a bunch of variable declarations at the top of a page of text to be interpreted. Is it correct to say that those are instance variables of a Function that is created by selecting text and typing enter? RJK On Fri, 31 Aug 2001, AUDIOSYNTH.COM wrote: > On Thu, 30 Aug 2001, joel ryan wrote: > > > what is the limit on variable space in SC2? > > I have a medium size program of about 1000lines > > with many global variables > > There are no global variables in SuperCollider. > There are class variables, instance variables, local variables and a few > special pseudo variables (thisThread, ..). no more. > There may be a limit of 256 in any one function or class. I need to > have a look. ------------------------------ Date: Fri, 31 Aug 2001 10:06:14 -0500 (CDT) From: "AUDIOSYNTH.COM" <---@---.---> Subject: Re: variable space limits on the Danube On Fri, 31 Aug 2001, Ronald J. Kuivila wrote: > > I guess that Joel is talking about a bunch of variable declarations at the > top of a page of text to be interpreted. Is it correct to say that those > are instance variables of a Function that is created by > selecting text and typing enter? Those are local variables of a function. Yes. > > RJK > > On Fri, 31 Aug 2001, AUDIOSYNTH.COM wrote: > > > On Thu, 30 Aug 2001, joel ryan wrote: > > > > > what is the limit on variable space in SC2? > > > I have a medium size program of about 1000lines > > > with many global variables > > > > There are no global variables in SuperCollider. > > There are class variables, instance variables, local variables and a few > > special pseudo variables (thisThread, ..). no more. > > There may be a limit of 256 in any one function or class. I need to > > have a look. > ------------------------------ Date: Fri, 31 Aug 2001 10:43:51 -0500 (CDT) From: "AUDIOSYNTH.COM" <---@---.---> Subject: Re: *new method returning nil? On Thu, 30 Aug 2001, James Forrest wrote: > Hi, > > Why does this return a valid object: > > Foo { > var <>synth; > > *new { > var newsynth; > newsynth = Synth.new({FSinOsc.ar(440,0)}); > ^super.new.synth_(newsynth) > } > > } > > but this returns nil?: > > Foo { > var <>synth; > > *new { > var newsynth; > newsynth = Synth.new({FSinOsc.ar(440, 0)}); > newsynth.play; > ^super.new.synth_(newsynth) > } > > } > What version are you using? It works fine for me in 2.2.11. Foo.new.dump; // have to cmd-period to stop playing. Instance of Foo { (0A0E70D0, gc=02, fmt=00, flg=00, set=00) instance variables [1] synth : instance of Synth (0A0E6D78, size=0, set=06) } > Jamie Forrest > honksandsirens@yahoo.com > > > _________________________________________________________ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com > ------------------------------ Date: Fri, 31 Aug 2001 17:48:08 +0100 From: Arie van Schutterhoef <---@---.---> Subject: Re: fft2nn Hi James, Thanks for your answer; we understand that the problem has too be split up, or rather several stages. >> >> to convert the real part of the input >> >> spectra to an array? - -One element remains unclear how to get any information out of the fft and convert it in 'something else' that is 'storable', like an array. If one wants use it at a later stage for 'structural applications' (compositional processes, scores, etc. etc.), there has to be away of storing or collecting these informations. This is also a very important point, so maybe you can tell something about that. thanks AvS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .................................................................. ^ Arie van Schutterhoef | arsche@xs4all.nl ^_北北北北北北北北北北北盻_""""""""""""""""""""""""""""""""" | ` |Schreck Ensemble http://www.xs4all.nl/~schreck/ | ` |# -laboratory for live electro-acoustic music- # | ` |Tel: 00-31-71-5612287 Fax: 00-31-70-3859268 | *========================================================++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .................................................................. ------------------------------ Date: Fri, 31 Aug 2001 09:30:06 -0700 (PDT) From: James Forrest <---@---.---> Subject: Re: *new method returning nil? > > Foo { > > var <>synth; > > > > *new { > > var newsynth; > > newsynth = Synth.new({FSinOsc.ar(440, > 0)}); > > newsynth.play; > > ^super.new.synth_(newsynth) > > } > > > > } I have the latest version, and yes, calling Foo.new.dump does give me a valid object after I stop the synth by pressing cmd-period. So let me refine my question. When newsynth.play is called, does the next line (namely the line that returns the new object) *not* get interpreted until newsynth is stopped by pressing cmd-period? If this is the case, is there anyway to set up and start a synth upon initialization of an object (i.e., in that objects *new method), and be able to then use that object without stopping the synth first? Before the synth is stopped, the object is nil because the *new method has not yet returned. Thanks, Jamie __________________________________________________ Do You Yahoo!? Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com ------------------------------ Date: Fri, 31 Aug 2001 14:26:27 -0400 From: "crucial" <---@---.---> Subject: Re: *new method returning nil? you should probably return the Foo and then tell it to play. it is limiting to create just one object that then is the only thing playing on your whole system. if you return a Foo and also of course a Bar, you can play both of them at the same time. generally you shouldn't limit your object to using .play because under the normal sc2 system, that is the only synthesis that can happen. give Foo an .ar or .value method and play your foo inside a Spawn or TSpawn. then you can play many of them, and stop or start individual foos. foo = Foo.new; bar = Bar.new; add a button with action: { Mix.ar([ foo.ar, bar.ar ]) }.play add a button with action: { foo.footicate } // you can hit this while the foo is playing >> > Foo { >> > var <>synth; >> > >> > *new { >> > var newsynth; >> > newsynth = Synth.new({FSinOsc.ar(440, >> 0)}); >> > newsynth.play; >> > ^super.new.synth_(newsynth) >> > } >> > >> > } > >I have the latest version, and yes, calling >Foo.new.dump does give me a valid object after I stop >the synth by pressing cmd-period. So let me refine my >question. When newsynth.play is called, does the next >line (namely the line that returns the new object) >*not* get interpreted until newsynth is stopped by >pressing cmd-period? > >If this is the case, is there anyway to set up and >start a synth upon initialization of an object (i.e., >in that objects *new method), and be able to then use >that object without stopping the synth first? Before >the synth is stopped, the object is nil because the >*new method has not yet returned. > >Thanks, >Jamie > > >__________________________________________________ >Do You Yahoo!? >Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger >http://im.yahoo.com > > _____(( http://crucial-systems.com _________________))_______ ------------------------------ Date: Fri, 31 Aug 2001 14:53:39 -0400 From: christian adam hresko <---@---.---> Subject: what's this t in SC3? finally getting around to SC3. i have a question about the following patch which i understand except for one or two things: ( var x, z; z = ImageSynth(Pic.new(Rect.newBy(0,0,512,512), 32), Synth.new({ var x, y, t, scale, rot; scale = MouseX.kr([0,60]); rot = MouseY.kr([0,4pi]); #x, y, t = XY.ar(scale, scale, rot: rot); (x.sin * y.cos) * 7.5 + 0.5; }) ); z.start; z.next; x = GUIScreen.new("pic synth", Rect.newBy(80,80,512,512), z.pic); x.sched(0, inf, { z.next; x.refresh; 0.04 }); ) i don't quite get this line: #x, y, t = XY.ar(scale, scale, rot: rot); first off, why are x, y, and z literals? secondly, what is being done with t? this same line of code seems to produce the same result: #x, y = XY.ar(scale, scale, rot: rot); and... i realize that: (x.sin * y.cos) * 7.5 + 0.5; is the numerical soup for the graphics. but how is this defined as being the output? (i.e. does this line of code have an argument name? it's not assigned to a variable... correct?) i see that (outer) z 'gets' ImageSynth and (outer) x 'gets' GUIScreen and are used for various tasks. i just don't understand what than inner t is doing. cheers, christian ------------------------------ Date: Fri, 31 Aug 2001 14:55:49 -0400 From: christian adam hresko <---@---.---> Subject: Re: what's this t in SC3? christian adam hresko wrote: > finally getting around to SC3. i have a question about the following > patch which i understand except for one or two things: > > ( > var x, z; > z = ImageSynth(Pic.new(Rect.newBy(0,0,512,512), 32), > Synth.new({ > var x, y, t, scale, rot; > scale = MouseX.kr([0,60]); > rot = MouseY.kr([0,4pi]); > #x, y, t = XY.ar(scale, scale, rot: rot); > (x.sin * y.cos) * 7.5 + 0.5; > }) > ); > > z.start; > z.next; > > x = GUIScreen.new("pic synth", Rect.newBy(80,80,512,512), z.pic); > x.sched(0, inf, { z.next; x.refresh; 0.04 }); > ) > > i don't quite get this line: > > #x, y, t = XY.ar(scale, scale, rot: rot); > > first off, why are x, y, and z literals? > > whoops, i meant x, y, and t... c. ------------------------------ Date: Fri, 31 Aug 2001 20:10:32 -0500 (CDT) From: "AUDIOSYNTH.COM" <---@---.---> Subject: Re: *new method returning nil? On Fri, 31 Aug 2001, James Forrest wrote: > > > Foo { > > > var <>synth; > > > > > > *new { > > > var newsynth; > > > newsynth = Synth.new({FSinOsc.ar(440, > > 0)}); > > > newsynth.play; > > > ^super.new.synth_(newsynth) > > > } > > > > > > } > > I have the latest version, and yes, calling > Foo.new.dump does give me a valid object after I stop > the synth by pressing cmd-period. So let me refine my > question. When newsynth.play is called, does the next > line (namely the line that returns the new object) > *not* get interpreted until newsynth is stopped by > pressing cmd-period? Synth.play is a synchronous call in version 2. There is not an async version. > > If this is the case, is there anyway to set up and > start a synth upon initialization of an object (i.e., > in that objects *new method), and be able to then use > that object without stopping the synth first? Before > the synth is stopped, the object is nil because the > *new method has not yet returned. > > Thanks, > Jamie > > > __________________________________________________ > Do You Yahoo!? > Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger > http://im.yahoo.com > ------------------------------ Date: Fri, 31 Aug 2001 20:19:38 -0500 (CDT) From: "AUDIOSYNTH.COM" <---@---.---> Subject: Re: what's this t in SC3? On Fri, 31 Aug 2001, christian adam hresko wrote: > finally getting around to SC3. i have a question about the following > patch which i understand except for one or two things: > > ( > var x, z; > z = ImageSynth(Pic.new(Rect.newBy(0,0,512,512), 32), > Synth.new({ > var x, y, t, scale, rot; > scale = MouseX.kr([0,60]); > rot = MouseY.kr([0,4pi]); > #x, y, t = XY.ar(scale, scale, rot: rot); > (x.sin * y.cos) * 7.5 + 0.5; > }) > ); > > z.start; > z.next; > > x = GUIScreen.new("pic synth", Rect.newBy(80,80,512,512), z.pic); > x.sched(0, inf, { z.next; x.refresh; 0.04 }); > ) > > > > > i don't quite get this line: > > #x, y, t = XY.ar(scale, scale, rot: rot); > > > first off, why are x, y, and z literals? No. #a, b, c = is syntax for multiple assignment. > > secondly, what is being done with t? t is the frame count. It is not used in this code snip, but is one of the values returned by XY. > > this same line of code seems to produce the same result: > > > #x, y = XY.ar(scale, scale, rot: rot); > > > and... i realize that: > > (x.sin * y.cos) * 7.5 + 0.5; > > > is the numerical soup for the graphics. but how is this defined as > being the output? (i.e. does this line of code have an argument name? > it's not assigned to a variable... correct?) > The last expression of a function is the value of the function. The returned value of the synth function is the output. > i see that (outer) z 'gets' ImageSynth and (outer) x 'gets' GUIScreen > and are used for various tasks. i just don't understand what than inner > t is doing. > > > cheers, > > christian > > > > > ------------------------------ Date: Sat, 1 Sep 2001 14:59:33 +0200 From: jr@xs4all.nl (joel ryan) Subject: Re: variable space limits on the Danube well I'm running out of something maybe two somethings there are more than 256 variables at the top of my "program" (what is that thing that you select and hit enter) The editor perhaps has a file size limit The length of this opening prelude code file is 900-1000 lines/52kchars ------------------------------ End of sc-users-digest V1 #350 ******************************