From: owner-sc-users-digest@lists.io.com (sc-users-digest) To: sc-users-digest@lists.io.com Subject: sc-users-digest V1 #74 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, November 23 1999 Volume 01 : Number 074 ---------------------------------------------------------------------- Date: Thu, 18 Nov 1999 09:48:58 +0100 From: Julian Rohrhuber <---@---.---> Subject: Re: RangeView its seems that with range method you can`t use kr (or at least I don`t see any) var w, r, p; w = GUIWindow.new("range", Rect.newBy(417, 597, 505, 90)); r = RangeView.new( w, Rect.newBy(29, 29, 430, 29), "RangeView", 200,250, 150, 500, 0, 'linear'); r.action = { p.source = r.range.value }; { p = Plug.kr(150); SinOsc.ar([r.kr, p*3], 0, 0.5) }.play; w.close; ) ( var w, r, p; w = GUIWindow.new("range", Rect.newBy(417, 597, 505, 90)); r = RangeView.new( w, Rect.newBy(29, 29, 430, 29), "RangeView", 200,250, 150, 500, 0, 'linear'); { arg synth; p = Plug.kr(150); synth.repeat(0, 0.2, { p.source = r.range.value }); SinOsc.ar([r.kr, p*3], 0, 0.5) }.play; w.close ) Scott Wilson schrieb: > Pardon me if this turns out to be some stupid oversight on my part, but I'm > having trouble using the range value of RangeView to control synthesis > parameters, eg mul. Is there a way of using Plug to get this value? Or > should I be using synth.trepeat to poll it? > > I'd appreciate it if you could post a short example. > > Thanks, > > Scott ------------------------------ Date: Thu, 18 Nov 1999 06:57:27 -0500 (EST) From: Landon Rose <---@---.---> Subject: Re: Output sound and MIDI James- can't find any examples or tutorials which thread sound and MIDI out. What I would like is to do something like this: (this of course only plays the sound, I can't figure out how to enclose PBind, if indeed I should use it): ( var filename, sound, signal, return; var in, amp, freq, hasFreq, out, midi; filename = ":Sounds:floating_1"; sound = SoundFile.new; if (sound.read(filename), { signal = sound.data.at(0); Synth.play({ a = Pbind( \midinote, Pseq(#[50,52], 10), \veloc, Pwhite(1,127,inf), \ugenFunc, { arg midinote, veloc, sustain, outersynth; MIDIOut(0).noteOn(1, midinote, veloc); // schedule note off in the outer synth. outersynth.sched(sustain, { MIDIOut(0).noteOn(1, midinote, 0); }); nil // audio output } ); in = LeakDC.ar(PlayBuf.ar(signal, sound.sampleRate, 0.1, 0, 0, signal.size-2), 0.995); amp = Amplitude.kr(in, mul: 0.4); # freq, hasFreq = Pitch.kr(in); out = Mix.ar( LFTri.ar(freq * [0.5, 1, 2]) ) * amp; 6.do({ out = AllpassN.ar(out, 0.040, [0.040.rand,0.040.rand], 2) }); out }); },{ (filename ++ " not found.\n").post }); ) if I put "out" within PBind it makes a new "out" with every new PSeq. other questions about PBind: given this example: ( Pbind( \midinote, Pseq(#[50,52], 10), \veloc, Pwhite(1,127,inf), \ugenFunc, { arg midinote, veloc, sustain, outersynth; MIDIOut(0).noteOn(1, midinote, veloc); // schedule note off in the outer synth. outersynth.sched(sustain, { MIDIOut(0).noteOn(1, midinote, 0); }); nil // audio output } ).play(channels: 1) ) if I was to write this using Synth.play- how do I write it? can you explain inner and outer synths ? this example works with or without (channels: 1) . what is that doing? ------------------------------ Date: Thu, 18 Nov 1999 05:02:19 -0700 From: David Cottle <---@---.---> Subject: Random Seed (again) Hi, I'm showing students how to do dynamic patching, using your example from the examples folder. But they are now fascinated with the notion of a random seed and want me to add it in every file I give them. I seed the number generator once in the example below, but when we play the file there are still some elements that are different each time, so there is apparently two threads going on and I need to seed them both. (I remember I had the same problem with the Webern project.) But I'm not sure where to but the second seed. Could you help? (The goal being to get precisely the same events with a given seed.) Synth.scope({ var inst1, inst2, inst3, pattern, stream, out, seed = 2; inst1 = { arg freq, amp, pan; Pan2.ar(SinOsc.ar(freq), pan, amp); }; inst2 = { arg amp, pan, freq; Pan2.ar(RLPF.ar(Saw.ar(freq), freq * 6, 0.1), pan, amp); }; inst3 = { arg pan, freq, amp; Pan2.ar(Resonz.ar(GrayNoise.ar, freq * 4, 0.04), pan, amp * 8); }; if(seed != 0, {thisThread.randSeed = seed}, {0.rand; seed = thisThread.randSeed} ); "//".post; thisThread.randSeed.post; pattern = Pbind( \freq, Pfunc({ // randomly choose a sweep, a vibrato, or an arpeggio [ { XLine.kr(exprand(40, 2000), exprand(40, 2000), 2.2) }, { var f; f = 2000.0.rand; SinOsc.kr(20.0.linrand, 0, f * 0.5.linrand, f) }, { Sequencer.kr( `([ [0, -18, 27, 12, -23, 33].scramble, [1, -3, 5, 2, 4].scramble ].choose), Impulse.kr(10.rand), 1, 48 + 36.rand ).midicps } ].choose.value; }), \amp, Pfunc({ [ { SinOsc.kr(20.0.rand, 0, 0.1, 0.1) }, { var start; start = exprand(0.002, 0.2); XLine.kr(start, 0.2 - start, 2.2) } ].choose.value; }), \pan, Pfunc({ [ { Line.kr(1.0.rand2, 1.0.rand2, 2.2) }, { SinOsc.kr(4.0.rand) } ].choose.value; }), \instr, Prand([ inst1, inst2, inst3 ], inf) ); stream = pattern.asEventStream(Event.new); out = OverlapTexture.ar({ var event; event = stream.next; event.use({ ~instr.valueEnvir; }); }, 2, 0.1, 2, 2); CombN.ar(out, 0.2, 0.2, 1, 0.7, out); }) ------------------------------ Date: Sun, 21 Nov 1999 00:03:25 -0500 From: Mic Berends <---@---.---> Subject: ?s. is there / will there be a way to control shape of grain envelopes for PSinGrain and GrainTap? how would i manipulate SliderView to select notes in a chromatic scale? or must i always type cps in a NumericView to get my note? building n octaves of radio buttons doesn't seem elegant. - -- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>v ^ Mic Berends : in the end, : Tomorrow Maximum v ^ MINDESIGN limited : there can be : Heaven Kissing EP v ^ http://www.mindesign.com/ : only one. : available now. v ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ------------------------------ Date: Sat, 20 Nov 1999 23:12:37 -0700 From: James McCartney <---@---.---> Subject: Re: ?s. At 10:03 PM -0700 11/20/99, Mic Berends wrote: >is there / will there be a way to control shape of grain envelopes for >PSinGrain Just spawn your own events for grains. You can't spawn taps currently though. > >how would i manipulate SliderView to select notes in a chromatic scale? >or must i always type cps in a NumericView to get my note? I don't understand what the problem is. You can poll the value of the slider. You can set the step value of the slider to 1 so that only integer key values are produced. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Sat, 20 Nov 1999 23:19:12 -0700 From: James McCartney <---@---.---> Subject: Re: Random Seed (again) At 5:02 AM -0700 11/18/99, David Cottle wrote: >Hi, > >I'm showing students how to do dynamic patching, using your example from the >examples folder. But they are now fascinated with the notion of a random >seed and want me to add it in every file I give them. I seed the number >generator once in the example below, but when we play the file there are >still some elements that are different each time, so there is apparently two >threads going on and I need to seed them both. (I remember I had the same >problem with the Webern project.) But I'm not sure where to but the second >seed. Could you help? (The goal being to get precisely the same events with >a given seed.) I'm thinking about changing the way seeding is done. Basically you have to provide a seed for each new thread. The Routines created by patterns are threads. However you often do not have access to the place where the thread is created in order to supply the seed. To fix this I want to make a similar mechanism to the way tempo bases now work where threads inherit a common seed unless reseeded. But for now there is no answer. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Sat, 20 Nov 1999 23:42:22 -0700 From: James McCartney <---@---.---> Subject: Re: Output sound and MIDI At 4:57 AM -0700 11/18/99, Landon Rose wrote: >James- > can't find any examples or tutorials which thread sound and MIDI out. >What I would like is to do something like this: (this of course only plays >the sound, I can't figure out how to enclose PBind, if indeed I should use >it): see below. >if I was to write this using Synth.play- how do I write it? You can use any pattern as a unit generator by using the asSpawn method: ( var pat; pat = Pbind(\degree, Pseq([0,1,2,3],inf), \dur, 0.125); Synth.play({ pat.asSpawn(Event.protoEvent, channels: 2) * SinOsc.ar(MouseX.kr(2,2000,\exponential)) }); ) You can do the same for your MIDIOut instrument. In that case you don't care about the audio output of the Spawn, but you write it the same way with asSpawn. >can you explain inner and outer synths ? The innersynth is the one created for each event. The outersynth is the one that encloses the entire pattern. >this example works with or without (channels: 1) . what is that doing? This specifies the number of output channels in the Spawn for the pattern. If you don't specify it, it defaults to 2. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: < ------------------------------ Date: Sun, 21 Nov 1999 01:48:00 -0500 From: Mic Berends <---@---.---> Subject: Re: ?s. James McCartney wrote: > >how would i manipulate SliderView to select notes in a chromatic scale? > >or must i always type cps in a NumericView to get my note? > > I don't understand what the problem is. You can poll the value of > the slider. You can set the step value of the slider to 1 so that > only integer key values are produced. ah, of course, no problem. make array and display/set indexed var. ta. - -- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>v ^ Mic Berends : in the end, : Tomorrow Maximum v ^ MINDESIGN limited : there can be : Heaven Kissing EP v ^ http://www.mindesign.com/ : only one. : available now. v ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ------------------------------ Date: Sun, 21 Nov 1999 01:10:26 -0700 From: James McCartney <---@---.---> Subject: Re: ?s. At 11:48 PM -0700 11/20/99, Mic Berends wrote: >James McCartney wrote: > >> >how would i manipulate SliderView to select notes in a chromatic scale? >> >or must i always type cps in a NumericView to get my note? >> >> I don't understand what the problem is. You can poll the value of >> the slider. You can set the step value of the slider to 1 so that >> only integer key values are produced. > >ah, of course, no problem. make array and display/set indexed var. ta. No, not for a chromatic scale. ( var w; w = GUIWindow.new("panel", Rect.newBy(158, 65, 283, 94)); SliderView.new( w, Rect.newBy(22, 32, 243, 21), "SliderView", 36, 36, 48, 1); { LFSaw.ar(w.at(0).kr(lagTime: 0).midicps, 0.1) }.play; w.close; ) or even some other scale: ( var w, scale; w = GUIWindow.new("panel", Rect.newBy(158, 65, 283, 94)); SliderView.new( w, Rect.newBy(22, 32, 243, 21), "SliderView", 0, 0, 7, 1); scale = FloatArray[0, 2, 3, 5, 7, 8, 10]; { LFSaw.ar( DegreeToKey.kr( scale, w.at(0).kr( lagTime: 0 ), add: 60 ).midicps, 0.1) }.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: < ------------------------------ Date: Sun, 21 Nov 1999 10:16:41 -0700 From: David Cottle <---@---.---> Subject: Re: Random Seed (again) Hi, >> I'm showing students how to do dynamic patching, using your example from the >> examples folder. But they are now fascinated with the notion of a random [...] >> seed. Could you help? (The goal being to get precisely the same events with >> a given seed.) > > I'm thinking about changing the way seeding is done. > Basically you have to provide a seed for each new thread. [...] I suspected as much. Let me know when you have another method. It's not a critical issue. ------------------------------ Date: Mon, 22 Nov 1999 11:40:38 +0100 From: Ioannis Zannos <---@---.---> Subject: Rhythm follower Hello, a researcher here would like to detect inter-onset intervals in recorded Samba percussion for the purpose of rhythm analysis. We had a look at PeakFollower but it seems that adjusting the decay parameter would hardly yield the desired results. Therefore, since there are already 2 pitch followers in SC, how would one go about in constructing a peak (beat) follower? Note that this is not beat detection with automatic adjustment to a semi-regular beat pattern, it is rather just plain detection of attack peaks in percussion with a relatively clean amplitude profile, i.e. quite sharp peaks. Note: this would be useful for performance purposes too... IZ ------------------------------ Date: Mon, 22 Nov 1999 10:18:39 -0700 From: James McCartney <---@---.---> Subject: Re: Rhythm follower At 3:40 AM -0700 11/22/99, Ioannis Zannos wrote: >Hello, > >a researcher here would like to detect inter-onset intervals >in recorded Samba percussion for the purpose of rhythm >analysis. We had a look at PeakFollower but it seems >that adjusting the decay parameter would hardly >yield the desired results. Therefore, >since there are already 2 pitch followers in SC, >how would one go about in constructing a peak (beat) >follower? Note that this is not beat detection with >automatic adjustment to a semi-regular beat pattern, >it is rather just plain detection of attack peaks in >percussion with a relatively clean amplitude profile, >i.e. quite sharp peaks. >Note: this would be useful for performance purposes too... You need to be a little more specific about what algorithm you want to use to follow the beats. Making triggers from peaks can be done with Amplitude and >. You could use Sequencer to do some kind of process at each trigger such as determining time from last trigger. or something else.. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Mon, 22 Nov 1999 10:41:38 -0800 From: Scott Gilman <---@---.---> Subject: Re: Rhythm follower I feel screwed ------------------------------ Date: Mon, 22 Nov 1999 10:54:31 -0800 From: Scott Gilman <---@---.---> Subject: Re: I feel screwed sorry...wrong address ------------------------------ Date: Mon, 22 Nov 1999 20:28:48 +0100 From: Julian Rohrhuber <---@---.---> Subject: Re: Rhythm follower maybe you find this useful somehow ( maybe with a dynamic time parameter ) I wrote it to limit cpu peaks in an installation that was triggered by knocking on a wall reset = { arg trig, resolution; SetResetFF.kr(trig, Impulse.kr(resolution)) }; starting from this a first scetch maybe there is a solution in this direction: ( var grid, input, output, timescale, mx, my; var file, filename; timescale = 2; grid = { arg in, thresh, time, timeoffset; var trig; trig = in > thresh; trig = SetResetFF.kr(trig, DelayN.ar(Impulse.kr(1/time), 2, timeoffset.max(2))) ; trig = Trig.ar(trig, time/8) }; filename = ":sounds:floating_1"; file = SoundFile.new; file.readHeader(filename); { mx = MouseX.kr(0, 2);// controls offset in time my = MouseY.kr(0, 1);// controls threshhold input = Mix.ar(DiskIn.ar(file, true)); output = Array.fill(5, { arg i; var outTrig; outTrig = grid.value(input, my, timescale/(i+1), my); Decay2.ar(outTrig, 0.01, 0.04, FSinOsc.ar(200*(i+1), 0.1)); }) ++ input; //Mix.ar(output); }.scope; ) Ioannis Zannos schrieb: > Hello, > > a researcher here would like to detect inter-onset intervals > in recorded Samba percussion for the purpose of rhythm > analysis. We had a look at PeakFollower but it seems > that adjusting the decay parameter would hardly > yield the desired results. Therefore, > since there are already 2 pitch followers in SC, > how would one go about in constructing a peak (beat) > follower? Note that this is not beat detection with > automatic adjustment to a semi-regular beat pattern, > it is rather just plain detection of attack peaks in > percussion with a relatively clean amplitude profile, > i.e. quite sharp peaks. > Note: this would be useful for performance purposes too... > > IZ ------------------------------ Date: Mon, 22 Nov 1999 11:46:13 -0800 (PST) From: Chris Brown <---@---.---> Subject: changing indices from GUI Is it possible to change a table being used in a synth while the synth is running ? The example below is a brute force attempt that admittedly would not sound good, but i'm stalled on the concept - why can't the output of a GUI that has been converted to an integer be used to select a new table for the waveshaper from a list ? ( // waveshaping var tablelist, tableSel, sview; w = GUIWindow.new("WaveShaper", Rect.new(20, 40, 40 + 360, 360)) .backColor = Color.new(128 + 128.rand, 128 + 128.rand, 128 + 128.rand); sview = SliderView.new(w, Rect.newBy(20 + 8, 20, 20, 256)).mapToController(1,33); sview.setParams(1,1,4,1 ); tablelist = List[ ]; tablelist.add(Wavetable.chebyFill(512,[1,0,0,0])); tablelist.add(Wavetable.chebyFill(512,[0,1,0,0])); tablelist.add(Wavetable.chebyFill(512,[0,0,1,0])); tablelist.add(Wavetable.chebyFill(512,[0,0,0,1])); Synth.scope({ t = Plug.ar(sview).ceil; // Peep.kr(t-1); Shaper.ar( tablelist.at(2), \\ would like to replace index with t, but basicAt fails SinOsc.ar(Sequencer.kr(`[200, 300, 400], LFPulse.kr(6)) , 0, SinOsc.kr(0.1,0)), 0.5 ) }); w.close; ) **************************************************** Chris Brown Composer, Pianist, Electronic Musician Assoc. Prof. of Music and Co-Director, Center for Contemporary Music (CCM) Mills College, Oakland, CA 94613 email: cbmus@mills.edu, phone: 510-430-2330; fax 510-430-3314 **************************************************** ------------------------------ Date: Mon, 22 Nov 1999 14:03:54 -0700 From: James McCartney <---@---.---> Subject: Re: changing indices from GUI At 12:46 PM -0700 11/22/99, Chris Brown wrote: >Is it possible to change a table being used in a synth while >the synth is >running ? The example below is a brute force attempt that admittedly >would not sound good, but i'm stalled on the concept - why can't the >output of a GUI that has been converted to an integer be used to select a >new table for the waveshaper from a list ? Generally I did not implement things that could cause a click. Changing a wavetable is such a thing. The solution is to tspawn a new copy with a new table and release the envelope on the old copy. This way you get a crossfade to the new thing without a click. This kind of thing could be made simpler to write by implementing a class akin to OverlapTexture that would handle the envelope and other details. I'll look at doing that.. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Mon, 22 Nov 1999 16:24:51 -0500 From: Mic Berends <---@---.---> Subject: Re: changing indices from GUI hear, hear! good on ya James. ;) maybe a nice example? James McCartney wrote: > > At 12:46 PM -0700 11/22/99, Chris Brown wrote: > >Is it possible to change a table being used in a synth while > >the synth is > >running ? The example below is a brute force attempt that admittedly > >would not sound good, but i'm stalled on the concept - why can't the > >output of a GUI that has been converted to an integer be used to select a > >new table for the waveshaper from a list ? > > Generally I did not implement things that could cause a click. > Changing a wavetable is such a thing. > The solution is to tspawn a new copy with a new table and > release the envelope on the old copy. This way you get a crossfade > to the new thing without a click. > This kind of thing could be made simpler to write by implementing > a class akin to OverlapTexture that would handle the envelope > and other details. I'll look at doing that.. > > --- james mccartney james@audiosynth.com http://www.audiosynth.com > If you have a PowerMac check out SuperCollider2, a real time synth program: > - -- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>v ^ Mic Berends : in the end, : Tomorrow Maximum v ^ MINDESIGN limited : there can be : Heaven Kissing EP v ^ http://www.mindesign.com/ : only one. : available now. v ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ------------------------------ Date: Mon, 22 Nov 1999 17:14:32 -0700 From: James McCartney <---@---.---> Subject: Re: changing indices from GUI At 2:24 PM -0700 11/22/99, Mic Berends wrote: >hear, hear! good on ya James. ;) >maybe a nice example? < Oh you're just so cute.. I added class this into XFadeTexture.sc : TrigXFade { *ar { arg inputPatchFunc, trig, transitionTime = 0.01, numChannels = 1, maxRepeats, mul = 1.0, add = 0.0; var envgen, env, tspawn, prevSynth; env = Env.new( [ 1.0, 1.0, 0.0], [ transitionTime, transitionTime ], 'linear', 1 ); thisSynth.sched(0, { tspawn.source.trigger }); // start first event.. ^tspawn = TSpawn.ar({ arg spawn, i, synth; if (prevSynth.notNil, { // second and subsequent events env.levels.put(0, 0.0); // begin at zero amp. prevSynth.release; }); prevSynth = synth; envgen = EnvGen.kr(env); envgen * inputPatchFunc.value(spawn, i, synth); }, numChannels, maxRepeats, trig, mul, add ) } } Then I can write this : ( var tables, numTables = 8, maxHarmonics = 24, numHarmonics = 6; // make a bunch of tables tables = Array.fill(numTables, { var harmonics; harmonics = Array.newClear(maxHarmonics).fill(0.0); numHarmonics.do({ harmonics.put(maxHarmonics.rand, 1.0.rand) }); Wavetable.sineFill(1024, harmonics); }); Synth.scope({ arg synth; TrigXFade.ar( { COsc.ar( tables.at(numTables.rand), 80, 2.0.rand, 0.1 ); }, Dust.kr(2), // trigger 0.1 // transition time ) }) ) --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: < ------------------------------ Date: Mon, 22 Nov 1999 23:59:12 -0800 (PST) From: Chris Brown <---@---.---> Subject: Re: changing indices from GUI aahh...TrigXFade is really great !! but I'm still hung up on a much more primitive (probably) issue: using a GUI fader to select that table-selecting index. I keep getting the "basicAt failed not an Integer" message -- even w/ TrigXFade this still doesn't work - is there a simple fix ? thanks, chris ( // waveshaping var tablelist, tableSel, sview, nview; w = GUIWindow.new("WaveShaper", Rect.new(20, 40, 40 + 360, 360)) .backColor = Color.new(128 + 128.rand, 128 + 128.rand, 128 + 128.rand); sview = SliderView.new(w, Rect.newBy(20 + 8, 20, 20, 256)).mapToController(1,33); sview.setParams(1,1,4,1 ); nview = NumericalView.new(w, Rect.newBy(20 + 8, 280, 20, 25), 'P1', 1,1,4,1, 'linear').backColor_(rgb(100,100,0,0)).labelColor_(rgb(0,100,0,0)); sview.action = { nview.value = sview.value }; nview.action = { sview.value = nview.value }; tablelist = List[ ]; tablelist.add(Wavetable.chebyFill(512,[1,0,0,0])); tablelist.add(Wavetable.chebyFill(512,[0,1,0,0])); tablelist.add(Wavetable.chebyFill(512,[0,0,1,0])); tablelist.add(Wavetable.chebyFill(512,[0,0,0,1])); tableSel = Plug.ar(w.views.at(0),0.1).ceil; Synth.scope({ arg synth; TrigXFade.ar( { Shaper.ar( tablelist.at(tableSel.value), SinOsc.ar(300, 0, SinOsc.kr(0.1,0)), 0.5 ); }, LFPulse.kr(2), 0.1 ) }); w.close; ) **************************************************** Chris Brown Composer, Pianist, Electronic Musician Assoc. Prof. of Music and Co-Director, Center for Contemporary Music (CCM) Mills College, Oakland, CA 94613 email: cbmus@mills.edu, phone: 510-430-2330; fax 510-430-3314 **************************************************** ------------------------------ Date: Tue, 23 Nov 1999 02:45:12 -0700 From: James McCartney <---@---.---> Subject: Re: changing indices from GUI At 12:59 AM -0700 11/23/99, Chris Brown wrote: >aahh...TrigXFade is really great !! > >but I'm still hung up on a much more primitive (probably) issue: using a >GUI fader to select that table-selecting index. I keep getting the >"basicAt failed not an Integer" message -- even w/ >TrigXFade this still doesn't work - is there a simple fix ? > >thanks, >chris 1. don't create ugens outside of a Synth. They won't work. >tableSel = Plug.ar(w.views.at(0),0.1).ceil; >Synth.scope({ arg synth; 2. You don't need this Plug anyway to choose the table. ControlViews can be asked for their value directly. You only need a Plug if you want to make a continuous signal out of it. But you are choosing your table discretely, not continuously. (I do wind up using a Plug in point #7 below, but for a different reason.) 3. Array indices begin at zero yet your slider goes from 1 to 4. 4. You need to use 'asInteger' to convert the Float value from the control to an Integer index. 5. w.views.at(0) can be more simply written as w.at(0) 6. If you were using Shaper to process some other input then you would want to put that outside of the TrigXFade the way I've done with SinOsc below 7. Instead of polling at 2 Hz, you could use a Plug on the slider and HPZ1.kr(...).abs to detect a change in its value and use that as the trigger. ( // waveshaping var tablelist, tableSel, sview, nview; w = GUIWindow.new("WaveShaper", Rect.new(20, 40, 40 + 160, 360)) .backColor = Color.new(128 + 128.rand, 128 + 128.rand, 128 + 128.rand); sview = SliderView.new(w, Rect.newBy(20 + 8, 20, 20, 256)).mapToController(1,33); sview.setParams(0,0,3,1); nview = NumericalView.new(w, Rect.newBy(20 + 8, 280, 20, 25), 'P1', 0,0,3,1, 'linear').backColor_(rgb(100,100,0,0)).labelColor_(rgb(0,100,0,0)); sview.action = { nview.value = sview.value }; nview.action = { sview.value = nview.value }; tablelist = List[ ]; tablelist.add(Wavetable.chebyFill(512,[1,0,0,0])); tablelist.add(Wavetable.chebyFill(512,[0,1,0,0])); tablelist.add(Wavetable.chebyFill(512,[0,0,1,0])); tablelist.add(Wavetable.chebyFill(512,[0,0,0,1])); Synth.scope({ arg synth; var in; in = SinOsc.ar(300, 0, SinOsc.kr(0.1,0)); TrigXFade.ar( { Shaper.ar( tablelist.at(w.at(0).value.asInteger), in, 0.5 ); }, HPZ1.kr(w.at(0).kr(lagTime: 0.0)).abs, 0.1 ) }, bounds: Rect.newBy(300,80,300,200)); w.close; ) --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: < ------------------------------ Date: Tue, 23 Nov 1999 12:52:20 +0000 From: "Lawrence Ball" <---@---.---> Subject: Greetings/reference/request for help Hi James, You may remember me from May when I purchased S-Col and we had a very brief interchange. I have a strong interest in developing implementations of my Harmonic Mathematics (I believe one Mic Berends has emailed you my description of this work- [for other Scolars its on Digest 13 (I think) of Algo-comp (a onelist group dedicated to algorithmic composition issues)]). I didn't send you the material last time around in May as I was nervous about non-attribution (to me, should the ideas get very public) issues,- now the material is on the Algo-comp and Iota group digests, so its "OK". The HM description should tell you what at root I am trying to do. If you could help Mic and myself get going with a basic kernel I'm sure each of us would be able to build really well. Its that loop which needs somehow to be integrated into S-Col. Vis-a-vis the response below: Is the problem with updating and playing-to-DAC at the same time that if a bit changes whilst being output then it will likely cause a micro-thud in the sound? I remember that the Mountain Hardware on the Apple II had alternating cycles of access to the synth memory for the processor on the card and the 6502 in the computer. Some means anyway to lock updates out for that critical moment. Perhaps alternate buffers of sound would work, one being potentially updated whilst the other is playing? If the problem of live update can be solved then I would consider getting involved in S-Col programming, but I'd need a core engine. The interchange we had in May I include so that you can make the connection. I send best and sincere greetings to yourself, Lawrence - ---------- >From: James McCartney <---@---.---> >To: sc-users@lists.io.com >Subject: Re: changing indices from GUI >Date: Mon, Nov 22, 1999, 9:03 pm > >At 12:46 PM -0700 11/22/99, Chris Brown wrote: >>Is it possible to change a table being used in a synth while >>the synth is >>running ? The example below is a brute force attempt that admittedly >>would not sound good, but i'm stalled on the concept - why can't the >>output of a GUI that has been converted to an integer be used to select a >>new table for the waveshaper from a list ? > >Generally I did not implement things that could cause a click. >Changing a wavetable is such a thing. >The solution is to tspawn a new copy with a new table and >release the envelope on the old copy. This way you get a crossfade >to the new thing without a click. >This kind of thing could be made simpler to write by implementing >a class akin to OverlapTexture that would handle the envelope >and other details. I'll look at doing that.. > > > --- james mccartney james@audiosynth.com http://www.audiosynth.com >If you have a PowerMac check out SuperCollider2, a real time synth program: > > >OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOO )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ))))))))))))))))))))))) ORIGINAL EMAILS IN MAY. >At 4:52 AM -0600 5/10/99, Lawrence Ball wrote: >Dear SuperCollider Tech people, >I just purchased SC and would be grateful for help with the following: >A) I wish to use the following procedure to generate a sound stream: > (this I exemplify in Basic) > For y=1 to n > For x=1 to 8192 > Table1(x)=Table1(x)+Table2(x) modulo 32768 > Table3(x)=Table4(Table1(x)) > Next x > Next y > Output Table3 as a wave cycle. > Is this possible in SuperCollider? >B) Specifically- can I refer to a list (1Darray) as a variable? > - can I then output Table3's 8192 values? > I hope I don't sound too faithless- I did this on an >Apple2/Mountain Hardware in 1983 >and havn't found any package that can do it afterwards. SC sounds like it >can. >Many thanks for any help you can give me with this- even pointing me at the >right edoc pages. >Best wishes, Lawrence Ball First, you should join the mailing list. Many questions are discussed there and it is a great place to share learning the program with other people. I don't exactly understand what your loop is supposed to do since the variable y is not used for anything. It is certainly easy to generate and modify wavetables in SC. However wavetables are floats not integers in SC. You don't even need loops to do math operations on buffers of floats. SC is a much more powerful language than Basic so you can do many operations at a higher level. Here are a couple of examples you can copy into SC and execute. /////////////////////////////////////////////////////////// ( var size, s1, s2, s3, s4; size = 8192; // A Signal is a subclass of FloatArray that responds // to math operators. // create and fill buffer 1 with a function evaluated // on an interval (0 to 2pi) s1 = Signal.newClear(size); s1.waveFill({ arg x; (cos(x) * -0.5) + 0.5 }, 0, 2pi ); // create and fill buffer 2 with a different function s2 = Signal.newClear(size); s2.waveFill({ arg x; (x * 3) % 1.0 - 0.5 }, 0, 1 ); // add and scale the signals. no loop needed. s3 = (s1 + s2) * 0.5; // multiply the signals s4 = s1 * s2; // display the operands and results in a window SignalWindow.new("example 1", nil, [s1, s2, s3, s4]); ) /////////////////////////////////////////////////////////// ( // add a table with a shifted copy of itself var size, shift, s1, s2; size = 8192; shift = 768; // A Signal is a subclass of FloatArray that responds // to math operators. // create and fill a buffer with a function s1 = Signal.newClear(size); s1.waveFill({ arg x; (x * 3) % 1.0 - 0.5 }, 0, 1 ); // create a buffer for the result. s2 = Signal.newClear(size); size.do({ arg i; // 'put' is used to store into a sequentiable collection // and 'at' is used to access it. 'wrapAt' is used to // access it using wrap around indexing. s2.put(i, s1.at(i) + s1.wrapAt(i + shift) ); }); // display the operands and results in a window SignalWindow.new("example 2", nil, [s1, s2]); ) /////////////////////////////////////////////////////////// --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: > ------------------------------ Date: Tue, 23 Nov 1999 08:37:35 -0500 From: Mic Berends <---@---.---> Subject: please help. // what i would like to know is why does the Osc not see b as wavetable? // also how do i iterate the overDub/fold function and play the results? with TrigXFade? ( var a, b; a = Signal.newClear(1024).waveFill({ arg x; (x*2) }, 0, 1 ); b = Signal.sineFill(1024, [1]); b.overDub(a,1).fold(-1, 1).asWavetable; Synth.scope ({ Osc.ar(b, 200) }); ) this is an attempt to implement Lawrence Ball's "core" as i understand it... of course, James wrote: > You are obviously confused, and I do not know how to unconfuse you. and this is still quite possible... :? Cheers, Mic. - -- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>v ^ Mic Berends : in the end, : Tomorrow Maximum v ^ MINDESIGN limited : there can be : Heaven Kissing EP v ^ http://www.mindesign.com/ : only one. : available now. v ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ------------------------------ Date: Tue, 23 Nov 1999 09:45:09 -0700 From: James McCartney <---@---.---> Subject: Re: Greetings/reference/request for help At 5:52 AM -0700 11/23/99, Lawrence Ball wrote: >Is the problem with updating and playing-to-DAC at the same time that if a >bit changes whilst being output then it will likely cause a micro-thud in >the sound? >I remember that the Mountain Hardware on the Apple II had alternating cycles >of access to the synth memory for the processor on the card and the 6502 in >the computer. Some means anyway to lock updates out for that critical >moment. Perhaps alternate buffers of sound would work, one being potentially >updated whilst the other is playing? If the problem of live update can be >solved then I would consider getting involved in S-Col programming, but I'd >need a core engine. The interchange we had in May I include so that you can >make the connection. > The problem is the way you are trying to implement what you are doing. It seems that you are using wavetables and double buffer them because that is what worked on the Apple II whereas it would be much more efficient to express it in terms of continuous functions. You also need to use floats and not integers. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Tue, 23 Nov 1999 09:49:44 -0700 From: James McCartney <---@---.---> Subject: Re: please help. At 6:37 AM -0700 11/23/99, Mic Berends wrote: >// what i would like to know is why does the Osc not see b as wavetable? Because you do not assign the result of asWavetable to anything. Many operations in SuperCollider are functional. That is they do not affect the receiver but return a result. It is impossible to change the class of an object in place. You have to do an assignment. I don't think fold works on Signals. I've fixed this in the next release. However I think to do what you are trying to do you should forget about using wavetables and just use continuous functions. Add SinOscs together and use fold in real time. It seems that the only reason you are using wavetables is because you HAD TO on the Apple II. --- 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 #74 *****************************