From: owner-sc-users-digest@lists.io.com (sc-users-digest) To: sc-users-digest@lists.io.com Subject: sc-users-digest V1 #26 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 Thursday, February 11 1999 Volume 01 : Number 026 ---------------------------------------------------------------------- Date: Tue, 26 Jan 1999 08:37:57 -0600 From: James McCartney <---@---.---> Subject: Re: Object writing Tutorial At 2:34 AM -0600 1/26/99, Iannis Zannos wrote: >are you using the dependency mechanism built into SC? >(in the Object class, used mainly by Views). I have >not tried it out yet as it is not easily visible >from the code how it works (resides mainly in primitives). The Object dependancy mechanism does not rely on primitives. Look in the Object class after the comment line: // dependancy support It is all SC code. Ultimately everything boils down to primitives at some point (like Array access, hash lookup, arithmetic, etc.) but the dependancy mechanism is quite exposed as SC code. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: < ------------------------------ Date: Tue, 26 Jan 1999 21:31:12 +0100 From: Staffan Liljegren <---@---.---> Subject: Re: Enhanced Griot It is the final Griot in examples7. The Griot duet with 2 delays per string. I like this idea and it is a good example of how I envisioned MDLs to behave in the SDL proposal, where it should be easy to use SC structures to model - an Array of n Excitations ,automatically scaled to trigger: - an Array of SDLs (strings, bores...) etc (I don't have any problems with Griot in examples4 either) - -Staffan Iannis Zannos wrote: > Dear Dan and Staffan, > > >btw I cannot get the enhanced Griot to work properly, it just squeaks > >and then stops (running on my G3/333- PowerTech enhanced CPU) > > The Griot example from file examples4 runs without problems here. > Does enhanced Griot mean some other example? I would be interested to test... > > Also: > ------------------------------ Date: Tue, 26 Jan 1999 16:00:10 -0500 From: "crucial" <---@---.---> Subject: Re: UDFile again. (Re: File operations at Interrupt ....) > > >Here is the code for UDFile again, slightly modified >because of the asynchronous return mode of GetFileDialog. Can you explain what the interface difference is now ? Also, have you had any luck saving Dictionaries ? I found it returned only the values with UDFile.save1 and UDFile.save seemed to save characters individually... ? I just saved it as [dictionary.keys,dictionary.values] What would be a quick way to assemble (reconstitute) a dictionary from these two ? I'm just returnedKeys.do({ etc. __________________________________________ :\\_______ http://crucial-systems.com __________________________________________ :\\_______ ------------------------------ Date: Tue, 26 Jan 1999 16:17:10 -0500 From: "crucial" <---@---.---> Subject: Re: Object writing Tutorial >At 2:34 AM -0600 1/26/99, Iannis Zannos wrote: > >>are you using the dependency mechanism built into SC? >>(in the Object class, used mainly by Views). I have >>not tried it out yet as it is not easily visible >>from the code how it works (resides mainly in primitives). Is this used for garbage collection only ? I often have chains of objects that pass audio or gestural information between each other, I am having problems coming up with a good way to keep track of these relationships, save them and replicate them. Not sure if this might be of help. __________________________________________ :\\_______ http://crucial-systems.com __________________________________________ :\\_______ ------------------------------ Date: Tue, 26 Jan 1999 15:44:35 -0600 From: James McCartney <---@---.---> Subject: Re: Object writing Tutorial At 3:17 PM -0600 1/26/99, crucial wrote: >>At 2:34 AM -0600 1/26/99, Iannis Zannos wrote: >>>are you using the dependency mechanism built into SC? >Is this used for garbage collection only ? no. It has nothing to do with GC really. >I often have chains of objects that pass audio or gestural >information between each other, I am having problems coming up with a >good way to keep track of these relationships, save them and replicate >them. Not sure if this might be of help. The dependancy mechanism is used to implement the Observer pattern. See the book _Design Patterns: Elements of Reusable Object-Oriented Software_ by Gamma, Helm, Johnson, Vlissides. Basically it allows you to write objects that when modified notify objects that are interested in those changes. This lets you separate your data manipulations from their GUI representation. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Wed, 27 Jan 1999 11:28:44 +0200 From: Nikolas Valsamakis <---@---.---> Subject: unsubscribe unsubscribe ------------------------------ Date: Thu, 28 Jan 1999 10:05:17 +0100 From: "Iannis Zannos" <---@---.---> Subject: Re: UDFile again. (Re: File operations at Interrupt ....) >Can you explain what the interface difference is now ? The interface difference is that the option of letting UDFile get the path from the user with a file dialog window is now no longer available, neither for loading nor for saving files. This should be done in the code that uses UDFile, not inside UDFile itself, because of the way that such get-path dialog windows work, as James explained in previous posts. >Also, have you had any luck saving Dictionaries ? >I found it returned only the values with UDFile.save1 >and UDFile.save seemed to save characters individually... I will check that. There may be a mistake in the way UDFile checks the type of objects to be saved that causes problems with Dictionaries. Will come back to it later. Iannis Zannos SIM Tiergartenstr. 1, D-10785 Berlin, Germany Fax: +49 30 25481172 - ---------- >From: "crucial" <---@---.---> >To: sc-users@lists.io.com >Subject: Re: UDFile again. (Re: File operations at Interrupt ....) >Date: Tue, 26 Jan 1999 10:00 PM > >> >> >>Here is the code for UDFile again, slightly modified >>because of the asynchronous return mode of GetFileDialog. > >Can you explain what the interface difference is now ? > >Also, have you had any luck saving Dictionaries ? >I found it returned only the values with UDFile.save1 >and UDFile.save seemed to save characters individually... >? > >I just saved it as [dictionary.keys,dictionary.values] > >What would be a quick way to assemble (reconstitute) a dictionary >from these two ? I'm just returnedKeys.do({ etc. > > >__________________________________________ :\\_______ > http://crucial-systems.com > >__________________________________________ :\\_______ > ------------------------------ Date: Fri, 29 Jan 1999 18:35:04 -0500 From: Mark Ballora <---@---.---> Subject: displaying mapped values I think my brain is having a pointer error. I'm trying to set three formants according to a value set by a data slider. The slider values are broken into three ranges, which correspond to three ranges for each formant. I'm mapping the formant values according to the mapping formula for a value x between a and b, and a value y between c and d (d-c) y = ----- * (x-a) + c (b-a) The formant mapping is working fine. But I'd like to see the formant values displayed in sliders/number boxes, and I can't get the display to work. I've looked through the docs, but can't find an answer. Thanks -- Mark ( var w, up, mid, down, upval, midval, downval, data, dataval, f1min, f1max, f2min, f2max, f3min,f3max, hrvmin, hrvmax, f1, f2, f3; w = GUIWindow.new("Formants", Rect.newBy( 174, 95, 323, 143 )); up=SliderView.new( w, Rect.newBy( 78, 8, 160, 16 ), "nil", 730, 100, 10000, 0, 'exponential'); mid=SliderView.new( w, Rect.newBy( 78, 36, 160, 16 ), "nil", 1090, 100, 10000, 0, 'exponential'); down=SliderView.new( w, Rect.newBy( 78, 64, 160, 16 ), "nil", 2440, 100, 10000, 0, 'exponential'); upval=NumericalView.new( w, Rect.newBy( 245, 6, 64, 20 ), "NumericalView", 0, -1e+10, 1e+10, 0, 'linear'); midval=NumericalView.new( w, Rect.newBy( 245, 34, 64, 20 ), "NumericalView", 0, -1e+10, 1e+10, 0, 'linear'); downval=NumericalView.new( w, Rect.newBy( 246, 62, 64, 20 ), "NumericalView", 0, -1e+10, 1e+10, 0, 'linear'); data=SliderView.new( w, Rect.newBy( 26, 9, 17, 103 ), "SliderView", 1, 0.4, 1.6, 0, 'linear'); dataval=NumericalView.new( w, Rect.newBy( 10, 113, 64, 20 ), "NumericalView", 0, -1e+10, 1e+10, 0, 'linear'); Synth.play({ // Values from the vertical slider are divided into three regions, each of which sets different initial values: if (data.kr < 0.8, { f1min=250; f1max=290; f2min=2270; f2max=2330; f3min=2990; f3max=3030; hrvmin=0.4; hrvmax=0.8; }, { if ( data.kr < 1.2, { f1min=470; f1max=510; f2min=1330; f2max=1370; f3min=1670; f3max=1710; }, { f1min=710; f1max=750; f2min=1070; f2max=2010; f3min=2420; f3max=2460; } ) } ); // Map formant values according to the value of the data slider f1=(((f1max - f1min)/(hrvmax - hrvmin))*((data.kr) - hrvmin))+f1min; f2=(((f2max - f2min)/(hrvmax - hrvmin))*((data.kr) - hrvmin))+f2min; f3=(((f3max - f3min)/(hrvmax - hrvmin))*((data.kr) - hrvmin))+f3min; // vertical slider and number box correspond to each other data.action = { dataval.value = data.value }; dataval.action = { data.value = dataval.action }; // TRYING TO DISPLAY THE FORMANT VALUE IN THE NUMBER BOX LIKE THIS CAUSES A CRASH // upval.value=f1; // Doing without any display, the instrument itself works fine f = SinOsc.kr(4, 0, 2, 200); Mix.ar(Formant.ar(f, [f1,f2,f3], f, 0.1)); }); w.close; ) ------------------------------ Date: Sat, 30 Jan 1999 03:58:27 -0500 From: "crucial" <---@---.---> Subject: Sound Headers reading at Interrupt I may misunderstand this, but I thought that whatever happens within the basic Synth.play({ }); was at interrupt level. I can read sound headers within that, for example : ( // no preload, loop Synth.play({ // I have moved the Synth.play back to here var file; file = SoundFile.new; if ( file.readHeader(":Sounds:floating_1"), // read the file's header { // read was successful file.sustainLoopStart = file.numFrames - 10000; file.sustainLoopEnd = file.numFrames; DiskIn.ar(file, true) * 0.4 }, 0.5); }); ) But in some cases I have gotten "cannot read sound headers at interrupt level." So perhaps I don't understand "interrupt level". (and I'm not sure what the meaning of is *is* either (<-sad joke, ignore)) Also, it doesn't seem like too much audio can be loaded into memory at one time. Is this because there isn't much space left, (i have 96 meg assigned to SC) or is it maybe a limitation of the array I store the audio in ? I tried to strip down my extensions a bit to see if I could minimize the crashes, but it crashed constantly !! Also was running Norton Crash Guard (installed by accident actually). I removed that and went back to my old extensions, and things have been smooth since then. When the g3 has been left for a bit and the disk sleeps (i think the processor naps too), operations like quit or recompile classes result in a system hang. __________________________________________ :\\_______ http://crucial-systems.com __________________________________________ :\\_______ ------------------------------ Date: Sat, 30 Jan 1999 08:37:32 -0600 From: James McCartney <---@---.---> Subject: Re: Sound Headers reading at Interrupt At 2:58 AM -0600 1/30/99, crucial wrote: >I may misunderstand this, but I thought that whatever happens within >the basic > >Synth.play({ }); > > >was at interrupt level. Not exactly. The order of operations is as follows: a new Synth is allocated your function is called. if it returns a valid UGen graph then play begins and interrupt level is entered. The things in your function which can be called at interrupt level are Spawn functions, Synth tasks, Sequencer functions, or any other functions that can be called by UGens. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Sat, 30 Jan 1999 09:37:16 -0600 From: James McCartney <---@---.---> Subject: Re: displaying mapped values Things like the following are not logical: if (data.kr << 0.8, data.kr is a unit generator. data.kr << 0.8 is also a unit generator expression, it returns a BinOpUGen. 'if' is not a unit generator, it is method call. Your Synth function's job is to create a UGen graph data structure. You are not writing the code that will execute while synthesis is happening. That 'if' is called only once, when the graph is being built. The correct way to do what you want is to poll the unit generator from a periodic Synth task. I give the solution below - ------------ You can't change the values of the format or any other unit generator by instantiating them with a variable and then changing that variable later. When a unit generator is instantiated it gets the value for that input right then. This is a call-by-value language. Functions do not know what variables gave them their values. If the argument is a floating point value then that is a constant. In order to have a value that changes over time you must use a ControlIn unit generator. You can then set the 'source' instance variable of the ControlIn over time. - ------------ Repeatedly writing data.kr is creating a lot of ControlIn unit generators that do the same thing. It is more efficient to do it once and use that everywhere: dataugen = data.kr; - ------------ I had to add some initialization for hrvmin and hrvmax because they were not being called in all branches of the 'if', leading to math operations on nil. - ------------ I eliminated some redundant math with the statement: ratio = ((dataUGenValue) - hrvmin)/(hrvmax - hrvmin); - --------- ( var w, up, mid, down, upval, midval, downval, data, dataval, f1min, f1max, f2min, f2max, f3min,f3max, hrvmin, hrvmax, f1, f2, f3; w = GUIWindow.new("Formants", Rect.newBy( 174, 95, 323, 143 )); up=SliderView.new( w, Rect.newBy( 78, 8, 160, 16 ), "nil", 730, 100, 10000, 0, 'exponential'); mid=SliderView.new( w, Rect.newBy( 78, 36, 160, 16 ), "nil", 1090, 100, 10000, 0, 'exponential'); down=SliderView.new( w, Rect.newBy( 78, 64, 160, 16 ), "nil", 2440, 100, 10000, 0, 'exponential'); upval=NumericalView.new( w, Rect.newBy( 245, 6, 64, 20 ), "NumericalView", 0, -1e+10, 1e+10, 0, 'linear'); midval=NumericalView.new( w, Rect.newBy( 245, 34, 64, 20 ), "NumericalView", 0, -1e+10, 1e+10, 0, 'linear'); downval=NumericalView.new( w, Rect.newBy( 246, 62, 64, 20 ), "NumericalView", 0, -1e+10, 1e+10, 0, 'linear'); data=SliderView.new( w, Rect.newBy( 26, 9, 17, 103 ), "SliderView", 1, 0.4, 1.6, 0, 'linear'); dataval=NumericalView.new( w, Rect.newBy( 10, 120, 64, 20 ), "NumericalView", 0, -1e+10, 1e+10, 0, 'linear'); // sliders and number boxes correspond to each other data.action = { dataval.value = data.value }; dataval.action = { data.value = dataval.value }; up.action = { upval.value = up.value }; upval.action = { up.value = upval.value }; mid.action = { midval.value = mid.value }; midval.action = { mid.value = midval.value }; down.action = { downval.value = down.value }; downval.action = { down.value = downval.value }; Synth.play({ arg synth; var dataUGen, f1cntl, f2cntl, f3cntl, ratio, func; dataUGen = data.kr; // create ControlIn ugen f1cntl = ControlIn.kr(250); f2cntl = ControlIn.kr(2270); f3cntl = ControlIn.kr(2990); synth.repeat(0, 0.05, { var dataUGenValue; dataUGenValue = dataUGen.poll; // poll the value of the ugen // Values from the vertical slider are divided into three regions, // each of which sets different initial values: if (dataUGenValue << 0.8, { f1min=250; f1max=290; f2min=2270; f2max=2330; f3min=2990; f3max=3030; hrvmin=0.4; hrvmax=0.8; }, { if ( dataUGenValue << 1.2, { f1min=470; f1max=510; f2min=1330; f2max=1370; f3min=1670; f3max=1710; hrvmin=0.4; hrvmax=0.8; }, { f1min=710; f1max=750; f2min=1070; f2max=2010; f3min=2420; f3max=2460; hrvmin=0.4; hrvmax=0.8; } ) } ); // Map formant values according to the value of the data slider ratio = ((dataUGenValue) - hrvmin)/(hrvmax - hrvmin); f1 = ((f1max - f1min) * ratio) + f1min; f2 = ((f2max - f2min) * ratio) + f2min; f3 = ((f3max - f3min) * ratio) + f3min; // update the slider upval.value = f1; midval.value = f2; downval.value = f3; // currently the value method does not call the action function, // so the following is also necessary up.value = f1; mid.value = f2; down.value = f3; // update the control in source variable f1cntl.source = f1; f2cntl.source = f2; f3cntl.source = f3; }); f = SinOsc.kr(4, 0, 2, 200); Mix.ar(Formant.ar(f, [f1cntl, f2cntl, f3cntl], f, 0.1)); }); 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: Sat, 30 Jan 1999 23:01:57 +0100 (CET) From: Arie van Schutterhoef <---@---.---> Subject: SC2/PB1400 SC2 AND POWERBOOK 1400 PROBLEMS -------------------------------- I already posted the following message to James, but maybe other people also suffered the same faith and can tell me more about the solution or be warned when considering to purchase a PB 1400 for running SC 2 on it: Recently I bought a PowerBook 1400 cs/117 Mhz 603e PPC/60 meg RAM with OS 8.1 and faced some difficulties in running SC 2.0d29 on it. Most noticable was it when trying to change subframe size in the Audio Setup: SC crashed immediately, followed by a type 3 error call. Thinking that Sound Manager could be the problem, I changed from version 3.3 to 3.2.1 to even 3.0, but this did not seem to make any difference. Another strange thing I noticed was in the prefs at the start-up: the input and output buffers are not the same size: 512vs4096. Like you can see: SuperCollider 2.0d29, copyright (c) 1998 James McCartney for more info, see http://www.audiosynth.com Worldscript Aware Styled Text Engine copyright (c) 1993-1996 Marco Piovanelli MacZoop framework copyright (c) 1996 Graham Cox Prefs : hardware = apple sampleRate = 44100 clockSource = 0 bufMultiple = 1 useSoundInput = 1 defaultBlockSize = 64 * OMS not present. MIDI functions will be off. input and output buffers not the same size?? 512 4096 compiling class library.. NumPrimitives = 359 pass 1 done Method Table Size 573896 bytes Number of Method Selectors 1032 Number of Classes 638 Number of Symbols 2781 Byte Code Size 29365 compiled 82 files in 146.78 seconds compile done I also tried to run one of the FFT examples, which failed, but returned the comment of: wr 64 52 3840 4096. Here it is: ( // more irresponsible meddling in the frequency domain // ring modulating the spectrum { var fftsize, numffts, fftoffsets, window, cosineTable; var input, freq; var src1, fft1, fft2, ring, ifft, out; numffts = 2; // number of overlapped FFTs fftsize = 512; // length of FFT buffer // make offsets for staggering overlapped FFTs fftoffsets = Array.series(numffts, 0, fftsize/numffts); window = Signal.welchWindow(fftsize); // make a signal analysis/synthesis window cosineTable = Signal.fftCosTable(fftsize); // make cosine table required for FFT src1 = AudioIn.ar(1); fft1 = FFT.ar(fftsize, fftoffsets, cosineTable, window, nil, src1, 0.0); // transform src1 // use SyncSaw so we can sync to the FFT size. freq = Synth.sampleRate/fftsize; ring = SyncSaw.ar(freq, LinExp.kr(SinOsc.kr(0.1),-1,1,freq,10000)).max(0); fft2 = Complex.new( fft1.real * ring, fft1.imag * ring ); // inverse transform ifft = IFFT.ar(fftsize, fftoffsets, cosineTable, nil, window, fft2.real, fft2.imag); out = Mix.ar(ifft.real); // mix overlapped outputs out/numffts }.scope(0.01); wr 64 52 3840 4096 ) The strangest thing of it all is that SuperCollider 1.0 does not have any problem with running on the 1400. So I really do not know what i can do to solve the above mentioned problems. Is there any solution? If so please can any one tell me... Already thanks for the help, Arie van Schutterhoef SCHRECK Ensemble, Holland. <<<<<<<<<<<<<<<<<<<<<<<<<-////||\\\\->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Arie van Schutterhoef artistic director 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 <<<<<<<<<<<<<<<<<<<<<<<<<-////||\\\\->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ------------------------------ Date: Sun, 31 Jan 1999 21:12:13 +1100 From: ggerrard <---@---.---> Subject: New G3 macs and SC Does SC2 beta work on the new G3s? (e.g. 300,350,400). Anyone using a Korg 1212 in a new G3 with SC2 successfully? ------------------------------ Date: Sun, 31 Jan 1999 21:12:13 +1100 From: ggerrard <---@---.---> Subject: New G3 macs and SC Does SC2 beta work on the new G3s? (e.g. 300,350,400). Anyone using a Korg 1212 in a new G3 with SC2 successfully? ------------------------------ Date: Sun, 31 Jan 1999 11:26:30 +0100 From: Staffan Liljegren <---@---.---> Subject: Re: New G3 macs and SC I run on a G3 (NewrTech upgrade 333 Mhz) without problems. In a week or two I can tell You about the G3 400. - -Staffan ggerrard wrote: > Does SC2 beta work on the new G3s? (e.g. 300,350,400). > Anyone using a Korg 1212 in a new G3 with SC2 successfully? ------------------------------ Date: Sun, 31 Jan 1999 08:46:11 -0800 From: Alex Stahl <---@---.---> Subject: Re: New G3 macs and SC The Korg 1212 does not work yet in the new blue-and-white G3's-- I have tried it-- it hangs on loading the Korg extension at startup. I spoke with Dan Philips from Korg and they have purchased one of the new models to solve the problem. So far they have determined the hardware registers on the bus, which I believe menas a driver update can solve the problem. - -Alex Stahl p.s. the MOTU 2408 doesn't work either. >Does SC2 beta work on the new G3s? (e.g. 300,350,400). >Anyone using a Korg 1212 in a new G3 with SC2 successfully? ------------------------------ Date: Sun, 31 Jan 1999 17:35:39 -0500 From: "crucial" <---@---.---> Subject: Re: SC2/PB1400 >Recently I bought a PowerBook 1400 cs/117 Mhz 603e PPC/60 meg RAM with OS 8.1 >and faced some difficulties in running SC 2.0d29 on it. Most noticable was it >when trying to change subframe size in the Audio Setup: SC crashed >immediately, followed by a type 3 error call. Thinking that Sound Manager >could be the problem, I changed from version 3.3 to 3.2.1 to even 3.0, >but this did not seem to make any difference. > >Another strange thing I noticed was in the prefs at the start-up: >the input and output buffers are not the same size: 512vs4096. >Like you can see: My friend and I both has the same 1400cs as you. Initially I had the same buffer difference as you report, I now have a preferences file that reads : ; SuperCollider Preferences hardware = apple sampleRate = 44100 clockSource = 0 bufMultiple = 1 useSoundInput = 0 defaultBlockSize = 64 This does turn off the sound input. :( The buffs problem disappears. But I can play certain things. On all but the simplest examples, I get a pulsing tremolo type effect as the processor strains. I get this same sound on my G3 when I'm making large demands. Now I compile 82 files is 23.50 seconds, my friend (running the demo version of SC) also takes as long as you do : 146 or so. So something is up with that. __________________________________________ :\\_______ http://crucial-systems.com __________________________________________ :\\_______ ------------------------------ Date: Mon, 1 Feb 1999 00:50:13 +0100 (CET) From: Arie van Schutterhoef <---@---.---> Subject: Re: SC2/PB1400 Hi, First of all thanks for your response; it's been nagging for about two weeks since I've bought it! >This does turn off the sound input. :( - -I shall try that! >of SC) also takes as long as you do : 146 or so. >So something is up with that. - -Maybe James can tell us more, and what to do? Arie van Schutterhoef Schreck Ensemble Holland <<<<<<<<<<<<<<<<<<<<<<<<<-////||\\\\->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Arie van Schutterhoef artistic director 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 <<<<<<<<<<<<<<<<<<<<<<<<<-////||\\\\->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ------------------------------ Date: Thu, 04 Feb 1999 14:24:46 +0100 From: "Iannis Zannos" <---@---.---> Subject: Dependency in SC. Re: Object writing Tutorial In reply to: James McCartney >Date: Tue, 26 Jan 1999 3:37 PM > // dependancy support > >It is all SC code. Ultimately everything boils down to primitives >at some point (like Array access, hash lookup, arithmetic, etc.) but the >dependancy mechanism is quite exposed as SC code. You are right of course. I had looked at this code some time ago and it was not present to me when posting that dependency relies on primitives. On the other hand, if you look in SC for places which use this mechanism there are really very few examples, and these actually use primitives almost immediately. I mean: update and refresh methods in View. In fact, the way View defines update is somewhat puzzling because it does not use the arguments that the update method provides in Object, but relies on the value already stored in the View (the refresh in this case is indeed a primitive that hides what happens with the value). I am not suggesting that update "must" be redefined in View. This may be done elsewhere, like in ControlView for example, and also with consideration to your definition of Model. Will come back when ever I can provide more mature suggestions. Iannis Zannos SIM Tiergartenstr. 1, D-10785 Berlin, Germany Fax: +49 30 25481172 - ---------- >In reply to: James McCartney >Date: Tue, 26 Jan 1999 3:37 PM > >At 2:34 AM -0600 1/26/99, Iannis Zannos wrote: > >>are you using the dependency mechanism built into SC? >>(in the Object class, used mainly by Views). I have >>not tried it out yet as it is not easily visible >>from the code how it works (resides mainly in primitives). > >The Object dependancy mechanism does not rely on primitives. >Look in the Object class after the comment line: > > // dependancy support > >It is all SC code. Ultimately everything boils down to primitives >at some point (like Array access, hash lookup, arithmetic, etc.) but the >dependancy mechanism is quite exposed as SC code. > > > --- james mccartney james@audiosynth.com http://www.audiosynth.com >If you have a PowerMac check out SuperCollider2, a real time synth program: > > > > > ------------------------------ Date: Sat, 06 Feb 1999 00:25:32 -0500 From: "crucial" <---@---.---> Subject: Dictionaries So it seems that dictionaries do not support strings as keys, only numbers or symbols. Is there a way to use them or something else in the same way as say Associative variables ? Associations don't seem to match even when I think they might: var x, y; x=Association.new("seq",[1,2,3]); y=Association.new("seq",[5,6,76]); if (x.key == y.key,{"true".postln}); // not true if (x == y ,{"true".postln}); // not true // docs say the keys will be compared __________________________________________ :\\_______ http://crucial-systems.com __________________________________________ :\\_______ ------------------------------ Date: Fri, 5 Feb 1999 23:57:41 -0600 From: James McCartney <---@---.---> Subject: Re: Dictionaries At 11:25 PM -0600 2/5/99, crucial wrote: >So it seems that dictionaries do not support >strings as keys, only numbers or symbols. '==' and 'hash' should have been implemented for Collection and String in order for this to work. An oversight on my part. I'll put in these. BTW: I have the Audiomedia III running under DirectIO now. I will make this available as soon as I can. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Sat, 6 Feb 1999 00:14:02 -0600 From: James McCartney <---@---.---> Subject: Re: Dictionaries At 11:57 PM -0600 2/5/99, James McCartney wrote: >At 11:25 PM -0600 2/5/99, crucial wrote: >>So it seems that dictionaries do not support >>strings as keys, only numbers or symbols. > >'==' and 'hash' should have been implemented for Collection and >String in order for this to work. An oversight on my part. In class Collection the following methods can be added which will make your examples work. == { arg aCollection; if (this.size != aCollection.size, { ^false }); this.do({ arg item, i; if (item != aCollection.at(i), { ^false }); }); ^true } hash { var hash = 87263867; // some hash value for empty collections this.do({ arg item; hash = hash bitXor: item.hash; }); } I will add faster primitives for String, FloatArray, etc.. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: < ------------------------------ Date: Sat, 6 Feb 1999 09:51:49 -0600 From: James McCartney <---@---.---> Subject: Re: Dictionaries >Date: Sat, 6 Feb 1999 09:50:19 -0500 (EST) >From: "Ronald J. Kuivila" <---@---.---> >Subject: Re: Dictionaries > >Hi James, > > I notice methods missing from Array that are in List: > > clipAt > clipPut > top > >Also, what does permute do? >( var x,y; > x = List[1,2,3,,4]; > y = x.permute(1); > y.post; >) >returns an empty list. > >RJK > --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Sat, 06 Feb 1999 13:07:36 -0500 From: "crucial" <---@---.---> Subject: Re: Dictionaries >>'==' and 'hash' should have been implemented for Collection and >>String in order for this to work. An oversight on my part. > >In class Collection the following methods can be added >which will make your examples work. ah! so this will allow string comparison now too. This is good, it seemed odd that we couldn't. Of course now I've rewritten the whole section to use numbers :) thanks for the update. __________________________________________ :\\_______ http://crucial-systems.com __________________________________________ :\\_______ ------------------------------ Date: Sat, 6 Feb 1999 18:53:24 +0000 From: finer@easynet.co.uk Subject: Patterns I got a bit stuck on streams and patterns : I'm trying to do a simple thing in the context of ImpulseSequencer.ar What I want to do is give it a score in the form of a stream so that it'll repeat a pattern 3 times and then on the fourth time round choose another pattern from a number of possibilities. So I've got a pattern like this : pattern = Pseq.new([ Pseq.new( #[ 1, 0, 0, 0 ], 3), Prand.new([Pseq.new( #[ 0,1,1,1 ], 1), Pseq.new(#[ 0,1,0,1 ], 1) ],1) ]) Despite looking at the pattern example and the library I'm a bit stuck as to how to turn this into an input in ImpulseSequencer.ar. The other thing is looking at the example I see - Pname.new('note' Looking for this in the library I could find only a list of things, ~freq, ~dur etc under the *newTop method in Environment.sc, which i thought might relate to "note'. I was wondering where 'note' came in/from and whether the recognition of 'note' opened the door (as it were) to .dur, .legato etc. Any tutorials on streams etc most welcome ! Thanks, Jem Jem Finer finer@easynet.co.uk Longplayer : http://easyweb.easynet.co.uk/artangel/finer.html Autodestruct/Marseille en Juin : http://www.chez.com/immedias ------------------------------ Date: Tue, 09 Feb 1999 19:23:34 -0500 From: "crucial" <---@---.---> Subject: Using TSpawn as a mixer I keep running into a problem in architecture. I want to mix a number of sounds together and pass them into a single delay line/effects chain/wormhole/etc. But a Mix.ar takes its inputs on init and I can't add or remove any of these items after that. So I figured that Spawn and TSpawn essentially work as mixers, and take care of the problems of lifecycle of the individual sounds. If the individual sound ceases, it just ceases. But... {arg synth; var out; out=TSpawn.ar( { arg tsp,evCount,synth, addMe; "trigged".postln; addMe },2,nil,1); // 2 channels, forever, immediately triggered synth.sched(1, {"trig".postln; out.source.trigger(FSinOsc.ar(800.rand,0.3)); //passes the osc as arg }); out }.play /////////////////// This begins to play, silently. But when the synth.sched happens, nothing gets added in as I expect. James, anyone,any suggestions ? Additionally, I think that if I package the sound in an EnvGen I can release it (kill it off) by accessing synth.releaseAll __________________________________________ :\\_______ http://crucial-systems.com __________________________________________ :\\_______ ------------------------------ Date: Tue, 9 Feb 1999 19:30:44 -0600 From: James McCartney <---@---.---> Subject: Re: Using TSpawn as a mixer At 6:23 PM -0600 2/9/99, crucial wrote: >I keep running into a problem in architecture. I want to mix >a number of sounds together and pass them into a single delay >line/effects chain/wormhole/etc. But a Mix.ar takes its inputs >on init and I can't add or remove any of these items after that. > >So I figured that Spawn and TSpawn essentially work as mixers, >and take care of the problems of lifecycle of the individual >sounds. If the individual sound ceases, it just ceases. > >But... The ugen graph must be created inside the tspawn event function so that it is created in the context of a Synth. The sched function is not called inside of a Synth, so the oscillator has no parent. Change your code to the following: { arg synth; var out; out=TSpawn.ar( { arg tsp,evCount,synth, addMe; "trigged".postln; addMe.value; // evaluate the function which creates the ugen graph },2,nil,1); // 2 channels, forever, immediately triggered synth.sched(1, {"trig".postln; out.source.trigger({ FSinOsc.ar(800.rand,0.3) }); //passes a func as arg }); out }.play --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: < ------------------------------ Date: Tue, 9 Feb 1999 19:50:12 -0600 From: James McCartney <---@---.---> Subject: Re: SC2/PB1400 At 4:35 PM -0600 1/31/99, crucial wrote: >Now I compile 82 files is 23.50 seconds, my friend (running the demo version >of SC) also takes as long as you do : 146 or so. >So something is up with that. Just for comparison on a G3/300 : compiled 83 files in 2.92 seconds --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: < ------------------------------ Date: Wed, 10 Feb 1999 10:19:23 +0000 From: finer@easynet.co.uk Subject: patterns repost I got a bit stuck on streams and patterns : I'm trying to do a simple thing in the context of ImpulseSequencer.ar What I want to do is give it a score in the form of a stream so that it'll repeat a pattern 3 times and then on the fourth time round choose another pattern from a number of possibilities. So I've got a pattern like this : pattern = Pseq.new([ Pseq.new( #[ 1, 0, 0, 0 ], 3), Prand.new([Pseq.new( #[ 0,1,1,1 ], 1), Pseq.new(#[ 0,1,0,1 ], 1) ],1) ]) Despite looking at the pattern example and the library I'm a bit stuck as to how to turn this into an input in ImpulseSequencer.ar. The other thing is looking at the example I see - Pname.new('note' Looking for this in the library I could find only a list of things, ~freq, ~dur etc under the *newTop method in Environment.sc, which i thought might relate to "note'. I was wondering where 'note' came in/from and whether the recognition of 'note' opened the door (as it were) to .dur, .legato etc. Any tutorials on streams etc most welcome ! Thanks, Jem Jem Finer finer@easynet.co.uk Longplayer : http://easyweb.easynet.co.uk/artangel/finer.html Autodestruct/Marseille en Juin : http://www.chez.com/immedias ------------------------------ Date: Thu, 11 Feb 1999 14:15:25 -0500 From: "crucial" <---@---.---> Subject: Re: SC2/PB1400 >At 4:35 PM -0600 1/31/99, crucial wrote: > >>Now I compile 82 files is 23.50 seconds, my friend (running the demo version >>of SC) also takes as long as you do : 146 or so. >>So something is up with that. > >Just for comparison on a G3/300 : > > compiled 83 files in 2.92 seconds > > > > --- james mccartney Sorry, just to reclarify the above quoted figures : my pb 1400cs117mHz compiles in 23.50 my friend's identical pb 1400cs117mHz compiles in 146 seconds ! as does Arie van Schutterhoef's pb1400 And furthermore of the three, only mine actually plays anything at all, (but not much before its little brain is done in with all that thinking). (my g3/300 is 1-2 seconds depending on how much junk I feed it.) __________________________________________ :\\_______ http://crucial-systems.com __________________________________________ :\\_______ ------------------------------ End of sc-users-digest V1 #26 *****************************