From: owner-sc-users-digest@lists.io.com (sc-users-digest) To: sc-users-digest@lists.io.com Subject: sc-users-digest V1 #53 Reply-To: sc-users Sender: owner-sc-users-digest@lists.io.com Errors-To: owner-sc-users-digest@lists.io.com Precedence: bulk sc-users-digest Tuesday, August 3 1999 Volume 01 : Number 053 ---------------------------------------------------------------------- Date: Thu, 29 Jul 1999 18:40:39 +0800 From: Mark Ballora <---@---.---> Subject: Re: controlling synth duration >>But is there a way to stop Synth.play other than with the duration >>argument? > >You can't. >What is it that you really want to do? Stop a sound? No. Stop play. I know how to use Pause. For playing a list of pitches, I can also use an EnvGen, loop it at the last node, then use a gate to release the envelope. I'm playing through my abusively long lists, and I'd like to be able to vary the playback rate, yet still have playing stop when the list reaches its end. At a constant iteration rate, this is easy enough to do by simply making the duration argument the list length times the iteration rate. I could effectively do the same thing, stop the sound, by using EnvGen with a gate or using Pause. But being able to stop playback would give me an extra bit of flexibility, for instance if I wanted to use .record to create soundfiles when the duration may vary from run to run. Of course, I could also achieve this option by setting a duration to something longer than I know I'll want, and then just stop it when I'm through playing. Having it stop on its own just seemed a bit tidier. There's always a different way to approach it. I just didn't want to modify the patch needlessly if there were some way to make the duration argument variable. (I get self-conscious about maybe missing things in the docs!) >Put it in a Pause controlled by a Plug.kr(1). Set the Plug's >source to zero when you want the sound to stop. ------------------------------ Date: Thu, 29 Jul 1999 10:16:16 -0600 From: James McCartney <---@---.---> Subject: Re: controlling synth duration At 4:40 AM -0600 7/29/99, Mark Ballora wrote: >extra bit of flexibility, for instance if I wanted to use .record to create >soundfiles when the duration may vary from run to run. Oh I see.. I've added a 'stop' class method to Synth that stops synthesis. will be in the next release. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Thu, 29 Jul 1999 21:06:18 +0200 From: Ioannis Zannos <---@---.---> Subject: Re: Probability Hi, equires random choices with a probability. How can I do a random choice with skewed probabilities? I know you could do #[1, 1, 2, 3].choose for a 50% chance of 1 and 25% chance of the others, but how could I create a function that would give me finer tuned numbers, like .125 chance of choosing 1 .675 chance of choosing 2 etc. here is the solution to your answer: // 29.8.1998 1:09 AM choose according to an array of relative probabilities. choosep { arg elements, probabilities; var dice; probabilities = probabilities.integrate; dice = probabilities.last.rand; ^elements@(probabilities.find({ arg el; dice <= el })); } David Cottle wrote: > > Hi, > > >>I'm also trying to realize the Markov chain on page 287 in Dodge's book. It > >>requires random choices with a probability. How can I do a random choice > [...] > > > This is not provided, but there is no reason you cannot implement it > > yourself for now. There are several ways you can do it. Filling a table > [...] > > Great. I'll try them. > > The way I was going to do it is with a tree of binary searches using coin. > In the code below a is 40%, b is 50% of the remainder, c is 90% and d is 10% > of the remainder: a = 40, b = 30, c = 27, d = 3. Would this be any more > efficient? > > a = 0; b = 0; c = 0; d = 0; > 100.do({ > if(0.4.coin, > {a = a + 1}, > { > if(0.5.coin, > {b = b + 1}, > { > if(0.9.coin, > {c = c + 1}, > {d = d + 1} > ) > } > ) > } > ) > }); > a.postln; > b.postln; > c.postln; > d.postln; > (a + b + c + d).postln; > "----".postln; > > Here are the results: > > 31 > 33 > 31 > 5 > 100 > ---- > 43 > 31 > 24 > 2 > 100 > ---- > 42 > 32 > 24 > 2 > 100 > ---- > 41 > 28 > 27 > 4 > 100 > ---- > 40 > 25 > 32 > 3 > 100 > ---- > 42 > 29 > 26 > 3 > 100 > ---- > 53 > 15 > 30 > 2 > 100 > ---- > 38 > 31 > 30 > 1 > 100 > ---- ------------------------------ Date: Thu, 29 Jul 1999 21:58:29 +0200 From: Ioannis Zannos <---@---.---> Subject: Re: Probability James McCartney wrote: > Using a list of probabilities and scanning across > the list until the sum exceeds the value of a random number is space > efficient, but takes O(n) time to do the look up. And you have to > know the sum of the list or always make the list sum to a known > value, e.g. 1. > Preprocessing the list so that it has a list of summed probabilities > in sorted order can use a O(log(n)) binary search algorithm, but requires a preprocessed list. > > Here is the O(n) method: > > var wchoose, h, p; > > // choose an index from a list of weights > wchoose = { arg weights; // assumes weights sum to 1.0 > var r, sum = 0.0, index=0; > r = 1.0.rand; > weights.detect({ arg weight, i; > sum = sum + weight; > if (sum >= r, { > index = i; > true; > },{ false }); > }); > index; > }; > Going weights = weights.integrate; r = weights.last.rand; is more expensive but has the advantage that the list of probabilities does not have to sum up to a known value. the last part then becomes: weights.find({ arg el; r <= el }); I assume that in markov chains most of the time the probability distributions of a particular node will be constant. Which means one could cache the weights = weights.integrate and the weights.last part and use it as long as it remains unchanged. Bit tricky but gives the extra flexibility of not having a constant probability sum. Iannis Zannos ------------------------------ Date: Thu, 29 Jul 1999 15:08:17 -0600 From: James McCartney <---@---.---> Subject: Re: Probability At 1:58 PM -0600 7/29/99, Ioannis Zannos wrote: >Going > weights = weights.integrate; > r = weights.last.rand; > >is more expensive but has the advantage that the list >of probabilities does not have to sum up to a known value. >the last part then becomes: > weights.find({ arg el; r <= el }); > >I assume that in markov chains most of the time the probability >distributions of a particular node will be constant. Which means >one could cache the weights = weights.integrate and the >weights.last part and use it as long as it remains unchanged. >Bit tricky but gives the extra flexibility of not having a constant probability sum. I have added a normalizeSum method to ArrayedCollection that creates a new Array whose sum is 1.0. Basically it is the same as (array/array.sum) but it is a primitive, so is fast. This way it is easy to normalize the weights before you pass them to wchoose. I also made a windex method primitive that chooses an index given a sum-normalized array. Then wchoose is defined as: SequenceableCollection : ... wchoose { arg weights; // the sum of weights must be 1.0 ^this.at( weights.windex ); } It is at least 3 times slower to sum the weights each time. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Thu, 29 Jul 1999 15:14:35 -0600 From: James McCartney <---@---.---> Subject: Re: Foster Song The lookup of the state based on the previous two pitches is going to be slower than it could. Any second order fsm can be reduced to a first order fsm. If you are on a certain row of the table, then you know for each new note, what the next state will be, because you already know the previous note. So instead of just getting the next note out of the table, you should get the next note and state. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Thu, 29 Jul 1999 17:15:26 -0700 From: "Thomas Miley" <---@---.---> Subject: Re: version 2.1.8 available Hi James, > > A bug where bad sound would be recorded in some situations was fixed. > Is this the bug I showed you at class, or do you still want me to send it to you? Thanks, Thomas Miley ------------------------------ Date: Thu, 29 Jul 1999 20:07:12 -0600 From: James McCartney <---@---.---> Subject: Re: version 2.1.8 available At 6:15 PM -0600 7/29/99, Thomas Miley wrote: >Hi James, > >> >> A bug where bad sound would be recorded in some situations was fixed. >> > >Is this the bug I showed you at class, Yes it is. >or do you still want me to send it >>to you? no longer necessary. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Thu, 29 Jul 1999 20:39:29 -0600 From: James McCartney <---@---.---> Subject: Re: voicer pedals? Your message bounced because cbmus@mills.edu != cbmus@ella.mills.edu. At 5:46 PM -0600 7/29/99, owner-sc-users@lists.io.com wrote: >From: Chris Brown <---@---.---> >To: sc-users@lists.io.com >Subject: voicer pedals? >Message-ID: >MIME-Version: 1.0 >Content-Type: TEXT/PLAIN; charset=US-ASCII > > >Voicer help file says that sustain and sostenuto pedals are supported. >What's necessary in order to make them work ? They don't work for me >automatically on an otherwise corrctly behaving Voicer patch ... > >thanks, > >chris First, your voice's envelope should have a release node. Do the examples in the Voicer help file work for you? --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Fri, 30 Jul 1999 13:38:12 +0800 From: Mark Ballora <---@---.---> Subject: Re: controlling synth duration >At 4:40 AM -0600 7/29/99, Mark Ballora wrote: > >>extra bit of flexibility, for instance if I wanted to use .record to create >>soundfiles when the duration may vary from run to run. > >Oh I see.. >I've added a 'stop' class method to Synth that stops synthesis. >will be in the next release. > That sounds great. Thank you! Mark ------------------------------ Date: Thu, 29 Jul 1999 15:53:05 -0600 From: "David Cottle" <---@---.---> Subject: Re: Foster Song Hi, > Any second order fsm can be reduced to a first order fsm. > If you are on a certain row of the table, then you know for each Right. It also occurred to me that if you work with intervals instead of pitches you can get the second order with a single number. Correct? Also, would it speed it up if I left off the zeros at the end of the weighted probabilities? ------------------------------ Date: Fri, 30 Jul 1999 05:59:42 -0600 From: James McCartney <---@---.---> Subject: Re: Foster Song At 3:53 PM -0600 7/29/99, David Cottle wrote: >Hi, > >> Any second order fsm can be reduced to a first order fsm. >> If you are on a certain row of the table, then you know for each > >Right. It also occurred to me that if you work with intervals instead of >pitches you can get the second order with a single number. Correct? > Yeah, but then if you have a goof in your table it might be harder to figure out where you got derailed. Or maybe it would be easier, because you'd soon be in another key. >Also, would it speed it up if I left off the zeros at the end of the >weighted probabilities? Actually you should leave out all the zeroes. If you add the wchoose method you can do this: #[3, 7, 6].wchoose(#[0.1, 0.3, 0.6]); --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Fri, 30 Jul 1999 06:05:51 -0600 From: James McCartney <---@---.---> Subject: Re: Foster Song At 5:59 AM -0600 7/30/99, James McCartney wrote: >Actually you should leave out all the zeroes. >If you add the wchoose method you can do this: > >#[3, 7, 6].wchoose(#[0.1, 0.3, 0.6]); And you can do this automatically without retyping them : z = #[0, 0, 0.1, 0, 0.2, 0, 0, 0.7, 0, 0, 0, 0]; x = []; w = []; z.do({ arg p, i; if (p > 0, { x = x.add(i); w = w.add(p); }); }); x.postln; w.postln; x.wchoose(w).postln; --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Sat, 31 Jul 1999 18:24:24 +0800 From: Mark Ballora <---@---.---> Subject: Re: SCPlay >You need to write your own Main.sc class to respond to 'run' >to play your stuff. > I followed the steps Richard Karpen kindly provided. Compressed my library and everything. (I had to put an alias of the Common folder into the folder I chose as my new library before it would work.) I seem to open the library OK in SCPlay. But when I run it, it says that a primitive was not bound. 0 400 I'm not sure where those two numbers came from. I could provide more detail, but maybe the answer is more simple. The file (which I used to create a class definition which is part of my compressed library) opens a number of external files as lists and crunches them. Would opening files be a problem in SCPlay? Mark ------------------------------ Date: Sat, 31 Jul 1999 18:39:45 +0800 From: Mark Ballora <---@---.---> Subject: Re: SCPlay > >I'm not sure where those two numbers came from. I could provide more >detail, but maybe the answer is more simple. The file (which I used to >create a class definition which is part of my compressed library) opens a >number of external files as lists and crunches them. Would opening files >be a problem in SCPlay? > >Mark Oops. sorry to waste bandwidth, folks. Yes, that's the problem. I did a test with dummy lists of randomly generated numbers, and it worked fine. The problem seems to be opening external files. Mark ------------------------------ Date: Sat, 31 Jul 1999 10:33:26 -0600 From: James McCartney <---@---.---> Subject: Re: SCPlay At 4:24 AM -0600 7/31/99, Mark Ballora wrote: >>You need to write your own Main.sc class to respond to 'run' >>to play your stuff. >> > >I followed the steps Richard Karpen kindly provided. >Compressed my library and everything. (I had to put an alias of the Common >folder into the folder I chose as my new library before it would work.) > >I seem to open the library OK in SCPlay. But when I run it, it says that a >primitive was not bound. 0 400 > >I'm not sure where those two numbers came from. I could provide more >detail, but maybe the answer is more simple. The file (which I used to >create a class definition which is part of my compressed library) opens a >number of external files as lists and crunches them. Would opening files >be a problem in SCPlay? The interpreter primitive is not implemented in SCPlay. You cannot interpret text in SCPlay, which is what 'executeFile' does. Make those files into methods in your Main class. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Sat, 31 Jul 1999 18:37:11 -0400 From: Landon Rose <---@---.---> Subject: Digigram VXPocket James- been trying to configure the new VXPocket PC card to SC 2.1.8( on a PB2400). The A/D converter spec says 24bit 48k, though the VX control panel lists 44.1k and 32k as other options. Also, I sometimes get this message in the start-up information window in SC "input and output buffers not the same size?? 2016 512 set to: 512 512" only question I have ( besides "how do I make this thing work?") for you is when the start-up configuration window says Prefs : hardware = apple sampleRate = 44100 clockSource = 0 bufMultiple = 1 useSoundInput = 1 defaultBlockSize = 64 SC's reading what it sees on board this computer and it doesn't see the VX? I do get sound- high freq pulse waves like Morse code. I gave the SC address to: Neil Glassman, President Digigram Inc. glassman@digigram.com http://www.digigram.com He asked about SC. Thanks Landon ------------------------------ Date: Sat, 31 Jul 1999 18:41:11 -0600 From: James McCartney <---@---.---> Subject: Re: Digigram VXPocket At 4:37 PM -0600 7/31/99, Landon Rose wrote: >James- > been trying to configure the new VXPocket PC card to SC 2.1.8( on a >PB2400). The A/D converter spec says 24bit 48k, though the VX control panel >lists 44.1k and 32k as other options. > Also, I sometimes get this message in the start-up information >window in SC > "input and output buffers not the same size?? 2016 512 > set to: 512 512" They probably do not support the siHardwareFormat selector call from the Sound Mgr. Have you tried turning off sound input? Perhaps their Sound Mgr driver does not support simultaneous input and output. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Sun, 1 Aug 1999 00:50:41 -0400 From: Landon Rose <---@---.---> Subject: Re: Digigram VXPocket James- Thanks for the quick reply. Well, the VX works with SC.I forgot about using the Sound Control Panel to choose I/O instead of relying on Monitors and Sound. I had a feeling it was something obvious. The message about "input and output buffers not the same size?? 2016 512 set to: 512 512" I think came about because I was choosing the VX for input but the apple sound chip remained for output, because I was using Monitors and Sound... SC RULES FOREVER ( where did that come from? oh yeh, been teaching at an art camp for teenagers...) Landon ------------------------------ Date: Sun, 1 Aug 1999 07:07:34 -0600 From: James McCartney <---@---.---> Subject: Korg 1212 on sale Sweetwater is selling Korg 1212's for $349. http://www.sweetwater.com/specials/korg1212/ I have nothing to do with Sweetwater, just passing it along.. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Mon, 2 Aug 1999 02:15:38 -0600 From: James McCartney <---@---.---> Subject: version 2.1.9 available Version 2.1.9 is now available via ftp: BinHex : ftp://www.audiosynth.com/pub/updates/SC2.1.9.sea.hqx MacBinary (smaller) : ftp://www.audiosynth.com/pub/updates/SC2.1.9.sea.bin === Changes in Version 2.1.9 Voicer was fixed so that the sustain and sostenuto pedals actually do work. A crashing bug in the syntax colorizer menu item was fixed. A crashing bug when calling tsched from sched in a TSpawn was fixed. If a Sequencer stream returns nil, then the last good value is used. This allows finite length streams to be used in a Sequencer. More class help files were written : Bag, BinaryOpStream, BinaryOpUGen, Environment, Event, EventStream, GetTempo, Infinitum, Instrument, Interval, LinkedList, LinkedListNode, MIDIOut, MultiOutUGen, Orchestra, PriorityQueue, RawArray, RawPointer, SetTempo, Signal, SortedList, StepClock, String, UnaryOpStream, UnaryOpUGen, View, Wavetable. A number of bugs were found and fixed while documenting the above classes. The obsolete classes PropertyList and LazyList were removed. The "misconception" example was revised with a better solution. === Also, new stuff in the Contributions folder from Staffan Liljegren and Mark Polishook (who also wrote the Instrument help file). --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: < ------------------------------ Date: Mon, 02 Aug 1999 15:06:20 +0100 From: Martin Robinson <---@---.---> Subject: Another bug or mug Why is there no sound when I do this? ( // file playback tracking amp and freq of in var filename, sound, signal; filename = ":Sounds:floating_1"; sound = SoundFile.new; if (sound.read(filename), { signal = sound.data.at(0); Synth.play({ var f, in, a, p; in = AudioIn.ar(1); a = Amplitude.kr(in); a = Lag.kr(a, 0.05); f = ZeroCrossing.kr(in); p = PlayBuf.ar(signal, sound.sampleRate, 1, 0, 0, signal.size-2, a ); LPF.ar(p, f); //LPF.ar(p, 20000); //SinOsc.ar(f, 0, a); }) },{ (filename ++ " not found.\n").post }); ) The last two lines of the ugenGraphFunc (commmented out) show that both the filter works (I tried it with a Mouse controller to see if LPF was unhappy with a UGen freq input) and f can be used to control the freq of an oscillator. Martin. (([$b, $m].at(coin(0.5).binaryValue).asString++"ug").postln) >>>>>>Martin Robinson :: (Ex)tractor :: && ________ >>><<<_sonicArts.at(middlesexUniversity.london.uk); ______ <><><>__this.liveElectronics.interFaces.diffusion ____ >><<>>___Extractor.at(bigChill_(enchantedGarden).6-8.aug.99) ___ || ------------------------------ Date: Mon, 2 Aug 1999 10:13:54 -0600 From: James McCartney <---@---.---> Subject: Re: Another bug or mug At 8:06 AM -0600 8/2/99, Martin Robinson wrote: > f = ZeroCrossing.kr(in); > LPF.ar(p, f); The filter's feedback values can grow very quickly to infinity in response to severe transients in the filter parameter. ZeroCrossing produces a pretty erratic signal output which very well could cause the filter to blow up. You should not use its output directly, but should massage it in some way, e.g. put lag on it, slew rate limit it, clip its range, gate it depending on the input amplitude, etc. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Tue, 03 Aug 1999 14:03:39 +0200 From: Ioannis Zannos <---@---.---> Subject: Moving Views To implement a "ListView" that represents items of a list as buttons of a window and permits adding/removing of items graphically, I would like to be able to move ButtonViews in a GUIWIndow. That is, if an item gets removed, items after it move upwards to fill in the gap (Alternative: copy the contents of the items one position upwards and remove the last item.) It seems that bounds_ is not the way to change the position of a ButtonView: ( { var w, b; w = GUIWindow.new("panel", Rect.newBy( 100, 100, 400, 400 )); b = ButtonView.new( w, Rect.newBy( 10, 10, 128, 20 ), "Move Button", 0, 0, 1, 0, 'linear'); b.action_({ arg button; "This window should now move!!!".postln; button.bounds_(Rect.newBy(30, 30, 100, 100)); button.window.refresh; }) }.value ) Is there another way? Thanks Iannis Zannos SIM ------------------------------ Date: Tue, 3 Aug 1999 09:09:26 -0600 From: James McCartney <---@---.---> Subject: Re: Moving Views At 6:03 AM -0600 8/3/99, Ioannis Zannos wrote: >To implement a "ListView" that represents items of a list >as buttons of a window and permits adding/removing of items >graphically, I would like to be able to move ButtonViews in a >GUIWIndow. That is, if an item gets removed, items after it >move upwards to fill in the gap (Alternative: copy the contents of the items >one position upwards and remove the last item.) >It seems that bounds_ is not the way to change the position of >a ButtonView: No that doesn't/didn't work, but it does now.. will be in next release.. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Tue, 3 Aug 1999 18:21:21 +0100 From: Pieter Suurmond <---@---.---> Subject: We need some help with Tspawn-DelayWr-TapL. Dear SC-people, // This is our simplified patch, we've thrown everything out // that's not relevant to clearly demonstrate our problem. // Hans, Arie & Pieter, august 1, 1999. // The idea is as follows: // One common DelayWr that continuously keeps writing audio // into our buffer. Several independant (sometimes even // overlapping) Tspawns tap from that single delay line. // One would expect to hear smoothly-enveloped sinewave- // "grains", alternating on the left and the right channel // (controlled by mouse-x). Unfortunately the DelayWr doesn't // seem to keep writing (the sinewave unsuspectedly ATTACKS). // We've tried the >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Schreck Ensemble # -laboratory for live electro-acoustic music- # The Netherlands e-mail:arsche@stad.dsl.nl http://www.xs4all.nl/~schreck/ Tel: 00-31-71-5612287 Fax: 00-31-70-3859268 <<<<<<<<<<<<<<<<<<<<<<<<<-////||\\\\->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Pieter Suurmond Utrecht School of the Arts e-mail: pieter@kmt.hku.nl Music Technology department www: http://www.hku.nl/~pieter/ PO box 2471 phone: (+31) 35 6836464 1200 CL Hilversum fax: (+31) 35 6836480 Netherlands ------------------------------ Date: Tue, 3 Aug 1999 13:34:21 -0600 From: James McCartney <---@---.---> Subject: Re: We need some help with Tspawn-DelayWr-TapL. At 11:21 AM -0600 8/3/99, Pieter Suurmond wrote: >Dear SC-people, > >// This is our simplified patch, we've thrown everything out >// that's not relevant to clearly demonstrate our problem. >// Hans, Arie & Pieter, august 1, 1999. > >// The idea is as follows: >// One common DelayWr that continuously keeps writing audio >// into our buffer. Several independant (sometimes even >// overlapping) Tspawns tap from that single delay line. > >// One would expect to hear smoothly-enveloped sinewave- >// "grains", alternating on the left and the right channel >// (controlled by mouse-x). Unfortunately the DelayWr doesn't >// seem to keep writing (the sinewave unsuspectedly ATTACKS). >// We've tried the >// If anyone could please help us / give us some hints,.... >// Many THANKS !!! > All the DelayWr's and Taps must be in the same synth. You can't start a DelayWr and Spawn Taps on it. The sub-synths run asychronously to the parent, they could have differnt block sizes, therefore they can't be in sync with each other. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Tue, 3 Aug 1999 21:23:20 +0100 From: Pieter Suurmond <---@---.---> Subject: Re: We need some help with Tspawn-DelayWr-TapL. >At 11:21 AM -0600 8/3/99, Pieter Suurmond wrote: >>Dear SC-people, >> >>// This is our simplified patch, we've thrown everything out >>// that's not relevant to clearly demonstrate our problem. >>// Hans, Arie & Pieter, august 1, 1999. >> >>// The idea is as follows: >>// One common DelayWr that continuously keeps writing audio >>// into our buffer. Several independant (sometimes even >>// overlapping) Tspawns tap from that single delay line. >> >>// One would expect to hear smoothly-enveloped sinewave- >>// "grains", alternating on the left and the right channel >>// (controlled by mouse-x). Unfortunately the DelayWr doesn't >>// seem to keep writing (the sinewave unsuspectedly ATTACKS). >>// We've tried the > >>// If anyone could please help us / give us some hints,.... >>// Many THANKS !!! ( var e, buffer; e = Env.new(#[0,1,0],#[0.5, 0.5],'sine'); // Hamming-like envelopes //for grains. Synth.scope({ arg synth; buffer = Signal.new(Synth.sampleRate * 4.0); // Alloc buffer for 4 secs. DelayWr.ar(buffer, FSinOsc.ar(440, 1, 0)); // Simple sinewave-test. TSpawn.ar( { arg spawn, i, synth; synth.channelOffset = (i & 1); // Alternating channel. EnvGen.ar(e, // Envelope declared above. TapL.ar(buffer, 1.3, 1, 0), // Tap signal after 1.3 s. 0, // Add (not used, take 0). 0.4, // Overall amplitude. 0, // Envelope-bias (not used). 2.0); // Control duration by // time-scale (2 secs for test)! }, 2, // two channels nil, Impulse.ar(MouseX.kr(0.1, 0.5, 'exponential')) // Mouse triggers ) // the Tspawn. }) ) - ----------------------------------------------------------------- >All the DelayWr's and Taps must be in the same synth. >You can't start a DelayWr and Spawn Taps on it. >The sub-synths run asychronously to the parent, they could >have differnt block sizes, therefore they can't be in sync >with each other. > > --- james mccartney james@audiosynth.com http://www.audiosynth.com >If you have a PowerMac check out SuperCollider2, a real time synth program: > - ----------------------------------------------------------------- Many thanks James for your ultra-fast response !!! Knowing this really helps us a lot ! But: How else can we do what we want? Arie suggests using RecordBuffer & PlayBuffer. But, when I understand things correctly, it is also impossible to use ONE SINGLE RecordBuffer and then spawn several PlayBuffers independantly. ...?... Or: is it maybe possible when we force the sub-synths to have the same block sizes? Kind regards, Pieter ------------------------------ Date: Tue, 3 Aug 1999 15:08:22 -0600 From: James McCartney <---@---.---> Subject: Re: We need some help with Tspawn-DelayWr-TapL. At 2:23 PM -0600 8/3/99, Pieter Suurmond wrote: >Many thanks James for your ultra-fast response !!! >Knowing this really helps us a lot ! > >But: How else can we do what we want? > >Arie suggests using RecordBuffer & PlayBuffer. >But, when I understand things correctly, >it is also impossible to use ONE SINGLE RecordBuffer >and then spawn several PlayBuffers independantly. >...?... That method should work, I think. You just will not be able to guarantee an exact time offset. In the future I should be able to make both methods work by having the DelayWr and Taps share more than just a buffer, but some more info through some other object that contains the buffer. The same method would help to write a playbuf that would hop over the record head when it encounters it eliminating the glitch. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Tue, 3 Aug 1999 15:12:00 -0600 From: James McCartney <---@---.---> Subject: Re: We need some help with Tspawn-DelayWr-TapL. >Or: is it maybe possible when we force the sub-synths to >have the same block sizes? This is the default case anyway, but it doesn't help here. The main problem is that the spawned synth starts at a later time than the delaywr and doesn't know its current state. Also the spawned synth starts at some sample offset to the parent. For the next release I have added a flag to turn the sample accurate scheduling off and make the buffers align, but that still doesn't help the tap know where the delaywr is. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Wed, 04 Aug 1999 00:50:24 +0200 From: Alberto de Campo <---@---.---> Subject: Re: We need some help with Tspawn-DelayWr-TapL. Hi all, dear Pieter, I have been working on something similar that may solve your problem. If it does not let me know. Best wishes, Alberto de Campo ( var w, recBtn, resetBtn, play1Btn, play2Btn, inputScope; var env, play1Spawn; env = Env.new(#[0, 1, 0.5, 0], #[0.1, 0.7, 0.2], releaseNode: 2); w = GUIWindow.new("panel", Rect.newBy( 200, 100, 500, 200)); recBtn = CheckBoxView.new( w, Rect.newBy( 22, 20, 128, 20), "Record On/Off").prSetBorderStyle(3); resetBtn = CheckBoxView.new( w, Rect.newBy( 22, 44, 128,20 ), "Record Reset").prSetBorderStyle(3); play1Btn = CheckBoxView.new( w, Rect.newBy( 22, 92, 128,20 ), "Play 1") .prSetBorderStyle(3); play2Btn = CheckBoxView.new( w, Rect.newBy( 22, 116, 128,20 ), "Play 2") .prSetBorderStyle(3); // not used yet. inputScope = ScopeView.new( w, Rect.newBy( 182, 19, 272,124 ), 4410, -1, 1) .labelColor_(rgb(176,176,176)); // for visual monitor of input. play1Btn.action = { // " play1Btn Just got pressed...".postln; if ( play1Btn.value == 1, { play1Spawn.source.trigger }, // start { play1Spawn.source.releaseAll }// and stop ) }; Synth.play({ var inSignal, buffer, detune, detuneSpeed; buffer = Signal.newClear(Synth.sampleRate * 6.0); // allocate a 6 second buffer. detune = MouseX.kr(0.0, 0.1); // detune playback streams lightly. detuneSpeed = MouseY.kr(0.8, 0.1, \exponential); inSignal = AudioIn.ar(1); Scope.ar( // monitor input with a scopeview. inputScope, RecordBuf.ar(buffer, in: inSignal, recLevel: 1, preLevel: 1, reset: resetBtn.kr, // reset only works while recording I think. run: recBtn.kr, // turn recording on and off. loopMode: 1 // record continuously until turned off. ) ); play1Spawn = TSpawn.ar({ // one PlayBuf stream, no granulation yet. // " play1Spawn Just got spawned...".postln; EnvGen.ar( // overall Stream envelope, plays until released env, PlayBuf.ar(buffer, // all that need be done is replace // the PlayBuf here with a grain stream: // Spawn.ar({ ... PlayBuf(...) }) // or maybe GrainTap? Synth.sampleRate, [ LFNoise1.kr(detuneSpeed, detune, 1), LFNoise1.kr(detuneSpeed, detune, 1)], 0, 0, buffer.size-2 ) // end of PlayBuf... ); // end of stream envelope }, 2); // end of play1Spawn }); w.close; ) Pieter Suurmond schrieb: > >At 11:21 AM -0600 8/3/99, Pieter Suurmond wrote: > >>Dear SC-people, > >> > >>// This is our simplified patch, we've thrown everything out > >>// that's not relevant to clearly demonstrate our problem. > >>// Hans, Arie & Pieter, august 1, 1999. > >> > >>// The idea is as follows: > >>// One common DelayWr that continuously keeps writing audio > >>// into our buffer. Several independant (sometimes even > >>// overlapping) Tspawns tap from that single delay line. > >> snip ...... ------------------------------ Date: Tue, 3 Aug 1999 21:55:50 -0500 From: Kenneth N Babb <---@---.---> Subject: Prime Numbers James, Is there a filtering operation on a stream that will return a stream of prime numbers?=20 =46or example: ( var a, b; a =3D Routine.new({=20 11.do({ arg i; i.yield; })=20 }); b =3D a.select({ arg item; DDDD,0000,0000item.prime; }); 11.do({ b.next.postln; }); Regards, Kenneth Babb ------------------------------ Date: Tue, 3 Aug 1999 22:26:41 -0600 From: James McCartney <---@---.---> Subject: Re: Prime Numbers Man that was hard to read...! (tiny font) How many primes do you need? If less that 256 you can generate them directly : Routine.new({ 256.do({ arg i; i.nthPrime.yield; }); }); nthPrime uses a look up table for the first 256 primes. If you still need a filter you could add this method to class Integer : isPrime { // this method fails for numbers greater // than (1619 * 1619) == 2621161 var sqrtThis; if ( this <<= 2, { if (this == 2, { ^true }, { ^false }); }); sqrtThis = this.sqrt.asInteger; 256.do({ arg i; var p; p = i.nthPrime; if (this % p == 0, { ^false }); if (p >= sqrtThis, { ^true }); }); ^nil // failure } --- 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 #53 *****************************