From: owner-sc-users-digest@lists.io.com (sc-users-digest) To: sc-users-digest@lists.io.com Subject: sc-users-digest V1 #9 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 Monday, September 21 1998 Volume 01 : Number 009 ---------------------------------------------------------------------- Date: Thu, 17 Sep 1998 08:40:44 -0600 From: James McCartney <---@---.---> Subject: Re: Tutorial and FAQ (was: Re: bemused . . . yet interested) At 6:39 AM -0600 9/17/98, David Crandall wrote: >there were >many useful patches on the disks already (esp those from Richard Dudas) SC2 has very many more examples than SC1 ever did. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ftp://www.audiosynth.com//pub/updates/SC2d24.sea.hqx ------------------------------ Date: Thu, 17 Sep 1998 09:10:31 -0600 From: James McCartney <---@---.---> Subject: Re: areas folks find more explanation necessary Here's the quick answer to these.. At 5:55 AM -0600 9/17/98, Iannis Zannos wrote: > >**** Compiling discipline, for one. >More detailed questions: > >* Are class variables global between subclasses of the same class >or does each subclass have its own private copy? one copy for all subclasses. > >* Related to this: When to use class variables? classvars are useful when you might need a global variable in a non-OO language. You might glean something from those already in the system. current classvars in the system are: DialogWindow allDialogs - stores all active dialog windows Environment tempo - global tempo GUIWindow allWindows - stores all active windows. GUIWindow generatedCode - stores the generated code for a window. Object dependantsDictionary - a Dictionary of objects and their dependants Object currentEnvironment - the currently active Environment Signal samplesDictionary - not used yet SoundFile searchPaths - a list of path prefixes where to search for files Synth sampleRate - current sample rate Synth defaultBlockSize - default block size used when a new Synth is created The above list (minus my remarks) was generated with the following code: Class.allClasses.do({ arg class; if (class.classVarNames.notNil, { // classVarNames is an Array of Symbols class.classVarNames.do({ arg varname; (class.name.asString ++ " " ++ varname.asString).postln; }) }); }); This raises another possible tutorial topic, which is delving into the class library for information. > >* How to organize the file hierarchy for compiling >(for example the problem with classes from different >branches of the hierarchy posted previously) already discussed. > >**** How the synth works: >How are UGen graphs installed in the synth When you do Synth.new, it evaluates the closure you pass it and remembers all the UGens you create. It then does a topological sort to determine the execution order for the ugens. The sorted ugens are stored in an Array in the 'ugens' instance variable. The outputs are stored in an Array in the 'outputs' instance variable. >and what is the >separation in the system betwen synth tasks (Ugen graphs) and >the rest of the program execution (mostly closures?). When you execute Synth.play, Synth.collect, Synth.write, etc., it calls the C routines that implement the start function for each UGen and then goes into a loop that executes each ugen in the graph. Some of these ugens like Spawn or Sequencer may call SC language code to spawn a Synth, or trigger a value. The loop also calls the Synth tasks when their time is up. When you hit cmd-period, the C stop function for all ugens is called and the loop exits. This is a bit simplified, actually in SYnth.play it calls start and then flags the interrupt level code to run the loop and the interrupt level code flags when it is done and the loop exits back at user level. >Delicate points in this are: >* How to create controls for UGen parameters Anytime you want to control a ugen you need to use something which feeds a signal to the UGen such as a ControlIn object. Then you change the 'source' instance variable of the ControlIn object. You can't pass a variable to the UGen and then change that variable later because it has already been captured at instantiation as a constant. >* or triggers for spawning A trigger can be any ugen graph that produces a signal that goes from <<= 0 to > 0. >* How to poll continuous UGen signals (kr or ar) in >order to obtain scalar values You usually would do this in a Spawn event function where you are polling the value of a UGen defined outside that Spawn. You could also do it in a Sequencer. UGens have a 'poll' method. Just do x = myugen.poll; The very last example in the Spawn help file has an example of this. >further "program logic". Related to this is >also a request which goes into another chapter: >ControlOut and recording kr signals. ControlOut will definitely happen at some point. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ftp://www.audiosynth.com//pub/updates/SC2d24.sea.hqx ------------------------------ Date: Thu, 17 Sep 1998 10:45:08 -0400 (EDT) From: David Crandall <---@---.---> Subject: Re: Tutorial and FAQ (was: Re: bemused . . . yet interested) On Thu, 17 Sep 1998, James McCartney wrote: > SC2 has very many more examples than SC1 ever did. Well, maybe the point is that as a first time user, I found the examples somehow more accessible, maybe because they did simpler things or because the syntax, being less abbreviated was a bit easier to follow. Plus, the manual did help a lot with its introductory chapters and "from the ground up" tutorial. In terms of school use, giving undergrads access to SC2 and saying "figure it out" might be a teacher's nightmare... I'm not trying to be critical, maybe impatient is a better word. And I know SC is still evolving and settling down, so maybe some aspects of a documentation question are premature. But I just think it can be such a great teaching tool, I'll be glad when I can start recommending it as a package, that's all. BTW, I emailed Iannis and said I'd be happy to help if needed once my own MFA is out of the way... dc ------------------------------ Date: Thu, 17 Sep 1998 19:04:18 +0200 From: "Iannis Zannos" <---@---.---> Subject: TSpawn trigger. (crash problems) Got some splendid crashes while trying to modify the last TSpawn.help example in the direction of using .trigger to trigger TSpawn from the GUI. The example below declares tspawn, and freq as globals so they are accessible outside the synth, and prepares variables w and b for a window and a button to trigger the sound respectively. Stopped here because of the crashes. Is there a way of using .trigger other than from within sunth.repeat( ) ? I.Z. ===================================================== var e, tspawn, freq, w, b; e = Env.new(#[0,1,0.25,0],#[0.01, 0.1, 0.3], -4); { arg synth; var output; output = TSpawn.ar({ EnvGen.ar(e, LFSaw.ar(400+1000.0.rand), 0, 0.04) }, 1, nil, 0); // 'output' is an Array of OutputProxys. // In order to access the TSpawn, the 'source' method is applied to 'output'. tspawn = output.source; // schedule several periodic tasks that trigger events // synth.repeat(0.47, { freq = 300; tspawn.trigger }); // synth.repeat(0.30, { freq = 600; tspawn.trigger }); // synth.repeat(0.26, { freq = 900; tspawn.trigger }); // { tspawn.trigger }.value; // THIS CRASHES! // tspawn.trigger; // this also crashes output }.play; ------------------------------ Date: Thu, 17 Sep 1998 19:22:48 +0200 From: "Iannis Zannos" <---@---.---> Subject: Triggering from the GUI - solution OK here is the solution. It only took 10 minutes more. Apologies and: 1. Hope its of use to people who like triggering sounds from the gui like I do. 2. Is there anything that can be done against crashing by mistakes as those below, or a systematic warning for avoiding them? Like: when you evaluate circular references or endless recursion, you know you are going to crash because of memory overflow. What is the rule or reason behind the crashes noted here? var e, tspawn, freq, w, b; w = GUIWindow.new("panel", Rect.new( 740, 80, 951, 170 )); b = CheckBoxView.new( w, Rect.new( 38, 34, 166, 54 ), "CheckBoxView", 0, 0, 1, 0, 'linear'); b.action_({ tspawn.trigger }); e = Env.new(#[0,1,0.25,0],#[0.01, 0.1, 0.3], -4); { arg synth; var output; output = TSpawn.ar({ EnvGen.ar(e, LFSaw.ar(400+1000.0.rand), 0, 0.04) }, 1, nil, 0); // 'output' is an Array of OutputProxys. // In order to access the TSpawn, the 'source' method is applied to 'output'. tspawn = output.source; // schedule several periodic tasks that trigger events // synth.repeat(0.47, { freq = 300; tspawn.trigger }); // synth.repeat(0.30, { freq = 600; tspawn.trigger }); // synth.repeat(0.26, { freq = 900; tspawn.trigger }); // { tspawn.trigger }.value; // THIS CRASHES! // tspawn.trigger; // this also crashes output }.play; ------------------------------ Date: Thu, 17 Sep 1998 13:06:54 -0600 From: James McCartney <---@---.---> Subject: Re: Triggering from the GUI - solution At 11:22 AM -0600 9/17/98, Iannis Zannos wrote: >2. Is there anything that can be done against crashing > by mistakes as those below, or a systematic warning > for avoiding them? Like: when you evaluate circular references > or endless recursion, you know you are going to crash > because of memory overflow. What is the rule or > reason behind the crashes noted here? The reason for these crashes is that I'm not checking that the TSpawn is actually running before trying to add an event. I can fix that and then you'll get an error message. When you are inside the Synth.new function, you are building the synth, so it is not started yet. Therefore you cannot trigger an event there. Events can only be triggered once play has been started. Recursion is not the problem here. I explained previously why I do not check for stack overflow. The interpreter does periodically check for cmd-period in loops. So you can break out of an infinite loop. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ftp://www.audiosynth.com//pub/updates/SC2d24.sea.hqx ------------------------------ Date: Fri, 18 Sep 1998 10:07:16 +1000 From: garth@creativeaccess.com.au (Garth Paine) Subject: Re: Tutorial and FAQ (was: Re: bemused . . . yet interested) >It is motivating to hear that there is interest for an >SC tutorial. I'd like to be able to contribute in that >direction too, but can make no promises. I am primerilly a composer/installation artist. Programming is a tool to achieve my end resuls, and so I haven't spent a lot of time studying programming as such - clearly SC2 needs me to do that, and I am sure it will open up a huge window of development when I do, but a good tutorial would be invaluable. >Stephen T. Pope is all the more to be applauded for >his work on the SC1 tutorial. Indeed - I found it really useful. Cheers, Garth See information about my new immersive interactive sound installation at http://creativeaccess.com.au/~garth/Map1/MaP1_Sound_Installation.html << >< >> . Composer, Sound Designer .. Interactives Designer ... Interactive Installation Artist .... Exhibition Consultant http://www.creativeaccess.com.au/~garth << >< >> ------------------------------ Date: Thu, 17 Sep 1998 22:34:20 +0000 From: kf Oe <---@---.---> Subject: Re: Tutorial and FAQ (was: Re: bemused . . . yet interested) I need to leave ann arbor on tues afternoon the 6th oct. would go for a special night meeting (or two) instead of the post-conference plan...?? ken fields. UC santa barbara (CREATE). ------------------------------ Date: Fri, 18 Sep 1998 10:39:56 +0200 From: "Iannis Zannos" <---@---.---> Subject: Re: Tutorial and FAQ (was: Re: bemused . . . yet interested) >From: kf Oe <---@---.---> >Date: Fri, 18 Sep 1998 12:34 AM >I need to leave ann arbor on tues afternoon the 6th oct. > >would go for a special night meeting (or two) instead >of the post-conference plan...?? Notably the paper sessions start early (8:00) So night meetings (after the concerts) would be particularly taxing and some of us may risk missing an important morning session. Would consider fitting in a meeting at lunch or in the afternoon between the two pm concerts. Possible slots (in order of practicability, with clashing events also noted ): Saturday 11:10 am - 1:00 pm ( - ) Friday 5:00 - 8:00 PM (MIT Press/CMJ Reception) Saturday 5:00 - 8:00 PM (ICMC Banquet!) Sunday 5:00 - 8:00 PM ( - ) I put Sunday last for me even though its the longest slot with no clashes, because there is the possibility of some other commitment. Iannis Zannos SIM ------------------------------ Date: Fri, 18 Sep 1998 16:28:29 +0100 From: finer@easynet.co.uk Subject: TSpawn and GUI I've tried to modify Iannis's patch so that one can turn on a sound (or anything else I guess) from a GUI and have it keep spawning - until one decides to turn it off. That's where I'm stuck : ( var e, tspawn, freq, w, b; w = GUIWindow.new("panel", Rect.new( 740, 80, 951, 170 )); b = CheckBoxView.new( w, Rect.new( 38, 34, 166, 54 ), "CheckBoxView", 0, 0, 1, 0, 'linear'); b.action_({if(b.value>0, {tspawn.trigger},{tspawn.trig=0}) }); //switch on / switch off e = Env.new(#[0,1,0.25,0],#[0.01, 0.1, 0.3], -4); { arg synth; var output; output = TSpawn.ar({ EnvGen.ar(e, LFSaw.ar(400+1000.0.rand), 0, 0.04,0,1,LFPulse.ar(2,0.5,2,-1)) }, 1, nil, 0); // 'output' is an Array of OutputProxys. // In order to access the TSpawn, the 'source' method is applied to 'output'. tspawn = output.source; output }.play; ) It switches on fine but i'm not sure how to stop it. I tried tspawn.stop to no avail and now trying tspawn.trig = 0 it does stop but only because it crashes - a bit drastic ! Also - and I apologise for what might be another FAQing annoying question - what is an OutputProxy exactly and why can't we simply say tspawn = TSpawn.ar etc , forget the line tspawn = output.source and then just say tspawn instead of output ? I know that part of the answer is that it doesn't work ! Thanks, Jem Jem Finer Kentish Town London NW5 finer@easynet.co.uk 44 171 267 6416 ------------------------------ Date: Fri, 18 Sep 1998 18:41:23 +0200 From: "Iannis Zannos" <---@---.---> Subject: Re: TSpawn and GUI Correction to my previous code: { b.model_(this.fade(b)) }, is superfluous { this.fade(b) }, is enough. Also sorry for the wrapping of the lines by the emailer. Watch out for // commented lines that may be "uncommented by this wrapping. Next I will make all my comments /* */ style so this problem does not occur. Iannis Z. SIM ------------------------------ Date: Fri, 18 Sep 1998 21:14:18 +0100 From: finer@easynet.co.uk Subject: TSpawn & GUI I've tried to modify Iannis's patch so that one can turn on a sound (or anything else I guess) from a GUI and have it keep spawning - until one decides to turn it off. That's where I'm stuck : ( var e, tspawn, freq, w, b; w = GUIWindow.new("panel", Rect.new( 740, 80, 951, 170 )); b = CheckBoxView.new( w, Rect.new( 38, 34, 166, 54 ), "CheckBoxView", 0, 0, 1, 0, 'linear'); b.action_({if(b.value>0, {tspawn.trigger},{tspawn.trig=0}) }); //switch on / switch off e = Env.new(#[0,1,0.25,0],#[0.01, 0.1, 0.3], -4); { arg synth; var output; output = TSpawn.ar({ EnvGen.ar(e, LFSaw.ar(400+1000.0.rand), 0, 0.04,0,1,LFPulse.ar(2,0.5,2,-1)) }, 1, nil, 0); // 'output' is an Array of OutputProxys. // In order to access the TSpawn, the 'source' method is applied to 'output'. tspawn = output.source; output }.play; ) It switches on fine but i'm not sure how to stop it. I tried tspawn.stop to no avail and now trying tspawn.trig = 0 it does stop but only because it crashes - a bit drastic ! Also - and I apologise for what might be another FAQing annoying question - what is an OutputProxy exactly and why can't we simply say tspawn = TSpawn.ar etc , forget the line tspawn = output.source and then just say tspawn instead of output ? I know that part of the answer is that it doesn't work ! Thanks, Jem Jem Finer Kentish Town London NW5 finer@easynet.co.uk 44 171 267 6416 ------------------------------ Date: Fri, 18 Sep 1998 21:48:10 +0000 From: kf Oe <---@---.---> Subject: icmc saturday (11:30) is a good idea, even if it is just to touch base and discuss logistics. ??? ken ------------------------------ Date: Sat, 19 Sep 98 14:31:53 +0100 From: Cohen Veliscek <---@---.---> Subject: HELP_HELP_HELP hi, Once upon a time (it's a true story), my lovely dear boyfriend decided to suscribe to your mailing list. He's quite interested in the purpose of this list in fact. Then, he bought another modem and has now his own connexion. Since then, I keep on receiving all the messages of the list, and I don't want to. PLEASE, PLEASE, PLEASE, dear webmaster or whoever, can you help me to remove this suscribtion from my E-mail box. My E-mail adress is cclv@micronet.fr Thank you to pay attention to my message. Bye. Cecile. ------------------------------ Date: Sat, 19 Sep 1998 09:04:07 -0600 From: James McCartney <---@---.---> Subject: Re: TSpawn and GUI At 9:28 AM -0600 9/18/98, finer@easynet.co.uk wrote: >I've tried to modify Iannis's patch so that one can turn on a sound (or >anything else I guess) from a GUI and have it keep spawning - until one >decides to turn it off. There was also another patch Iannis posted a while back that did this and is now the last example in the GUI examples file in SC2d24. Have a look at that. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ftp://www.audiosynth.com//pub/updates/SC2d24.sea.hqx ------------------------------ Date: Sat, 19 Sep 1998 09:02:18 -0600 From: James McCartney <---@---.---> Subject: Re: TSpawn and GUI Sorry if you see this twice. Did you receive this yesterday? I sent two replies to this thread yesterday but never saw them come through the list. I also did not receive any mail from the list for most of yesterday. The ISP tells me it was not down, but I'm not sure. ============ A simpler way to turn on and off a process is to use Pause. ( var e, tspawn, freq, w, b; w = GUIWindow.new("panel", Rect.new( 140, 80, 351, 170 )); b = CheckBoxView.new( w, Rect.new( 38, 34, 166, 54 ), "RUN", 0, 0, 1, 0, 'linear'); { arg synth; Pause.ar({ var f; f = LFSaw.kr(0.4, 24, LFSaw.kr([8,7.23], 3, 80)).midicps; CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4) }, b.kr(0) // control with check box with no lag time. ) }.play; ) > >Also - and I apologise for what might be another FAQing annoying question - >what is an OutputProxy exactly and why can't we simply say tspawn = >TSpawn.ar etc , forget the line tspawn = output.source and then just say >tspawn instead of output ? >I know that part of the answer is that it doesn't work ! TSpawn.ar does not return a TSpawn object. TSpawn.ar returns an Array of OutputProxies. These are place holders for each single channel of its output. All unit generators that have multiple outputs return Array of OutputProxies. In order for multi channel expansion to work and to allow you to do list operations upon channel arrays, unit generators may only have a single output. An OutputProxy is a fake unit generator that acts as an output for another unit generator. For example I can do this: #left, right = Spawn.ar({...}, 2, 1); left and right now refer to the left and right output channels of the Spawn. However left and right are OutputProxies, not Spawns. In order to find the source of the OutputProxy you must send the 'source' message to it. Array also responds to source by returning the source for its first element. Since the output is an array I can also do something like: Spawn.ar({...}, 2, 1).reverse; Which reverses the outputs of the Spawn. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ftp://www.audiosynth.com//pub/updates/SC2d24.sea.hqx ------------------------------ Date: Sat, 19 Sep 1998 08:34:05 -0500 (CDT) From: antiorp@tezcat.com (=cw4t7abs) Subject: Re: >hi, > >Once upon a time (it's a true story), my lovely dear boyfriend decided to >suscribe to your mailing list. He's quite interested in the purpose of >this list in fact. Then, he bought another modem and has now his own >connexion. Since then, I keep on receiving all the messages of the list, >and I don't want to. publ!k d!zpla!z ov adorat!on = ultra zupr ------------------------------ Date: Sat, 19 Sep 1998 17:46:50 +0100 From: finer@easynet.co.uk Subject: command - period (resent) James, Is there a way to check for command period. I'd like to be able to close all gui windows etc automatically when I switch off. thanks, Jem Jem Finer Kentish Town London NW5 finer@easynet.co.uk 44 171 267 6416 ------------------------------ Date: Sat, 19 Sep 1998 17:45:05 +0100 From: finer@easynet.co.uk Subject: mail problem James said : >Sorry if you see this twice. Did you receive this yesterday? >I sent two replies to this thread yesterday but never saw them come >through the list. I also did not receive any mail from the list for >most of yesterday. The ISP tells me it was not down, but I'm not sure. Had the same experience - I sent 4 letters (twice - not because they were so good but they never came back) and have only seen 1. I'll send the others again. Jem Jem Finer Kentish Town London NW5 finer@easynet.co.uk 44 171 267 6416 ------------------------------ Date: Sat, 19 Sep 1998 17:46:07 +0100 From: finer@easynet.co.uk Subject: tutorials and FAQs (resent) I too would much rather approach SmallTalk (and OOP in general) via SC2 rather than the other way round. I've looked at the SmallTalk book james recommended but it's a bit hard to get fired up looking at examples about banking programs. some questions that spring to mind for FAQ or tutorial : FFT - how to get at each frequency band. eg for filtering Tables - can/will we be able to draw them ? Tables - how to save them ? Files - saving settings to patches and recalling them. Feedback - oscillators each of whose output is the others input ie mutually dependant/chaotic The hidden world of SC2 (ie all the stuff coming bit by bit regarding OOP, the virtual machine and its workings). Graphics - will SC2 ever have graphics capability ? Bass - how to get very heavy bass sounds ! I/O - how to persuade someone to make proper I/O for PowerBooks etc. RE ICMC Much as I'd love a trip to the States it's a bit impractical at the moment BUT if anyone wanted to meet up in europe somewhere for a drink and a chat about SC . . . . Cheers, Jem Jem Finer Kentish Town London NW5 finer@easynet.co.uk 44 171 267 6416 ------------------------------ Date: Sat, 19 Sep 1998 19:00:01 +0100 From: finer@easynet.co.uk Subject: more re GUI and TSpawn >There was also another patch Iannis posted a while back that did >this and is now the last example in the GUI examples file in SC2d24. >Have a look at that. Yes - I've been using that method for a while but as I add more and more Spawns, checking to see if a certain button is on, the CPU goes up and I was looking for a more 'economical' way to be able to switch things on and off. Thus I thought that Iannis's new .action idea might be the answer. I noticed on your pause example that it has 12 ugens going and uses around 2% cpu on average until one hits the button when cpu shoots up to around 25%. I think I've been misunderstanding the relationship of ugens and cpu %. I've been trying to minimise the no. of ugens until I 'need' them. So to organise a program wherein lots of different processes, sounds etc are switched on by a button I've used the early Iannis Spawn approach (like the last example in the gui examples) where a process is only called when the appropriate button is on and the ugens are only created at that point. BUT your pause example has led me to wonder about this whole area of cpu and ugens. Hoping there's a simple explanation ! Thanks, jem Jem Finer Kentish Town London NW5 finer@easynet.co.uk 44 171 267 6416 ------------------------------ Date: Sat, 19 Sep 1998 13:44:20 -0600 From: James McCartney <---@---.---> Subject: Re: command - period (resent) At 10:46 AM -0600 9/19/98, finer@easynet.co.uk wrote: >James, > >Is there a way to check for command period. >I'd like to be able to close all gui windows etc automatically when I >switch off. No, but a completion function here would be a good idea. However you can do the following: ( // make your window... w = GUIWindow.new... Synth.play({...}); // close the window: w.close; ) ( // make your windows... w = GUIWindow.new... x = GUIWindow.new... y = GUIWindow.new... Synth.play({...}); // close all windows en masse: GUIWindow.allWindows.copy.do({ arg window; window.close }); ) You have to make a copy of the window list above because GUIWindow close alters that list, and it is not a good idea to iterate over a list while it is being altered. There is also for dialogs: DialogWindow.allDialogs.copy.do({ arg dialog; dialog.close }); --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ftp://www.audiosynth.com//pub/updates/SC2d24.sea.hqx ------------------------------ Date: Sat, 19 Sep 1998 14:14:54 -0600 From: James McCartney <---@---.---> Subject: Re: more re GUI and TSpawn At 12:00 PM -0600 9/19/98, finer@easynet.co.uk wrote: >>There was also another patch Iannis posted a while back that did >>this and is now the last example in the GUI examples file in SC2d24. >>Have a look at that. > >Yes - I've been using that method for a while but as I add more and more >Spawns, checking to see if a certain button is on, the CPU goes up and I >was looking for a more 'economical' way to be able to switch things on and >off. >Thus I thought that Iannis's new .action idea might be the answer. The extra overhead comes from adding together multiple Spawns. But using a synth task to trigger events and a TSpawn, you could write a single Spawn that ran several tasks at once and there for used less overhead. I will post an example later. > >I noticed on your pause example that it has 12 ugens going and uses around >2% cpu on average until one hits the button when cpu shoots up to around >25%. > >I think I've been misunderstanding the relationship of ugens and cpu %. >I've been trying to minimise the no. of ugens until I 'need' them. >So to organise a program wherein lots of different processes, sounds etc >are switched on by a button I've used the early Iannis Spawn approach (like >the last example in the gui examples) where a process is only called when >the appropriate button is on and the ugens are only created at that point. > >BUT your pause example has led me to wonder about this whole area of cpu >and ugens. >Hoping there's a simple explanation ! The UGens display is the number that are currently started. However Pause will pause the ugens it controls so that they take no CPU time, even though they will still be displayed in the active count. You notice when you unpause it, it picks up from where it left off. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ftp://www.audiosynth.com//pub/updates/SC2d24.sea.hqx ------------------------------ Date: Sat, 19 Sep 1998 14:07:36 -0600 From: James McCartney <---@---.---> Subject: Re: tutorials and FAQs (resent) At 10:46 AM -0600 9/19/98, finer@easynet.co.uk wrote: >I too would much rather approach SmallTalk (and OOP in general) via SC2 >rather than the other way round. I've looked at the SmallTalk book james >recommended but it's a bit hard to get fired up looking at examples about >banking programs. Yes I can completely understand this. However there is a whole lot of literature out there on Smalltalk, OO, and design,that is relevant and it would take quite some time to recapitulate the entire literature in SC2. It is much harder due to the power of the language to write some manual and say "here's everything you could ever know" about it, because I'm still learning things all the time about things that are possible. Quick answers : >some questions that spring to mind for FAQ or tutorial : > >FFT - how to get at each frequency band. eg for filtering Currently problematic. More ugens specifically for spectral manipulation are needed. >Tables - can/will we be able to draw them ? There is WavetableView. Look at the first example in the gui examples file. Eval it. Now bring the table window to the front and click in the view while holding the cmd key down. Also try it with the option key and also the control key (each separately). >Tables - how to save them ? Convert them to a Signal and save as a SoundFile, or save as raw data with the File methods. >Files - saving settings to patches and recalling them. I need to write a dialog to get a pathname from the user. >Feedback - oscillators each of whose output is the others input ie mutually >dependant/chaotic The only way to get single sample feedback is to run at a 1 sample block size and use DelayWr Tap. This would be made easier if I wrote a single control period FeedbackOut and FeedbackIn. (Feedback has to be separated into two ugens so that the ugen graph can remain acyclic. >Graphics - will SC2 ever have graphics capability ? Its on the list. >Bass - how to get very heavy bass sounds ! ..might try messing around with Pulse and RLPF4. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ftp://www.audiosynth.com//pub/updates/SC2d24.sea.hqx ------------------------------ Date: Sat, 19 Sep 1998 14:43:50 -0600 From: James McCartney <---@---.---> Subject: Re: more re GUI and TSpawn At 2:14 PM -0600 9/19/98, James McCartney wrote: >But using a synth task to trigger events and a TSpawn, you could write >a single Spawn that ran several tasks at once and there for used less overhead. >I will post an example later. ( // Synth task scheduling var w, e; w = GUIWindow.new("panel", Rect.new( 139, 64, 367, 182 )); CheckBoxView.new( w, Rect.new( 15, 15, 143, 35 ), "task 1", 0, 0, 1, 0, 'linear'); CheckBoxView.new( w, Rect.new( 15, 39, 143, 59 ), "task 2", 0, 0, 1, 0, 'linear'); CheckBoxView.new( w, Rect.new( 15, 63, 143, 83 ), "task 3", 0, 0, 1, 0, 'linear'); e = Env.new(#[0,1,0.25,0],#[0.01, 0.1, 0.3], -4); { arg synth; var which, output, tspawn; output = TSpawn.ar({ arg argTSpawn, i, synth; [ { EnvGen.ar(e, LFSaw.ar(200), 0, 0.04) }, { EnvGen.ar(e, FSinOsc.ar(1200), 0, 0.04) }, { EnvGen.ar(e, WhiteNoise.ar, 0, 0.04) } ].at(which).value; }, 1, nil, 0); tspawn = output.source; // schedule several periodic tasks that trigger events synth.repeat(0.47, { if (w.at(0).value > 0, { which=0; tspawn.trigger }) }); synth.repeat(0.30, { if (w.at(1).value > 0, { which=1; tspawn.trigger }) }); synth.repeat(0.26, { if (w.at(2).value > 0, { which=2; tspawn.trigger }) }); output }.play; w.close; ) --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ftp://www.audiosynth.com//pub/updates/SC2d24.sea.hqx ------------------------------ Date: Sat, 19 Sep 1998 23:25:53 -0700 From: csz@wco.com (Carter Scholz) Subject: Re: tutorials and FAQs (resent) >The only way to get single sample feedback is to run at a 1 sample >block size and use DelayWr Tap. This would be made easier if I wrote >a single control period FeedbackOut and FeedbackIn. (Feedback has to >be separated into two ugens so that the ugen graph can remain acyclic. > Yes, please. Another vote for FeedbackOut and FeedbackIn. ------------------------------ Date: Mon, 21 Sep 1998 12:40:16 +0200 From: "Iannis Zannos" <---@---.---> Subject: Re: tutorials and FAQs (resent) At 10:46 AM -0600 9/19/98, finer@easynet.co.uk wrote: > >>Bass - how to get very heavy bass sounds ! > >..might try messing around with Pulse and RLPF4. One might add that a sound card is really important in this respect as built-in Mac DA is bound to be the first real bottleneck (weak link) in the audio chain from the SC output signal onwards. Bass is one of the things that suffers most. That, in addition to multichannel output for spatialization is the reason why a sound card greatly enhances the effect of SC applications. AFAIK there are no sound card drivers yet available on SC2.0d24. I hope that the first driver to be realized will be Korg 1212, as following some discussion in this list I ordered one... Iannis Z. SIM ------------------------------ Date: Mon, 21 Sep 1998 12:56:04 +0200 From: "Iannis Zannos" <---@---.---> Subject: Pause and graceful fadeout >From: James McCartney <---@---.---> >Date: Sat, 19 Sep 1998 10:14 PM > >The UGens display is the number that are currently started. However >Pause will pause the ugens it controls so that they take no CPU time, >even though they will still be displayed in the active count. >You notice when you unpause it, it picks up from where it left off. > > Clarification question. From the Pause doc: Pause is used to switch a process on and off in order to conserve CPU usage. When the level input drops below zero, the process in the ugen graph function is paused. Does this mean that Pause will pause the Ugen *at the next zero crossing in downward direction* Implications: - - The sound will not stop immediately but with a usually negligible delay - - Pause stops the sound in the cheapest and fastest way that will avoid clicks - - If you do have a signal with unusually infrequent 0 crossings, Pause may take indefinite time to work, but such signals should definitely not be common practice. Do the above assumptions hold? Iannis Z. SIM ------------------------------ Date: Mon, 21 Sep 1998 12:58:58 +0200 From: "Iannis Zannos" <---@---.---> Subject: Re: icmc OK with me! However, we will previously meet at the SC Demo on Friday, I hope... See you in Ann Arbor. - ---------- >From: kf Oe <---@---.---> >To: sc-users@lists.io.com >Subject: icmc >Date: Fri, 18 Sep 1998 11:48 PM > >saturday (11:30) is a good idea, even if it is >just to touch base and discuss logistics. ??? > >ken > ------------------------------ Date: Mon, 21 Sep 1998 13:47:08 +0100 From: finer@easynet.co.uk Subject: re inventing vocoding Hello, Thanks for all the help ! Now then . . . . . I've been trying to make an fft filter, the theory being that if I multiplied the magnitude of the fft by a signal of the same length it would filter out fft's amplitudes where the signal = 0 etc. Therefore by drawing in the wavetable view one could alter the filter - a bit like the fft filter I've seen in MSP. The only way I managed to get it to run was to put the filter signal in an Osc.ar whose frequency I tried to get to match what I thought might be the frequency of the fft buffers being output. So I seem to have managed to re invent vocoding ! The only useful thing, if any, is that it makes it quite easy to experiment with different waveforms as a source for the cross synthesis while the patch plays. Patch enclosed below. I still can't quite manage to save a wavetable - I can get a file saved but it always seems to be empty ! Any advances toward the filter idea and a hand with saving a Wavetable would be wonderful. All the best, Jem ( // filter . . . or not { var fftsize, numffts, fftoffsets, window, cosineTable; var input, threshhold, gate, filter; var src1, fft1, fft2, ifft, out; numffts = 2; // number of overlapped FFTs fftsize = 512; // length of FFT buffer // make offsets for staggering overlapped FFTs fftoffsets = Array.series(numffts, 0, fftsize/numffts); window = Signal.welchWindow(fftsize); // make a signal analysis/synthesis window cosineTable = Signal.fftCosTable(fftsize); // make cosine table required for FFT filter = Signal.newClear(fftsize).sineFill(1/1).abs.asWavetable; filter.plot; threshhold = 0.01 * fftsize; src1 = AudioIn.ar(0); fft1 = FFT.ar(fftsize, fftoffsets, cosineTable, window, nil, src1, 0.0); // transform src1 // multiply amplitudes of fft1 by wavetable 'filter' fft2 = fft1.magnitudeApx * Osc.ar(filter,1/(fftsize/44100)); // inverse transform ifft = IFFT.ar(fftsize, fftoffsets, cosineTable, nil, window, fft2.real, fft2.imag); out = Mix.ar(ifft.real); // mix overlapped outputs out/numffts }.scope(0.1); ) Jem Finer Kentish Town London NW5 finer@easynet.co.uk 44 171 267 6416 ------------------------------ Date: Mon, 21 Sep 1998 08:24:19 -0600 From: James McCartney <---@---.---> Subject: Re: Pause and graceful fadeout At 4:56 AM -0600 9/21/98, Iannis Zannos wrote: >Clarification question. From the Pause doc: > >Pause is used to switch a process on and off in order >to conserve CPU usage. When the level input drops >below zero, the process in the ugen graph function is paused. > >Does this mean that Pause will pause the Ugen >*at the next zero crossing in downward direction* >Implications: >- The sound will not stop immediately but with a usually > negligible delay >- Pause stops the sound in the cheapest and fastest > way that will avoid clicks >- If you do have a signal with unusually infrequent > 0 crossings, Pause may take indefinite time to work, > but such signals should definitely not be common practice. The control signal is a control rate signal. The sound will be paused the instant that the control signal drops to equal or below zero. The sound is stopped immediately. There will be no clicks as long as you are running at some control rate that gives some samples to fade, such as 64 samples per control period (the default). One thing to be aware of is that things with an exponential decay theoretically never reach zero. However SC clamps exponential decays to their end value once they get to within 1e-10 (-200dB). This allows certain optimizations to happen. Thus if you have a decay with a 60dB decay time of 1 second, it will take 200/60 = 3.33 seconds for the sound to pause. You could hasten this by adding a small negative offset. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ftp://www.audiosynth.com//pub/updates/SC2d24.sea.hqx ------------------------------ End of sc-users-digest V1 #9 ****************************