From: owner-sc-users-digest@lists.io.com (sc-users-digest) To: sc-users-digest@lists.io.com Subject: sc-users-digest V1 #92 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, March 6 2000 Volume 01 : Number 092 ---------------------------------------------------------------------- Date: Sat, 04 Mar 2000 11:25:15 -0600 From: James McCartney <---@---.---> Subject: Re: memory use question on 3/4/00 11:13 AM, Paul Lansky at paul@silvertone.Princeton.EDU wrote: > > I'm loading about 6 meg worth of sound into an array of sample > segments using Synth.collect and then accessing the various parts of > the array with PlayBuf. Works fine *once* and then I get > a memory error. Restart, and the same thing happens. > Is it necessary to close the array or is there a memory > leak somewhere? The space should be garbage collected if you eliminate all references to the object. If there is a reference retained, say for example in one of the interpreter variables a-z, then the object remains in memory. It is also possible to fragment memory so that you don't have a large contiguous block remaining. - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Sat, 04 Mar 2000 15:18:31 -0600 From: James McCartney <---@---.---> Subject: selecting text bug A number of people had reported in the past that double clicking parentheses didn't select the text in between. I had been unable to reproduce this and so gave the standard Mac programmer's lame excuse that it must be some extension. Well today I needed to be able to read some chinese characters in an email and so installed the MacOS Language Kits (which does happen to be a set of extensions). Lo and behold the reported behaviour manifested itself in SC. So I have now tracked down and fixed the problem and it will be in the next release. - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Sun, 5 Mar 2000 09:56:33 +0100 From: rkuivila@mail.wesleyan.edu (Ron Kuivila) Subject: long, fast convolutions Hi all, I am working on doing longish convolutions with impulse responses. The basic fast convolution takes the product of two signals windowed to be half the length of the FFT (to make room for the trailing edge of the impulse response in the result) and do the usual overlap and add. In the case of a fixed impulse response, you can make a series of FFT's for different segments of the impulse response, multiple them by the input signal's FFT, delay the various segments the appropriate amounts, and sum them. Below is my implementation of this idea. Is there a better way to do this? RJK sR = Synth.sampleRate; results = [a list of FFT's of impulse response segments]; iR0s = results.collect({ arg r; r = r.real; PlayBuf.ar(Signal.newClear(1) ++ r ++ Signal.newClear(1)) }); iR1s = results.collect({ arg r; r = r.real; PlayBuf.ar(Signal.newClear(1) ++ r ++ Signal.newClear(1), offset: fftsizeDiv2) }); iI0s = results.collect({ arg r; r = r.imag; PlayBuf.ar(Signal.newClear(1) ++ r ++ Signal.newClear(1)) }); iI1s = results.collect({ arg r; r = r.imag; PlayBuf.ar(Signal.newClear(1) ++ r ++ Signal.newClear(1), offset: fftsizeDiv2) }); numSegs.do({ arg i; var seg; if (i == 0, { fft3 = [fft2.at(0) * Complex(iR0s.at(i),iI0s.at(i)), fft2.at(1) * Complex(iR1s.at(i),iI1s.at(i))] }, { seg = [fft2.at(0) * Complex(iR0s.at(i),iI0s.at(i)), fft2.at(1) * Complex(iR1s.at(i),iI1s.at(i))]; fft3 = [ fft3.at(0) + Complex(DelayN.ar(seg.at(i % 2).real, (i+1)*fftsize/sR, i*fftsize/(2 * sR)), DelayN.ar(seg.at(i % 2).imag, (i+1)*fftsize/sR, i*fftsize/(2 * sR))), fft3.at(1) + Complex(DelayN.ar(seg.at((i + 1) % 2).real, (i+1)*fftsize/sR, i*fftsize/(2 * sR)), DelayN.ar(seg.at((i + 1) % 2).imag, (i+1)*fftsize/sR, i*fftsize/(2 * sR))) ]; } ); }); ifft = IFFT.ar(fftsize, fftoffsets, cosineTable, nil, nil, fft3.real, fft3.imag); ------------------------------ Date: Sun, 05 Mar 2000 19:36:42 +0100 From: Roland Pfrengle <---@---.---> Subject: Controlling Arrays Hi, a problem I cannot fix at my momentary level of learning SC: how can I control the content of an array, (in my case part of a Klank) by MIDI? CPU lag runs up:----------------???????? ( var in, out, amp, dur,pitchshift,freq, freqAll = #[126,151.25,163.5,184.88,189.75,199.75,238.63,251,302.5,327,369.75,377.5, 399.5,477.25,515,605,799,1016,1308,1479,1510,1909,2702,2856,3400,3896]; n = 26; amp = Array.fill(n,{arg i; 0.05+((0.05*i).cubed)}); dur = Array.fill(n,{arg i; 1+(0.2*i)}); pitchshift = MIDIController.new(1,3,1.0,2.0); Synth.play({ Spawn.ar( { freq = Array.fill(n, {arg count; if (count.even,{(freqAll.at(count)) * pitchshift.poll}, {(freqAll.at(count)) / pitchshift.poll}); }); in = AudioIn.ar(2); Klank.ar(`[ freq, amp, dur ], in, mul: 0.003); }, 1, 0.2, nil ) })) ////////////////////////////////////////// ( var in, out, amp, dur,pitchshift,freq, freqAll = #[126,151.25,163.5,184.88,189.75,199.75,238.63,251,302.5,327,369.75,377.5, 399.5,477.25,515,605,799,1016,1308,1479,1510,1909,2702,2856,3400,3896]; n = 26; amp = Array.fill(n,{arg i; 0.05+((0.05*i).cubed)}); dur = Array.fill(n,{arg i; 1+(0.2*i)}); //3 Sek. pitchshift = MIDIController.new(1,3,1.0,2.0); {arg synth; synth.repeat(0,0.1,{ freq = Array.fill(n, {arg count; if (count.even,{(freqAll.at(count)) * pitchshift.poll}, {(freqAll.at(count)) / pitchshift.poll}) }) }); in = AudioIn.ar(2); Klank.ar(`[ freq, amp, dur ], in, mul: 0.003); }.play • ERROR: Klank frequencies not an array. --------------????????? ) Thanks for a short note Roland ------------------------------ Date: Sun, 05 Mar 2000 12:55:12 -0600 From: James McCartney <---@---.---> Subject: Re: Controlling Arrays on 3/5/00 12:36 PM, Roland Pfrengle at roland.p@snafu.de wrote: > Hi, > > a problem I cannot fix at my momentary > level of learning SC: > > how can I control the content of an array, > (in my case part of a Klank) by MIDI? > > > CPU lag runs up:----------------???????? > ( > var in, out, amp, dur,pitchshift,freq, > freqAll = > #[126,151.25,163.5,184.88,189.75,199.75,238.63,251,302.5,327,369.75,377.5, > > > 399.5,477.25,515,605,799,1016,1308,1479,1510,1909,2702,2856,3400,3896]; > > n = 26; > amp = Array.fill(n,{arg i; 0.05+((0.05*i).cubed)}); > dur = Array.fill(n,{arg i; 1+(0.2*i)}); > pitchshift = MIDIController.new(1,3,1.0,2.0); > > Synth.play({ > Spawn.ar( > { > freq = Array.fill(n, > {arg count; > if (count.even,{(freqAll.at(count)) * pitchshift.poll}, > {(freqAll.at(count)) / pitchshift.poll}); > }); > > in = AudioIn.ar(2); > Klank.ar(`[ > freq, > amp, > dur > ], in, mul: 0.003); > }, > 1, > 0.2, > nil > ) > })) > > ////////////////////////////////////////// > > ( > var in, out, amp, dur,pitchshift,freq, > freqAll = > #[126,151.25,163.5,184.88,189.75,199.75,238.63,251,302.5,327,369.75,377.5, > > > 399.5,477.25,515,605,799,1016,1308,1479,1510,1909,2702,2856,3400,3896]; > > n = 26; > amp = Array.fill(n,{arg i; 0.05+((0.05*i).cubed)}); > dur = Array.fill(n,{arg i; 1+(0.2*i)}); //3 Sek. > pitchshift = MIDIController.new(1,3,1.0,2.0); > > {arg synth; > > synth.repeat(0,0.1,{ > freq = Array.fill(n, > {arg count; > if (count.even,{(freqAll.at(count)) * pitchshift.poll}, > {(freqAll.at(count)) / pitchshift.poll}) > }) > }); > > in = AudioIn.ar(2); > Klank.ar(`[ > freq, > amp, > dur > ], in, mul: 0.003); > }.play > • ERROR: Klank frequencies not an array. --------------????????? > ) > > > Thanks for a short note > > Roland > The reason the CPU keeps going up is that you have no envelope on there to release the voice. You can't update the array to Klank. It gets one when it starts and that's it. The Klank is constructed before synthesis begins, as always. Thus freq is nil, because synthesis must begin before the first event can be scheduled by sched. - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Sun, 05 Mar 2000 19:25:25 +0000 From: finer@easynet.co.uk Subject: Instruments & arguments In a patch such as : (// an editable instrument a = Instrument.new(\noise, { arg freq = 10,pan = 0; Pan2.ar(LFNoise0.ar(freq),pan) }); a.play ) I've figured out that I can have some control over the edit GUI in the mixer by using preset parameters and by adding new ones in the ParamSpec class. So far so good - but is there a way to add other items like scope windows for example. Really what I'm after is being able to sample a bit of audio but then to see the waveform as an aid to setting start and end points for playback. Jem ------------------------------ Date: Sun, 05 Mar 2000 13:43:47 -0600 From: James McCartney <---@---.---> Subject: Re: Instruments & arguments on 3/5/00 1:25 PM, finer@easynet.co.uk at finer@easynet.co.uk wrote: > I've figured out that I can have some control over the edit GUI in the mixer > by using preset parameters and by adding new ones in the ParamSpec class. So > far so good - but is there a way to add other items like scope windows for > example. No, but I'd be happy to see someone add it.. heh heh.. Some reconceptualization design work needs to be applied to the mixer. I'm busy with other issues at the moment. - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Mon, 6 Mar 2000 16:10:21 +0100 From: Joel Ryan <---@---.---> Subject: Pan(Mix(Pan)).. James, I've had trouble with Pan in the following stripped down patch warped from one of your examples; It worked in the original with Pan2(decay(playbuf)) , (v. fragment ) but my version with Tspawn in place of Decay will not. I've tried many positions for the Pan2() from inside Mix to surrounding Mix's context, to assigning Mix to a variable and trying Pan2(output). Of course Decay not Tspawn but don't they both return the same sort of beast? I've often had problems working a Pan into a working patch whats the trick? A second question, and what got me interested in the original example, When you turn off the slewing in the mouse plug, the offset doesn't work any more WHY? What does that say about the way playBuf's offset works? What is the difference when a plug is generating a stream of lagged data? Joel Ryan ( var filename, sound, signal; filename = ":Sounds:floating_1"; sound = SoundFile.new; if (sound.read(filename), { signal = sound.data.at(0); play({ arg synth; var trigger, mx, nStreams=4; mx =MouseX.kr(0, 0.1); trigger = LFPulse.ar( 2.4); Mix.arFill(nStreams, { var pat, offset; offset = mx.value*(signal.size-2); pat = `scramble([1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0]); //Pan2.ar( //PAN crashes now TSpawn.ar( { var env; env = Env.linen( 0.1, 0.2, 0.3, 0.3,'welch');// , 0.4, PlayBuf.ar(signal, sound.sampleRate, 1.0, offset.value ,0, signal.size-2, EnvGen.ar(env)) }, 2, nil, ImpulseSequencer.ar(pat, trigger) )//,1.0.rand2) // PAN }) }) }); ) original working fragment Pan2.ar( Decay2.ar( ImpulseSequencer.ar(pat, trigger), 0.002, 1.200, PlayBuf.ar(signal, sound.sampleRate, 1.0, offset.value, 0, signal.size-2)), 1.0.rand2) /////////////////////// Joel Ryan STEIM :: Ballett Frankfurt :: Institute of Sonology Achtergracht 19, 1017WL Amsterdam +31 (20) 624-3886 +31 (20) 626-4262 fax http://www.frankfurt-ballett.de/joel.html http://www.steim.nl /////////////////////////////////////////// ------------------------------ Date: Mon, 6 Mar 2000 15:49:36 +0100 From: Joel Ryan <---@---.---> Subject: problems with builtin editor James, Just for the record: a couple of chronic problems I have had with the built-in SC2 editor going back at least to version 2.2.4 and current in 2.2.7. 1) occasionally large section of text are duplicated during programming / debugging sessions The size is on the order of a recently interpreted selections of text. I dont recognize any pattern in the state of supercollider except perhaps using 'revert to saved' (this just observed) but as often I dont discover the error until well after it has occured... infrequent (a dozen times in a few months) but confusing. 2) the text highlight in the built in editors Find Sometimes it is there somestimes it is reduced to a thin box around the target text. This could be a mac tool box error as I get similar problems in BBEdit 3.5 Very hard to see. Im using a g3 (beige desktop) 8.6 JR /////////////////////// Joel Ryan STEIM :: Ballett Frankfurt :: Institute of Sonology Achtergracht 19, 1017WL Amsterdam +31 (20) 624-3886 +31 (20) 626-4262 fax http://www.frankfurt-ballett.de/joel.html http://www.steim.nl /////////////////////////////////////////// ------------------------------ Date: Mon, 06 Mar 2000 10:42:12 -0600 From: James McCartney <---@---.---> Subject: Re: problems with builtin editor on 3/6/00 8:49 AM, Joel Ryan at jr@xs4all.nl wrote: > James, > Just for the record: a couple of chronic problems I have had with the > built-in SC2 editor going back at least to version 2.2.4 and current in 2.2.7. > > 1) occasionally large section of text are duplicated during programming / > debugging sessions > The size is on the order of a recently interpreted selections of text. > I dont recognize any pattern in the state of supercollider > except perhaps using 'revert to saved' (this just observed) > but as often I dont discover the error until well after it has occured... > infrequent (a dozen times in a few months) but confusing. > I have never seen this. I will try testing revert to saved. > 2) the text highlight in the built in editors Find > Sometimes it is there somestimes it is reduced to a thin box around the > target text. > This could be a mac tool box error as I get similar problems in BBEdit 3.5 > Very hard to see. This would only happen if your window became not the front most window. That would be normal behaviour on the Mac. - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Mon, 06 Mar 2000 10:46:10 -0600 From: James McCartney <---@---.---> Subject: Re: Pan(Mix(Pan)).. on 3/6/00 9:10 AM, Joel Ryan at jr@xs4all.nl wrote: > James, > I've had trouble with Pan in the following stripped down patch > warped from one of your examples; The input you are passing to Pan is an array of 2 channels, not mono. Thus Pan expands to an array of an array of channels. Pan(x) returns [OutputProxy, OutputProxy] but Pan([a, b]) returns [[OutputProxy, OutputProxy],[OutputProxy, OutputProxy]] An array of an array is not a legal output. - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Mon, 06 Mar 2000 23:44:55 +0000 From: finer@easynet.co.uk Subject: instance variables I'm trying to make a new variable in the class MixerVoice (<>startPoint) but am a bit stumped as to how too get at it from within an Instrument : rec = Instrument.new(\record, etc . . . . I know I can't say rec.startPoint nor can I say MixerVoice.startPoint. So how do I get at MixerVoice instance variables from within my Instrument ? Hope this makes sense ! Jem ------------------------------ End of sc-users-digest V1 #92 *****************************