From: owner-sc-users-digest@lists.io.com (sc-users-digest) To: sc-users-digest@lists.io.com Subject: sc-users-digest V1 #19 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, December 7 1998 Volume 01 : Number 019 ---------------------------------------------------------------------- Date: Thu, 03 Dec 1998 17:28:24 +0100 From: "Iannis Zannos" <---@---.---> Subject: Combining controllers, when is poll needed? (Was: Re Questions - Michael Laurson) Michael, here a first response to your code in the direction of continuously controlled parameters for physical modeling et al. It seems to me you are trying to combine controllers by polling, while in this particular case it is not necessary. Many binary operators can be used to combine any UGens (a-rate or k-rate) into UGen graphs forming thus new, composite UGens. I add below a "radically simplified rewrite" of your example following by modifications showing how mouse or any other continuous controller can be added on top, without polling. The result of my rewrite example 2 is in my view equivalent to your original example while being simpler and faster. But you may be in fact looking for something that is extensible for more complex situations as your plan description suggests: > ... Also it would handle the >interaction between strings ("symphatetic" effects). ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Probably you are preparing controllers that can be shared between a number of separate synthesis generators. Also this can be done directly without polling. Example below 6 shows how. If you mean something else, please post, I would be interested. Regards Iannis Zannos SIM Tiergartenstr. 1, D-10785 Berlin, Germany Fax: +49 30 25481172 =============================================== ( // Step 1. Simplest illustration with just one note: { arg synth; var fund = 440, attacktime = 0.01, ampenv, freqenv, dur = 1.5; ampenv = Env.new([0,1,1,0],[attacktime,0.8,0.1],'linear'); freqenv = Env.new([fund,fund+100,fund],[0.5,0.5],'linear'); SinOsc.ar(EnvGen.kr(freqenv,1, 0, 1, 0, dur), 0, EnvGen.kr(ampenv,0.3 ,0,1,0, dur)); }.play; ) ( // Step 2: With repeat: { arg synth; var fund = 440, attacktime = 0.01, ampenv, freqenv, dur = 1.5; var repeats = 5, pause = 0.5; ampenv = Env.new([0,1,1,0],[attacktime,0.8,0.1],'linear'); freqenv = Env.new([fund,fund+100,fund],[0.5,0.5],'linear'); Spawn.ar({ SinOsc.ar(EnvGen.kr(freqenv,1, 0, 1, 0, dur), 0, EnvGen.kr(ampenv,0.3 ,0,1,0, dur)); }, 1, pause + dur, repeats) }.play; ) ( // Step 3: With extra control of frequency per mouse x. { arg synth; var fund = 440, attacktime = 0.01, ampenv, freqenv, dur = 1.5; var repeats = 5, pause = 0.5; ampenv = Env.new([0,1,1,0],[attacktime,0.8,0.1],'linear'); freqenv = Env.new([fund,fund+100,fund],[0.5,0.5],'linear'); Spawn.ar({ SinOsc.ar( MouseX.kr(-200, 2000) + EnvGen.kr(freqenv,1, 0, 1, 0, dur), 0, EnvGen.kr(ampenv, 0.3, 0, 1, 0, dur)); }, 2, pause + dur, repeats) }.play; ) ( // Step 4: adding (freq-) vibrato { arg synth; var fund = 440, attacktime = 0.01, ampenv, freqenv, dur = 1.5; var repeats = 5, pause = 0.5; ampenv = Env.new([0,1,1,0],[attacktime,0.8,0.1],'linear'); freqenv = Env.new([fund,fund+100,fund],[0.5,0.5],'linear'); Spawn.ar({ SinOsc.ar( EnvGen.kr(freqenv,1, 0, 1, 0, dur) + SinOsc.kr(5, 0, 40), 0, EnvGen.kr(ampenv, 0.3, 0, 1, 0, dur)); }, 2, pause + dur, repeats) }.play; ) ( // Step 5: With control of (freq-) vibrato per mouse y *and* mouse y. { arg synth; var fund = 440, attacktime = 0.01, ampenv, freqenv, dur = 3; var repeats = 5, pause = 0.5; ampenv = Env.new([0,1,1,0],[attacktime,0.8,0.1],'linear'); freqenv = Env.new([fund,fund+100,fund],[0.5,0.5],'linear'); Spawn.ar({ SinOsc.ar( EnvGen.kr(freqenv,1, 0, 1, 0, dur) + SinOsc.kr(MouseX.kr(0, 15), 0, MouseY.kr(0, 50)), 0, EnvGen.kr(ampenv, 0.3, 0, 1, 0, dur)); }, 2, pause + dur, repeats) }.play; ) ( // Step 6: Sharing controllers in multiple generators // i.e. 2 "sine exciters" controlled by the same // vibrato'd envelope. { arg synth; var fund = 440, attacktime = 0.01, ampenv, freqenv, dur = 3; var repeats = 5, pause = 0.5; var loudness = 0.3, fcontroller; ampenv = Env.new([0,1,1,0],[attacktime,0.8,0.1],'linear'); freqenv = Env.new([fund,fund+100,fund],[0.5,0.5],'linear'); Spawn.ar({ var fcontroller; fcontroller = EnvGen.kr(freqenv,1, 0, 1, 0, dur) + SinOsc.kr(MouseX.kr(0, 15), 0, MouseY.kr(0, 50)); SinOsc.ar(fcontroller, 0, EnvGen.kr(ampenv, loudness / 2, 0, 1, 0, dur)) + SinOsc.ar(fcontroller * 1.2, 0, EnvGen.kr(ampenv, loudness / 2, 0, 1, 0, dur)); }, 2, pause + dur, repeats) }.play; ) ------------------------------ Date: Thu, 03 Dec 1998 12:01:08 +0000 From: mary <---@---.---> Subject: Re: Questions - Creamware Pulsar > I beleive ASIO supports that, so if Steinberg ever lets me get ASIO > then SC will through ASIO. Currently they tell me they are "reviewing" > my case.. > > Will you be supporting the ProjectII Digidesign card. It uses ASIO also. Mary ------------------------------ Date: Thu, 3 Dec 1998 11:17:58 -0600 From: James McCartney <---@---.---> Subject: Re: Combining controllers, when is poll needed? (Was: Re Questions - Michael Laurson) The anal(-?)retentive efficiency elf says: Since the MouseX is the same for every spawned instance you can move it outside of the Spawn which will save some CPU time allocating UGens. ( // Step 3: With extra control of frequency per mouse x. { arg synth; var fund = 440, attacktime = 0.01, ampenv, freqenv, dur = 1.5; var repeats = 5, pause = 0.5; var mousex; ampenv = Env.new([0,1,1,0],[attacktime,0.8,0.1],'linear'); freqenv = Env.new([fund,fund+100,fund],[0.5,0.5],'linear'); mousex = MouseX.kr(-200, 2000); Spawn.ar({ SinOsc.ar( mousex + EnvGen.kr(freqenv,1, 0, 1, 0, dur), 0, EnvGen.kr(ampenv, 0.3, 0, 1, 0, dur)); }, 2, pause + dur, repeats) }.play; ) And similarly for the other examples. When you would not want to do this is if you gave different min/max/lag values for each spawned MouseX. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Thu, 03 Dec 1998 19:06:15 +0100 From: "Iannis Zannos" <---@---.---> Subject: elf efficiency (Re: Combining controllers, ...) > >The anal(-?)retentive efficiency elf says: > >Since the MouseX is the same for every spawned instance you can move >it outside of the Spawn which will save some CPU time allocating UGens. Thank you elf. If you ar still or once again around in cyberspace, please tell us also: What about EnvGens: EnvGen.kr(ampenv, 0.3, 0, 1, 0, dur) can one use safely just one copy also for running envs? The bipolar troll. (Who fears that SC may collapse when people start spawning multitudes of events in hypercomplex postwagnerian or postconstructivist pieces.) Making it clear when to share UGen instances or when to create new ones for each spawned synth is a point that would go well in an extended tutorial or users manual. - ---------- >From: James McCartney <---@---.---> >To: sc-users@lists.io.com >Subject: Re: Combining controllers, when is poll needed? (Was: Re Questions - Michael Laurson) >Date: Thu, 3 Dec 1998 6:17 PM > > >The anal(-?)retentive efficiency elf says: > >Since the MouseX is the same for every spawned instance you can move >it outside of the Spawn which will save some CPU time allocating UGens. > >( // Step 3: With extra control of frequency per mouse x. >{ arg synth; > var fund = 440, attacktime = 0.01, ampenv, freqenv, dur = 1.5; > var repeats = 5, pause = 0.5; > var mousex; > > ampenv = Env.new([0,1,1,0],[attacktime,0.8,0.1],'linear'); > freqenv = Env.new([fund,fund+100,fund],[0.5,0.5],'linear'); > mousex = MouseX.kr(-200, 2000); > > Spawn.ar({ > SinOsc.ar( > mousex + EnvGen.kr(freqenv,1, 0, 1, 0, dur), > 0, EnvGen.kr(ampenv, 0.3, 0, 1, 0, dur)); > }, 2, pause + dur, repeats) >}.play; >) > >And similarly for the other examples. > >When you would not want to do this is if you gave different min/max/lag >values for each spawned MouseX. > > > --- james mccartney james@audiosynth.com http://www.audiosynth.com >If you have a PowerMac check out SuperCollider2, a real time synth program: > > > > > > ------------------------------ Date: Thu, 3 Dec 1998 12:27:34 -0600 From: James McCartney <---@---.---> Subject: Re: elf efficiency (Re: Combining controllers, ...) At 12:06 PM -0600 12/3/98, Iannis Zannos wrote: >> >>The anal(-?)retentive efficiency elf says: >> >>Since the MouseX is the same for every spawned instance you can move >>it outside of the Spawn which will save some CPU time allocating UGens. > >Thank you elf. >If you ar still or once again around in cyberspace, please tell us also: > >What about EnvGens: >EnvGen.kr(ampenv, 0.3, 0, 1, 0, dur) > >can one use safely just one copy also for running envs? The only controls that you can do this way are those which have the same value at each moment in time for all voices, i.e. a global controller. For example if you want to put an amplitude envelope over each event then you'd need a separate one for each event. If you want to control some parameter in a group of events in sync then you only need one EnvGen. The EnvGens in the given example must all be inside the Spawn. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Thu, 03 Dec 1998 16:34:13 -0700 From: "Mark Ullrich" <---@---.---> Subject: OrcSco and sound files Can someone forward me a simple example of a sound file (and where to store the file) implemented by an OrcSco and how to apply an envelope. thanks! Mark Ullrich Get your FREE Email at http://mailcity.lycos.com Get your PERSONALIZED START PAGE at http://personal.lycos.com ------------------------------ Date: Fri, 4 Dec 1998 01:36:07 +0100 (CET) From: Arie van Schutterhoef <---@---.---> Subject: Re: Questions - Creamware Pulsar >But I am also interested in the Creamware Pulsar. >Will SC be supporting it when the Mac version is out? If so, does this also mean that there is a possibility of using the Pulsar's four SHARC dsp's for additional SC-processing, or is this just restricted to I/O? Arie van Schutterhoef Schreck Ensemble laboratory for live electro-acoustic music Holland http://www.xs4all.nl/~schreck/ ------------------------------ Date: Thu, 3 Dec 1998 18:56:03 -0600 From: James McCartney <---@---.---> Subject: Re: Questions - Creamware Pulsar At 6:36 PM -0600 12/3/98, Arie van Schutterhoef wrote: >>But I am also interested in the Creamware Pulsar. >>Will SC be supporting it when the Mac version is out? > > >If so, does this also mean that there is a possibility >of using the Pulsar's four SHARC dsp's for additional >SC-processing, or is this just restricted to I/O? SC will just see it as an output device. Whether you can route those outputs to additional processing on the Pulsar is unknown to me. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Fri, 4 Dec 1998 15:44:24 +0000 From: finer@easynet.co.uk Subject: sorry I might have missed . . . . . . . . a discussion re GUIutils in which the problem is that when follows the instructions - create an alias for GUIutils and puts it in common etc. and tries to recompile SC freezes. Just wondering how to make it work. Jem ------------------------------ Date: Fri, 04 Dec 1998 17:37:59 +0100 From: "Iannis Zannos" <---@---.---> Subject: Re: sorry I might have missed . . . . Jem, >Just wondering how to make it work. I just tested it for the first time with SC2.d29 as it is in the ReadMe file given by James. IT WORKS. The answer is: get the latest SC version now - it's fixed there. Sorry I cannot post my newest version with the LabeledArrayV this weekend. Till next week then... Iannis Zannos SIM Tiergartenstr. 1, D-10785 Berlin, Germany Fax: +49 30 25481172 > >. . . . a discussion re GUIutils in which the problem is that when follows >the instructions - create an alias for GUIutils and puts it in common etc. >and tries to recompile SC freezes. > >Just wondering how to make it work. > >Jem > ------------------------------ Date: Fri, 4 Dec 1998 19:08:41 +0200 From: laurson@amadeus.siba.fi (Mikael Laurson) Subject: When is poll needed? Thank you both Iannis and James for your prompt answers. Probably I was not specific enough to make my point clear. What I want to achieve is to control an object (for instance a string, a pipe, etc.) that is running continuously in the background. (In the examples that Iannis gave in his comment this is not the case: a new sine-wave is created each time when Spawn is looping). In this sense this object is global and independent from any events. (In Iannis's examples the creation and the "excitation" of the sounding object are coupled.) The object receives excitations (using Spwan) which simulates for instance a pluck. The "Griot modeling" example (in "examples 4") gives a good idea how this works. First an instrument is created having 5 strings (delay-lines). After this excitations are sent to the strings using Spawn (Spawn only selects a string and models the pluck with a noise-burst: it does, however, not create a new string). My aim is to add more control to the "Griot modeling" example. This includes for instance being able to change the length of the string, add vibrato, control the feedback scaler dynamically, etc. For this I need to use envelopes as in some cases the parameters must be controlled with great precision in order to avoid artefacts in the sound. (In some cases, like vibrato, one can of course use also external controllers.) To achieve this I store in the data-arrays (or slots in my scheme) ControlIn-Ref objects instead of numbers. The values of ControlIn-Ref objects in turn are changed dynamically with the "set" method. This lengthy explanation makes my test-example (perhaps) more clear. I create a global sine-wave (I'm using here a sine-wave only to keep things more simple). The outer Spwan creates "events" and the inner Spawn polls the pitch-envelope and writes values into the ControlIn-Ref object: (var sig, env, fund, fr, fenv, ae, pe, frref; var ctrlrate, dur, pollfn, nofnotes, dtime, attacktime; ctrlrate = 0.05; dur = 1.5; dtime = 2; nofnotes = 5; attacktime = 0.001; {fund = 440; frref = Ref.new(fund); fr = ControlIn.kr (frref); sig = SinOsc.ar(fr.value,0,0.3); ae = Env.new([0,1,1,0],[attacktime,0.8,0.1],'linear'); pe = Env.new([fund,fund+100,fund],[0.5,0.5],'linear'); Spawn.ar({arg spawn, i, synth; env = EnvGen.ar(ae,1,0,1,0, dur); fenv = EnvGen.kr(pe,1,0,1,0, dur); Spawn.ar({ set(frref, poll(fenv)); sig }, 1, ctrlrate, floor(dur/ctrlrate)); sig*env }, 1, dtime,nofnotes); }.play; ) Now, this works, but I have still the feeling that this is not the optimal solution. (In SC1 you did not have to poll the envelopes.) Maybe there is a way to avoid the polling. For instance it would be nice to have an example like "Griot modeling" where one would have some kind of pitch control (vibrato, slides) that is triggered by Spawn. One must also remember that efficiency issues are critical here as I must use small (typically 8-16) blockSize values to achieve correct tunings. It would be nice to have a module that would resemble CombL or CombA (where you don't have this blockSize problem) with the difference that you could control the feedback part of the delay-loop. I think we had already a discussion on this with James but maybe it does not hurt to bring this matter up again. Anyway this kind of a module would be valuable when working with modelling stuff (many articles on this topic assume that this kind of module is available). The good news is however that I managed to get rid of the distortion problem I had when I used very short attacktimes. The problems vanished when I changed the expression "env = EnvGen.kr(ae,1,0,1,0, dur);" to "env = EnvGen.ar(ae,1,0,1,0, dur);" (i.e. I am using now the audio-rate instead of control-rate). What is funny is that this problem does not appear in Iannis's examples. There you can use both rates without any problems. Mikael ================================ Mikael Laurson Hollantilaisentie 1 A 2 00300 Helsinki 33 Finland E-mail: laurson@siba.fi ================================ ------------------------------ Date: Fri, 4 Dec 1998 12:49:26 -0500 From: Landon Rose <---@---.---> Subject: triggering Klanks James- How do I go from this: ( //scratch tap bed for PowerBook mike and headphones e = Env.sine(1,1); Synth.scope({ TSpawn.ar( { EnvGen.ar( e, Klank.ar(`[[exprand(30, 41).midicps,exprand(42, 52).midicps,exprand(53, 77).midicps, exprand(78, 127).midicps],nil,[1,1,1,1]], AudioIn.ar([1,2]))) }, 2, // two channels nil, SinOsc.kr(Amplitude.kr(AudioIn.ar(1),0.1,0.1,12), 0, 0.3)// trigger ) }) ) to where I can go through an indexed collection of filter arrays for Klank, such that each audio trigger will trigger the next index in the collection? In other words ,what I have above triggers Klanks with random sets of freq, what I want next is to trigger specific sets of frequencies, one after another to the end of a collection. Could I use OrcScore with TSpawn in this way? Point of interest- does EnvGen serve the same purpose now as dspRemove? without EnvGen in the above code it creates this wonderful cpu build-up which (with me anyway) was an everyday occurance in SC1! It had its own sort of esthetic... Also in the above code - TSpawn with AudioIn as trigger- this is my solution- what other ways are there to do this? Landon ------------------------------ Date: Fri, 4 Dec 98 21:09:33 +0100 From: Michael Bransome <---@---.---> Subject: Re: Questions - Creamware Pulsar Hello James, I haven't understood whether or not it is possible to direct sc-audio to the AudioMedia III at present. If this ought to be a cinch, then I still haven't figured out which combination of version(s) of Digidesign's SoundInits and/or SoundDrivers to use. Can you set me straight on this? Michael Bransome still in Stockholm Some of the most lasting things are the easiest... /anon/ ------------------------------ Date: Fri, 4 Dec 1998 15:10:21 -0500 (EST) From: Mark Ballora <---@---.---> Subject: Re: sorry I might have missed . . . . I made the same mistake. Don't use the instructions in GUIUtils.help. Use GUIUtils - Read Me. Iannos -- it's great to see this finally. It's way cool! Mark On Fri, 4 Dec 1998, Iannis Zannos wrote: > > Jem, > > >Just wondering how to make it work. > > I just tested it for the first time with SC2.d29 > as it is in the ReadMe file given by James. > IT WORKS. > > The answer is: get the latest SC version now - > it's fixed there. > > Sorry I cannot post my newest version > with the LabeledArrayV this weekend. > Till next week then... > > Iannis Zannos > SIM > Tiergartenstr. 1, > D-10785 Berlin, Germany > Fax: +49 30 25481172 > > > > > >. . . . a discussion re GUIutils in which the problem is that when follows > >the instructions - create an alias for GUIutils and puts it in common etc. > >and tries to recompile SC freezes. > > > >Just wondering how to make it work. > > > >Jem > > > ------------------------------ Date: Sun, 6 Dec 1998 21:57:56 +0100 From: Hans Tutschku <---@---.---> Subject: GUIUTILS Hi Iannis, Just had a look to your GUIUTILS - thanks a lot for this contribution, this clarifies some points for me some questions: - - copy to clipboard is "waiting" for something - nothing arrives in the clipboard - - connect: will this be a connection with MIDI? - - will there be a possibility for writing presets to disc and opening them with the patch next time? Thanks, Hans ------------------------------ Date: Mon, 07 Dec 1998 09:32:51 +0100 From: "Iannis Zannos" <---@---.---> Subject: Re: When is poll needed? Iannis Zannos SIM Tiergartenstr. 1, D-10785 Berlin, Germany Fax: +49 30 25481172 - ---------- >From: laurson@amadeus.siba.fi (Mikael Laurson) >To: sc-users@lists.io.com >Subject: When is poll needed? >Date: Fri, 4 Dec 1998 6:08 PM > > >Thank you both Iannis and James for your prompt answers. >Probably I was not specific enough to make my point clear. > >What I want to achieve is to control an object (for instance >a string, a pipe, etc.) that is running continuously in the background. >(In the examples that Iannis gave in his comment this is not the >case: a new sine-wave is created each time when Spawn is looping). > >In this sense this object is global and independent from any events. >(In Iannis's examples the creation and the "excitation" of the sounding object >are coupled.) > >The object receives excitations (using Spwan) which simulates for >instance a pluck. > >The "Griot modeling" example (in "examples 4") gives a good idea how this >works. >First an instrument is created having 5 strings (delay-lines). After >this excitations are sent to the strings using Spawn (Spawn only >selects a string and models the pluck with a noise-burst: it does, however, not >create a new string). > >My aim is to add more control to the "Griot modeling" example. This >includes for instance being able to change the length of the string, add >vibrato, >control the feedback scaler dynamically, etc. > >For this I need to use envelopes as in some cases the parameters must be >controlled >with great precision in order to avoid artefacts in the sound. (In some >cases, like >vibrato, one can of course use also external controllers.) > >To achieve this I store in the data-arrays (or slots in my scheme) >ControlIn-Ref objects >instead of numbers. The values of ControlIn-Ref objects in turn are changed >dynamically >with the "set" method. > >This lengthy explanation makes my test-example (perhaps) more clear. >I create a global sine-wave (I'm using here a sine-wave only >to keep things more simple). The outer Spwan creates "events" and the >inner Spawn polls the pitch-envelope and writes values into the >ControlIn-Ref object: > >(var sig, env, fund, fr, fenv, ae, pe, frref; > var ctrlrate, dur, pollfn, nofnotes, dtime, attacktime; > ctrlrate = 0.05; > dur = 1.5; > dtime = 2; > nofnotes = 5; > attacktime = 0.001; >{fund = 440; > frref = Ref.new(fund); > fr = ControlIn.kr (frref); > sig = SinOsc.ar(fr.value,0,0.3); > ae = Env.new([0,1,1,0],[attacktime,0.8,0.1],'linear'); > pe = Env.new([fund,fund+100,fund],[0.5,0.5],'linear'); > Spawn.ar({arg spawn, i, synth; > env = EnvGen.ar(ae,1,0,1,0, dur); > fenv = EnvGen.kr(pe,1,0,1,0, dur); > Spawn.ar({ > set(frref, poll(fenv)); > sig > }, 1, ctrlrate, floor(dur/ctrlrate)); > sig*env > }, 1, dtime,nofnotes); > >}.play; >) > >Now, this works, but I have still the feeling that this is not the optimal >solution. >(In SC1 you did not have to poll the envelopes.) >Maybe there is a way to avoid the polling. For instance it would be nice to >have an example like "Griot modeling" where one would have some kind of >pitch control >(vibrato, slides) that is triggered by Spawn. > >One must also remember that efficiency issues are critical here >as I must use small (typically 8-16) blockSize values to achieve correct >tunings. > >It would be nice to have a module that would resemble CombL or CombA (where >you don't >have this blockSize problem) with the difference that you could control the >feedback >part of the delay-loop. I think we had already a discussion on this with >James but maybe >it does not hurt to bring this matter up again. Anyway this kind of a >module would be >valuable when working with modelling stuff (many articles on this topic >assume that this kind >of module is available). > > >The good news is however that I managed to get rid of the distortion problem I >had when I used very short attacktimes. The problems vanished when I changed >the expression "env = EnvGen.kr(ae,1,0,1,0, dur);" to "env = >EnvGen.ar(ae,1,0,1,0, dur);" >(i.e. I am using now the audio-rate instead of control-rate). >What is funny is that this problem does not appear in Iannis's examples. >There you >can use both rates without any problems. > > >Mikael > >================================ >Mikael Laurson > >Hollantilaisentie 1 A 2 >00300 Helsinki 33 >Finland > > >E-mail: laurson@siba.fi >================================ > > > ------------------------------ Date: Mon, 07 Dec 1998 10:10:49 +0100 From: "Iannis Zannos" <---@---.---> Subject: Dynamic connection of signals (Re: When is poll needed?) Michael, (Sorry for posting this answer by mistake before completing. Here is what was intended:) You may want to have a look at the Synth.help file. It shows how to use simple variables with numerical values as control sources and to change the values of these control sources at any moment by assigning them new values. It may be an alternative solution to using references. >The "Griot modeling" example (in "examples 4") gives a good idea how this >works. >First an instrument is created having 5 strings (delay-lines). After >this excitations are sent to the strings using Spawn (Spawn only >selects a string and models the pluck with a noise-burst: it does, however, not >create a new string). > >My aim is to add more control to the "Griot modeling" example. This >includes for instance being able to change the length of the string, add >vibrato, >control the feedback scaler dynamically, etc. Here is an example of Griot modeling with vibrato added, which uses ParameterWindow from GUIUtils. (You can strip the synthesis closure and use it in your own GUI or other context if needed). ParameterWindow.play( "Vibrato String", [ ['slider', "pitch", 0.004, 0.002, 0.01, 0.0001], ['slider', "pluck rate", 0.5, 0.1, 1, 0.01], ['slider', "vibrato rate", 8, 1, 20, 0.01], ['slider', "vibrato width", 0.0001, 0.0, 0.001, 0.00001], ['addlabel', "mousex = tension (noisy when tension are high)", 360], ['addlabel', "mousey = material"] ], { arg pitch, rate, vrate, vwidth; var buffer, input, delayedSignal, mixedSignal; var env, excitation, filteredDelay, vibrato; env = Env.new([0,1,0], [0.01, 0.2], -2); vibrato = SinOsc.kr(8, 0, 0.0001); excitation = Spawn.ar({ arg spawn, i, synth; LFNoise2.ar(MouseY.kr(10, 10000), EnvGen.kr(env, 1, 0, 0.05)); }, 1, { rate.poll }); buffer = Signal.new(Synth.sampleRate * 0.3); delayedSignal = TapN.ar(buffer, SinOsc.kr(vrate, 0, vwidth, pitch)); filteredDelay = LPF.ar(delayedSignal, MouseX.kr(10, 10000), 0.98); DelayWr.ar(buffer, filteredDelay + excitation); filteredDelay } ) You can add more controls to this to change other parameters dynamically either with sliders creating controlin-streams or with number boxes which must be polled (for the latter, better to wait till next version of GUIUtils). To take your point further, I think the main case when you need a poller in the context of dynamic control, is when you want to change the process that is controlling a parameter "on the fly". For example, start controlling the cut-off frequency of a filter with an envelope, and then continue with an oscillator, or with a MIDI controller. In this case the hard-wiring of a UGen Graph by the interpreter would get in the way. If you do not need this feature, then you do not need to poll, unless it is for speed reasons. Two questions related to this example and the issue of controllers in general: 1. The example above becomes noisy when the MouseX value is high. Also this type of "string tuning" starts producing artefacts for very small tap times (ca < 0.0015). The tap time artefact are IMO due to interpolation errors trying to use a "fractional delay" (see work of Vesa Valimaki) i.e. the filter starts producing frequencies that alias according to the nyquist rule. I am not sure what causes the noise that appears when the (cut-off) frequency of LPF is high, and whether it is due to the vibrato or not. 2. Mainly a question to James: Is it possible to record control signals? For example, record the movement of the mouse or of MIDI controller in a buffer (at k-rate!) and then playback from it? Would you suggest writing "high-level" code for implementing this? It seems to me that an implementation as primitive is necessary for speed reasons. Iannis Zannos SIM Tiergartenstr. 1, D-10785 Berlin, Germany Fax: +49 30 25481172 - ---------- >From: laurson@amadeus.siba.fi (Mikael Laurson) >To: sc-users@lists.io.com >Subject: When is poll needed? >Date: Fri, 4 Dec 1998 6:08 PM > > >Thank you both Iannis and James for your prompt answers. >Probably I was not specific enough to make my point clear. > >What I want to achieve is to control an object (for instance >a string, a pipe, etc.) that is running continuously in the background. >(In the examples that Iannis gave in his comment this is not the >case: a new sine-wave is created each time when Spawn is looping). > >In this sense this object is global and independent from any events. >(In Iannis's examples the creation and the "excitation" of the sounding object >are coupled.) > >The object receives excitations (using Spwan) which simulates for >instance a pluck. > >The "Griot modeling" example (in "examples 4") gives a good idea how this >works. >First an instrument is created having 5 strings (delay-lines). After >this excitations are sent to the strings using Spawn (Spawn only >selects a string and models the pluck with a noise-burst: it does, however, not >create a new string). > >My aim is to add more control to the "Griot modeling" example. This >includes for instance being able to change the length of the string, add >vibrato, >control the feedback scaler dynamically, etc. > >For this I need to use envelopes as in some cases the parameters must be >controlled >with great precision in order to avoid artefacts in the sound. (In some >cases, like >vibrato, one can of course use also external controllers.) > >To achieve this I store in the data-arrays (or slots in my scheme) >ControlIn-Ref objects >instead of numbers. The values of ControlIn-Ref objects in turn are changed >dynamically >with the "set" method. > >This lengthy explanation makes my test-example (perhaps) more clear. >I create a global sine-wave (I'm using here a sine-wave only >to keep things more simple). The outer Spwan creates "events" and the >inner Spawn polls the pitch-envelope and writes values into the >ControlIn-Ref object: > >(var sig, env, fund, fr, fenv, ae, pe, frref; > var ctrlrate, dur, pollfn, nofnotes, dtime, attacktime; > ctrlrate = 0.05; > dur = 1.5; > dtime = 2; > nofnotes = 5; > attacktime = 0.001; >{fund = 440; > frref = Ref.new(fund); > fr = ControlIn.kr (frref); > sig = SinOsc.ar(fr.value,0,0.3); > ae = Env.new([0,1,1,0],[attacktime,0.8,0.1],'linear'); > pe = Env.new([fund,fund+100,fund],[0.5,0.5],'linear'); > Spawn.ar({arg spawn, i, synth; > env = EnvGen.ar(ae,1,0,1,0, dur); > fenv = EnvGen.kr(pe,1,0,1,0, dur); > Spawn.ar({ > set(frref, poll(fenv)); > sig > }, 1, ctrlrate, floor(dur/ctrlrate)); > sig*env > }, 1, dtime,nofnotes); > >}.play; >) > >Now, this works, but I have still the feeling that this is not the optimal >solution. >(In SC1 you did not have to poll the envelopes.) >Maybe there is a way to avoid the polling. For instance it would be nice to >have an example like "Griot modeling" where one would have some kind of >pitch control >(vibrato, slides) that is triggered by Spawn. > >One must also remember that efficiency issues are critical here >as I must use small (typically 8-16) blockSize values to achieve correct >tunings. > >It would be nice to have a module that would resemble CombL or CombA (where >you don't >have this blockSize problem) with the difference that you could control the >feedback >part of the delay-loop. I think we had already a discussion on this with >James but maybe >it does not hurt to bring this matter up again. Anyway this kind of a >module would be >valuable when working with modelling stuff (many articles on this topic >assume that this kind >of module is available). > > >The good news is however that I managed to get rid of the distortion problem I >had when I used very short attacktimes. The problems vanished when I changed >the expression "env = EnvGen.kr(ae,1,0,1,0, dur);" to "env = >EnvGen.ar(ae,1,0,1,0, dur);" >(i.e. I am using now the audio-rate instead of control-rate). >What is funny is that this problem does not appear in Iannis's examples. >There you >can use both rates without any problems. > > >Mikael > >================================ >Mikael Laurson > >Hollantilaisentie 1 A 2 >00300 Helsinki 33 >Finland > > >E-mail: laurson@siba.fi >================================ > > > ------------------------------ Date: Mon, 07 Dec 1998 10:14:40 +0100 From: "Iannis Zannos" <---@---.---> Subject: Re: GUIUTILS (REPOST) (REPOST) Hans, Thanks for the feedback on GUIUtils. Connect was meant as a connection for MIDI Clipboard was waiting for James to provide a method for getting the Mac clipboard(s) contents. Now that there is a save-file and load-file dialog box, I plan to replace this with writing presets to a file. Probably both of the above will not come with the next version. The next version is due soon and adds a ParameterView subclass for adding arrays of numbers with labels - as announced. I will add some more documentation and examples before sending in the next version soon. Thanks are due to Alberto di Campo and Ron Kuivila for their suggestions which have led to improvements. Iannis Zannos SIM Tiergartenstr. 1, D-10785 Berlin, Germany Fax: +49 30 25481172 - ---------- >From: Hans Tutschku <---@---.---> >To: sc-users@lists.io.com >Subject: GUIUTILS >Date: Sun, 6 Dec 1998 9:57 PM > > >Hi Iannis, > >Just had a look to your GUIUTILS - thanks a lot for this contribution, this >clarifies >some points for me > >some questions: > >- copy to clipboard is "waiting" for something - nothing arrives in the >clipboard >- connect: will this be a connection with MIDI? >- will there be a possibility for writing presets to disc and opening them >with the >patch next time? > >Thanks, Hans > ------------------------------ Date: Mon, 7 Dec 1998 10:41:58 -0600 From: James McCartney <---@---.---> Subject: Re: triggering Klanks At 11:49 AM -0600 12/4/98, Landon Rose wrote: >James- > How do I go from this: > >( >//scratch tap bed for PowerBook mike and headphones >e = Env.sine(1,1); >Synth.scope({ > TSpawn.ar( > { EnvGen.ar( > e, > Klank.ar(`[[exprand(30, 41).midicps,exprand(42, >52).midicps,exprand(53, 77).midicps, > exprand(78, >127).midicps],nil,[1,1,1,1]], > AudioIn.ar([1,2]))) }, > 2, // two channels > nil, > SinOsc.kr(Amplitude.kr(AudioIn.ar(1),0.1,0.1,12), 0, >0.3)// trigger > ) >}) >) For one thing, I don't think you really want to be doing exprand(30, 41).midicps exprand exponentially distribute numbers in the range 30 to 41, meaning you'll get more values around 30 than around 41. Usually you would use an exponential distribution if you were generating values in hertz. If you are generating values in midi note numbers then you would usually use a uniform distribution. Also exprand generates numbers in a continuous range not a discrete set of integers. You probably really want rrand here. >to where I can go through an indexed collection of filter arrays for Klank, >such that each audio trigger will trigger the next index in the collection? >In other words ,what I have above triggers Klanks with random sets of freq, >what I >want next is to trigger specific sets of frequencies, one after another to the >end of a collection. The thing to do is use the index argument to the TSpawn function to index into an array of Klank specs. ( //scratch tap bed for PowerBook mike and headphones var e, n, specList; n = 8; specList = Array.fill(n, { `[ [ rrand(30, 41).midicps, rrand(42, 52).midicps, rrand(53, 77).midicps, rrand(78,127).midicps ], nil, #[1,1,1,1] ] }); e = Env.sine(1,1); Synth.scope({ TSpawn.ar({ arg tspawn, index, synth; EnvGen.ar( e, Klank.ar( specList.wrapAt(index), AudioIn.ar([1,2]) )) }, 2, // two channels nil, SinOsc.kr( Amplitude.kr(AudioIn.ar(1),0.1,0.1,12), 0, 0.3)// trigger ) }) ) >Point of interest- does EnvGen serve the same purpose now as dspRemove? >without EnvGen in the >above code it creates this wonderful cpu build-up which (with me anyway) >was an everyday >occurance in SC1! It had its own sort of esthetic... Sort of but not exactly. All ugens pass along a tag along with their signal output that says "I ended at this sample". The only ugens that originate this tag are those that have a finite duration such as EnvGen, Line, XLine, and Spawns which have a finite number of events. Most others pass the tags of their main input to their output. Infinite impulse response ugens like filters, comb delay lines, etc never have an end tag, even if their input does. (In this case I decided not to try and second guess when an IIR ugen's output had decayed "enough".) Binary operators like + - min max return the later of their two input end tags. * / scaleneg amclip return the earlier of their two input end tags. Signal generators like Osc, WhiteNoise, etc have no end tag. So in order for a Spawn voice to be deallocated it must have a signal that is multiplied by a finite signal like that from an EnvGen. >Also in the above code - TSpawn with AudioIn as trigger- this is my solution- >what other ways are there to do this? To do what exactly? --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: < ------------------------------ Date: Mon, 7 Dec 1998 11:55:29 -0600 From: James McCartney <---@---.---> Subject: Re: When is poll needed? I think one problem here is that there is not a 'kr' version of Spawn. Here's a solution without using a ControlIn or poll. I had to make the envelopes 'ar' because Spawn does not have a 'kr' version. (var sig, env, fund, fenv, ae, pe; var dur, nofnotes, dtime, attacktime; dur = 1.5; dtime = 2; nofnotes = 5; attacktime = 0.001; fund = 440; ae = Env.new([0,1,1,0],[attacktime,0.8,0.1],'linear'); pe = Env.new([fund,fund+100,fund],[0.5,0.5],'linear'); { #env, fenv = Spawn.ar({ arg spawn, i, synth; [ EnvGen.ar(ae,1,0,1,0, dur), EnvGen.ar(pe,1,0,1,0, dur) ] }, 2, dtime, nofnotes); SinOsc.ar(fenv, 0, 0.3 * env); }.play; ) The only time poll should be necessary is if you want to "freeze" a value from a ugen to use as a constant. i.e. something like a sample and hold, but event based rather than continuous. Another point is that I misinformed you once before. You do not need to wrap a constant in a Ref to use in a ControlIn. You can set the ControlIn "source" instance variable directly with a Float. fundctl = ControlIn.kr(initialFundamental); ... fundctl.source = aNewFundamental; --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ End of sc-users-digest V1 #19 *****************************