From: owner-sc-users-digest@lists.io.com (sc-users-digest) To: sc-users-digest@lists.io.com Subject: sc-users-digest V1 #75 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 Friday, November 26 1999 Volume 01 : Number 075 ---------------------------------------------------------------------- Date: Tue, 23 Nov 1999 11:28:15 -0500 (EST) From: Landon Rose <---@---.---> Subject: Re: writing new text file while patch is running James- I am trying to save and change a text file while a patch is running. I came up with this which will save the file once, but I can't enter new text while the patch is running and then resave the file. (am I repeating myself??) anyway, any thoughts? ( // using GUI items to turn on and off a process var e, w, box1, box2, ping, ping1; w = GUIWindow.new("panel", Rect.new( 128, 64, 288, 164 )); box1 = CheckBoxView.new( w, Rect.new( 18, 15, 146, 35 ), "Low and Slow", 0, 0, 1, 0, 'linear'); box2 = CheckBoxView.new( w, Rect.new( 18, 39, 146, 59 ), "High and Fast", 0, 0, 1, 0, 'linear'); // define instrument function ping = { arg freq = 400, dur = 1, amp = 0.2; EnvGen.ar(e, SinOsc.ar(freq), 0, amp, 0, dur); }; // define text writer ping1 = ( k = File(": larrysend4", "w"); k.write(" how do I write new text here while the patch is running?"); k.close; ); // define the envelope e = Env.triangle(1,1); Synth.play({ if (box2.value > 0, { ping1; }); Spawn.ar({ if (box1.value > 0, { // if check box is checked ping.value; // return result of instrument function }); // else returns nil }, 1, 1) }); w.close; ) Also, is there a way to insert the text using a GUI window? At first glance I couldn't see how to use StringView. another view? Thanks Landon ------------------------------ Date: Tue, 23 Nov 1999 11:04:54 -0700 From: James McCartney <---@---.---> Subject: Re: writing new text file while patch is running At 9:28 AM -0700 11/23/99, Landon Rose wrote: >James- > I am trying to save and change a text file while a patch is running. >I came up with this which will save the file once, but I can't enter new >text while the patch is running and then resave the file. (am I repeating >myself??) I am not sure I understand what you are asking. ( f = File.new("write-test","w"); Synth.play({ Spawn.ar({ f.write("aeiou\n".at(6.rand)); PSinGrain.ar( 1000.0 + 1000.0.rand, 0.2, 0.015 )}, 1, // one channel 0.008 // call event function every eight milliseconds ) }); f.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:55:52 -0500 (EST) From: Matthew Rogalsky <---@---.---> Subject: OMS error when SC in background Hi I have SC running alongside ABControl, the controlling software for the Audiobox, a nifty 16x16 matrix mixer. I'm sending ABControl MIDI from SC to do spacial diffusion (it's a shame I have to run OMS on one port and Apple MIDI Manager on the other to do this, but it works!). ABControl would ideally be the foreground application -- otherwise its spatial movements can become jerky. However when I put SC in the background I immediately get an error: OMSWriteDataAsync Failed:5 Is this something easy to fix? thanks MR ------------------------------ Date: Tue, 23 Nov 1999 13:22:07 -0500 (EST) From: Landon Rose <---@---.---> Subject: Re: writing new text file while patch is running James- I would like to have f.write accessable via a GUI interface such that, like turning on and off a process, I could write a comment in a window and , with a buttom click in a GUIWindow, save it as a text file. Then, at some undetermined time in the future, type in something else, and have it saved under the same file name. This file will then accessed by another program running in the background. Also, the text will be input not by me but audience members, so it would be beneficial if the text entry is direct and simple, such as "write in text, then click on button". The reason to do this text entry in SC is because on my PB2400 when I switch between applications SC ( or OMS really) stops sending MIDI. Thanks. Hope this explains the reason for my patch using "turning processes on and off" Landon >At 9:28 AM -0700 11/23/99, Landon Rose wrote: >>James- >> I am trying to save and change a text file while a patch is running. >>I came up with this which will save the file once, but I can't enter new >>text while the patch is running and then resave the file. (am I repeating >>myself??) > >I am not sure I understand what you are asking. > >( >f = File.new("write-test","w"); >Synth.play({ > Spawn.ar({ > f.write("aeiou\n".at(6.rand)); > PSinGrain.ar( > 1000.0 + 1000.0.rand, > 0.2, > 0.015 > )}, > 1, // one channel > 0.008 // call event function every eight milliseconds > ) >}); >f.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 19:51:57 +0000 From: Martin Robinson <---@---.---> Subject: Harmonic Maths From what I remember of Harmonic Maths, when Lawrence gave a guest demo at Middlesex a couple of years ago, this goes some way (I think).... ( Synth.scope({ var a, n = 10; a = LFTri.ar(100, Line.kr(0, n, 20)); n.do({ a = a.clip2(1) - a.excess(1)}); a }) ) .... but requires 'n' to be impossibly large to complete a full cycle and results in (n+1)*3 UGens. However, with these modifications you can see 'the good bits' as Lawrence calls them (I hope I'm not misquoting you Lawrence!!), marred by the error as this input amplitude exceeds 'n'. ( Synth.scope({ var a, n = 30; a = LFTri.ar(100, MouseX.kr(0, n)); n.do({ a = a.clip2(0.1) - a.excess(0.1)}); a }) ) James, Would a fold (or fold2) BinaryOp be a possibility for this stuff? (BTW: PanB and decoder works great now, thanks) Martin >>>>>>Martin Robinson :: (Ex)tractor :: && ________ >>><<<_sonicArts.at(middlesexUniversity.london.uk); ______ <><><>__this.liveElectronics.interFaces.diffusion ____ || - ---------- ------------------------------ Date: Tue, 23 Nov 1999 14:07:58 -0700 From: James McCartney <---@---.---> Subject: Re: Harmonic Maths At 12:51 PM -0700 11/23/99, Martin Robinson wrote: >James, Would a fold (or fold2) BinaryOp be a possibility for this stuff? Yes, in fact it is in the next version. --- 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 15:23:17 -0700 From: James McCartney <---@---.---> Subject: version 2.2.4 available === Version 2.2.4 is now available via ftp: BinHex : ftp://www.audiosynth.com/pub/updates/SC2.2.4.sea.hqx MacBinary (smaller) : ftp://www.audiosynth.com/pub/updates/SC2.2.4.sea.bin SCPlay is distributed in a separate file : BinHex : ftp://www.audiosynth.com/pub/updates/SCPlay2.2.4.sea.hqx MacBinary (smaller) : ftp://www.audiosynth.com/pub/updates/SCPlay2.2.4.sea.bin === Changes in Version 2.2.4 Uses newer version of copy protection that is G4 and OS9 compatible. Added fold2 and wrap2 binary operators. Plugs on a RangeView can now access several values: low, high, center, range. See Plug.help Integer::nthPrime now knows all the primes less than 65536. Valid indices for nthPrime range from zero to 6541. Integer::nextPrime gives the prime greater than or equal to the Integer for all primes less than 65536. Integer::prevPrime gives the prime less than or equal to the Integer for all primes less than 65536. Integer::isPrime now works for all positive Integers. Added TrigXFade class. Fixed bugs in PanAz. Fixed bugs in Task. === --- 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 16:37:03 -0500 (EST) From: Landon Rose <---@---.---> Subject: Re: OMS error when SC in background MR and all- >OMSWriteDataAsync Failed:5 same message I'm getting switching between apps. I notice that when I switch between programs the power to my MIDI out device (a MINI MACMAN) turns off. weird to have two questions related to MIDIOut post during same afternoon. Anybody else out there getting >OMSWriteDataAsync Failed:5 today? Landon ------------------------------ Date: Tue, 23 Nov 1999 18:27:40 -0700 From: James McCartney <---@---.---> Subject: Re: version 2.2.4 available At 5:20 PM -0700 11/23/99, owner-sc-users@lists.io.com wrote: >From: Stephen Travis Pope <---@---.---> >> Changes in Version 2.2.4 >> >> Uses newer version of copy protection that is G4 and OS9 compatible. >Do we still need the USB floppy extension? no. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: --- 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 19:51:09 -0500 From: Mic Berends <---@---.---> Subject: Re: please help. James McCartney wrote: > 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. the point of this is that i want to iteratively add an arbitrary wave to an arbitrary wave (with fold/wrap); how would i do this using SinOsc? c'mon James. i'm beginning to have the feeling that you are laughing your ass off, thinking "this monkey can't even add two waves together and loop it!". be Kind to Animals! you routinely rewrite dozens of lines of code for people, this should be only a few... i AM trying to learn your blasted language! old low-level habits die hard, though. you don't have subroutine loops which continually generate output, instead you have all these independent objects (functions / ugens) passing data to each other and doing their business with it. is there a site that will help me grok this paradigm more fully than is described in the included tutorials - i should be looking for Smalltalk material, right? i don't have any money for books at the moment. Your OOPness, 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 18:59:24 -0700 From: James McCartney <---@---.---> Subject: Re: please help. At 5:51 PM -0700 11/23/99, Mic Berends wrote: >the point of this is that i want to iteratively add an arbitrary wave to >an arbitrary wave (with fold/wrap); how would i do this using SinOsc? > >c'mon James. i'm beginning to have the feeling that you are laughing >your ass off, thinking "this monkey can't even add two waves together >and loop it!". be Kind to Animals! you routinely rewrite dozens of >lines of code for people, this should be only a few... I'm not going to write everyone's program for them. I don't write yours because I'm not sure what it is you are trying to do. Have a look at what Martin Robinson posted. That is the way to proceed. Not by using wavetables. Now that there is a fold2 binary operator it should be easy. Look at the help file for fold2. --- 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 18:01:25 -0800 From: Mark Polishook <---@---.---> Subject: envelope in tspawn James, I'd like to control TSpawn such that it would be possible to use a GUI to enter the sustain part of the envelope. Is there an 'easy' way to accomplish this?...or something similar? ( w = GUIWindow.new("on/off", Rect.newBy(128, 64, 218, 90)); CheckBoxView.new( w, Rect.newBy(20, 21, 128, 20), "CheckBoxView", 0, 0, 1, 0, 'linear'); e = Env.asr(1, 1, 4); // the release segment doesn't get triggered.... { Tspawn({ SinOsc.ar(220, 0, 0.1) * EnvGen.kr(e) }, trig: w.at(0) }.play ) Thanks, Mark ------------------------------ Date: Tue, 23 Nov 1999 20:03:32 -0700 From: James McCartney <---@---.---> Subject: Re: Harmonic Maths At 12:51 PM -0700 11/23/99, Martin Robinson wrote: >>From what I remember of Harmonic Maths, when Lawrence gave a guest demo at >Middlesex a couple of years ago, this goes some way (I think).... > >( >Synth.scope({ > var a, n = 10; > a = LFTri.ar(100, Line.kr(0, n, 20)); > > n.do({ a = a.clip2(1) - a.excess(1)}); > a > >}) >) > >.... but requires 'n' to be impossibly large to complete a full cycle and >results in (n+1)*3 UGens. With fold2 the above can be done very simply: ( Synth.scope({ var n = 10; LFTri.ar(100, Line.kr(0, n, 20)).fold2(1); }) ) and : ( Synth.scope({ var n = 30; LFTri.ar(100, MouseX.kr(0, n)).fold2(1); }) ) --- 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 22:39:30 -0500 From: Mic Berends <---@---.---> Subject: Re: Harmonic Maths hi Martin! thanks very much for the assist. your example looks very much like a manifestation of the Harmonic Math but if i have Lawrence's methodology down, it goes something like this: 1. i want to add, not mul, the modifier wave to the source wave @ (theta? what is the value of x at a specific phase of a periodic function called?) e.g i have a (-1,1) sine wave. i add a (0,2) ramp of the same period to it, the left end gets 0 added to it, the right end gets 2 added to it, and all the values in-between get an amount added to them equal to the value of the ramp at the same phase. the ramp has to be (0,2) to accommodate the abs (2) number space of (-1,1) signed arithmetic. iterate this over the waveform achieved each period with folding or wrapping at +1 of the values achieved (there won't be any negative space folding or wrapping obviously). i don't see how to do this with continuous functions ugens. we do not want to add or mult the whole source wave by a single value, it's a (possibly) non-linear distortion. wavetables have a static storage facility which is why i was going at it that way... > .... but requires 'n' to be impossibly large to complete a full cycle and > results in (n+1)*3 UGens. right, when i increase n to a useful number my CPU gets pegged quickly, which is also why i wanted to use wavetables, as well as their flexibility in other explorations of this theory. these include the "moire" phenomena of integer ratio harmonic structures (not limited or approximated by the mathematical precision of whatever lib we're using since i expect with many many iterations rounding error would rear its ugly head) and variable quantisation extrapolations of that area. also n dim matrix ops and convolution seem to be a fruitful area for experimentation in combination with all this. thanks again. my apologies for the laboured + convoluted explanation; i'm a visual artist and not much of a mathematician. Cheers, Mic. Martin Robinson wrote: > > >From what I remember of Harmonic Maths, when Lawrence gave a guest demo at > Middlesex a couple of years ago, this goes some way (I think).... > > ( > Synth.scope({ > var a, n = 10; > a = LFTri.ar(100, Line.kr(0, n, 20)); > > n.do({ a = a.clip2(1) - a.excess(1)}); > a > > }) > ) > > .... but requires 'n' to be impossibly large to complete a full cycle and > results in (n+1)*3 UGens. > > However, with these modifications you can see 'the good bits' as Lawrence > calls them (I hope I'm not misquoting you Lawrence!!), marred by the error > as this input amplitude exceeds 'n'. > > ( > Synth.scope({ > var a, n = 30; > a = LFTri.ar(100, MouseX.kr(0, n)); > > n.do({ a = a.clip2(0.1) - a.excess(0.1)}); > a > > }) > ) > > James, Would a fold (or fold2) BinaryOp be a possibility for this stuff? > (BTW: PanB and decoder works great now, thanks) > > Martin - -- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>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 21:48:29 -0700 From: James McCartney <---@---.---> Subject: Re: envelope in tspawn At 7:01 PM -0700 11/23/99, Mark Polishook wrote: >James, > >I'd like to control TSpawn such that it would be possible to use a GUI to >enter the sustain part of the envelope. Is there an 'easy' way to accomplish >this?...or something similar? You could rebuild the envelope for each event in your event function. >// the release segment doesn't get triggered.... You have to release an envelope with synth.release. Each time the check box is unchecked, you could use the action function to release the most recently created synth, which you'd have to store in a variable. TrigXFade does nearly the same thing, so you could have a look at that. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Wed, 24 Nov 1999 09:31:38 +0100 From: rkuivila@mail.wesleyan.edu (Ron Kuivila) Subject: control of sched'ed things... Hi James, Is there any way to kill a Task, Routine, or scheduled function call? It would be nice to have such, perhaps a butch version of releaseAll that wipes out whatever is in its queues. The context is starting and stopping pieces from a GUI that involve sched. I would like to have unchecking a box just turn off the piece, but the process part won't stop. RJK ------------------------------ Date: Wed, 24 Nov 1999 10:48:41 +0000 From: Martin Robinson <---@---.---> Subject: Re: Harmonic Maths Hmmmm... When the amplitude of the wave (assuming we're folding at +-1) is 441 seems to stablise but there should be a point where the output is all zeros... ( Synth.scope({ LFTri.ar(100, 44115).fold2(1); }) ) .. we get a low frequency (error?). And we can watch it either side of this (almost) 'stable' point.... ( Synth.scope({ LFTri.ar(100, 441 + MouseX.kr(-1, 1)).fold2(1); }) ) ...it looks like this amplitude is sr/freq, but 441 works at all frequencies... ( Synth.scope({ LFTri.ar([100, 1000, 10000], 441).fold2(1); }) ) ... unless freq is a UGen... ( Synth.scope({ LFTri.ar(MouseX.kr(20, 20000, 'exponential'), 441).fold2(1); }) ) ...I wish I'd never started this! :) There are also modulation effects close to the stable point even with constants as inputs.. ( Synth.scope({ LFTri.ar(1000, 440).fold2(1); }) ) I assume this is due to some rounding errors. Martin. >>>>>>Martin Robinson :: (Ex)tractor :: && ________ >>><<<_sonicArts.at(middlesexUniversity.london.uk); ______ <><><>__this.liveElectronics.interFaces.diffusion ____ || ------------------------------ Date: Wed, 24 Nov 1999 11:26:16 +0000 From: finer@easynet.co.uk Subject: calculating the size a list needs in RAM If I want to work out how much RAM a list will occupy what is the exact "formula". - - for a #[ type list of lists full of numbers. The numbers are not defined as integers but could be if this will reduce the size. Thanks, Jem ------------------------------ Date: Wed, 24 Nov 1999 10:12:45 -0700 From: James McCartney <---@---.---> Subject: Re: calculating the size a list needs in RAM At 4:26 AM -0700 11/24/99, finer@easynet.co.uk wrote: >If I want to work out how much RAM a list will occupy what is the exact >"formula". > >- for a #[ type list of lists full of numbers. > >The numbers are not defined as integers but could be if this will reduce >the size. each slot takes 8 bytes. An object header is 32 bytes. A slot can hold an Integer, Float, Char or Symbol all in place, or a pointer to an object. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Wed, 24 Nov 1999 10:24:05 -0700 From: James McCartney <---@---.---> Subject: Re: Harmonic Maths >There are also modulation effects close to the stable point even with >constants as inputs.. These are all aliasing effects. Fold adds many harmonics which fold over the nyquist frequency, i.e. alias. Aliasing basically a moire pattern effect and that is what you are seeing here. 100 Hz with an amplitude of 441 and then folding causes a fold over the nyquist. A triangle wave's peaks are all uneven at any frequency that is not an integer number of samples wavelength. By folding you are amplifying that effect. At some places that will be a low frequency beating effect. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Wed, 24 Nov 1999 10:25:01 -0700 From: James McCartney <---@---.---> Subject: Re: control of sched'ed things... At 1:31 AM -0700 11/24/99, Ron Kuivila wrote: >It would be nice to have such, perhaps a butch version of releaseAll that >wipes out whatever is in its queues. OK I'll add that. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Wed, 24 Nov 1999 16:10:12 +0000 From: Martin Robinson <---@---.---> Subject: Read any file as audio When PlayBuf is supplied a Signal derived from a non-audio file, how is the data interpreted? I'm assuming values are read as floats. But this... ( // normal playback at same speed of recording var filename, sound, signal; filename = GetFileDialog.new.path; sound = SoundFile.new; if (sound.read(filename), { signal = sound.data.at(0); Synth.scope({ PlayBuf.ar(signal, 44100, MouseX.kr(0.01, 100, 'exponential'), 0, 0, signal.size-2, MouseY.kr(signal.peak.reciprocal, 1, 'exponential') ).fold2(1) }); },{ (filename ++ " not found.\n").post }); ) ...sounds different from... ( // ReadAnyFileAndPlaySomeDigitalNoise.ar Synth.scope({ var file, signal, i=0; file = GetFileDialog.new.path; file = File.new(file, "rb"); file = file.readAllFloat; signal = Signal.newClear(file.size); i = i-1; signal.waveFill({ i = i + 1; file.at(i); }, 0, file.size-1); PlayBuf.ar(signal, 44100, MouseX.kr(0.01, 100, 'exponential'), 0, 0, signal.size-2, MouseY.kr(signal.peak.reciprocal, 1, 'exponential') ).fold2(1) }) ) Even if I mess with sampleFormat_ and numChannels_. Is there a better (faster) way to read a raw data file into a signal? And since Signal inherits from FloatArray is it possible to have an asSignal method for FloatArray? Also, the output of this blows any filter (or chain of Allpasses) I put it through. Am I just being plain naughty? >>>>>>Martin Robinson :: (Ex)tractor :: && ________ >>><<<_sonicArts.at(middlesexUniversity.london.uk); ______ <><><>__this.liveElectronics.interFaces.diffusion ____ || ------------------------------ Date: Wed, 24 Nov 1999 10:47:12 -0700 From: James McCartney <---@---.---> Subject: Re: Harmonic Maths Another thing to realize is that the triangle wave is calculated with a 32 bit float which has about 7 digits of accuracy. Each time you fold over you lose log10(2) accuracy or about 0.3 digits. If you fold by a factor of 441 then you've lost 220.5*log10(2) digits of accuracy. That is 66 digits! that is more than you started out with and more than any floating point format has. At that point you are just looking at rounding errors. This is not something that can be fixed without using 221 bit numbers, integer, float or whatever. If you had assumed it would work then you are assuming infinite precision arithmetic, which is not the case. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Wed, 24 Nov 1999 10:50:55 -0700 From: James McCartney <---@---.---> Subject: Re: Read any file as audio Why do you do: > file = file.readAllFloat; > > signal = Signal.newClear(file.size); > i = i-1; > > signal.waveFill({ > i = i + 1; > file.at(i); > > }, 0, file.size-1); instead of just signal = file.readAllSignal; ?? --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Wed, 24 Nov 1999 10:57:24 -0700 From: James McCartney <---@---.---> Subject: Re: Read any file as audio At 9:10 AM -0700 11/24/99, Martin Robinson wrote: >But this... >sound = SoundFile.new; >if (sound.read(filename), { > signal = sound.data.at(0); >...sounds different from... > file = file.readAllFloat; Sound files are not stored as raw floating point usually. So reading the same file both ways can't work. For the second method to work, your file must actually be stored as raw floating point. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Wed, 24 Nov 1999 18:11:41 +0000 From: Martin Robinson <---@---.---> Subject: Re: Read any file as audio > > Why do you do: > >> file = file.readAllFloat; >> >> signal = Signal.newClear(file.size); >> i = i-1; >> >> signal.waveFill({ >> i = i + 1; >> file.at(i); >> >> }, 0, file.size-1); > > instead of just > > signal = file.readAllSignal; > > > ?? Thanks, I'll remember to check deeper than the help files in future ;) >...sounds different from... ....etc just curious, but thanks. >>>>>>Martin Robinson :: (Ex)tractor :: && ________ >>><<<_sonicArts.at(middlesexUniversity.london.uk); ______ <><><>__this.liveElectronics.interFaces.diffusion ____ || ------------------------------ Date: Wed, 24 Nov 1999 12:12:37 -0800 From: Mark Polishook <---@---.---> Subject: more tspawn asr James, The following works once - I can't repeatedly turn the Tspawn on and off (only on and off once). What have I missed? Thanks (again), Mark ( var w, cb, envelope, x; w = GUIWindow.new("panel", Rect.newBy(128, 64, 206, 130)); cb = CheckBoxView.new( w, Rect.newBy(24, 36, 128, 20), "CheckBoxView", 0, 0, 1, 0, 'linear'); envelope = Env.asr(1, 1, 2); Synth.play({ TSpawn.ar({ arg spawn, i, synth; cb.action = { synth.release }; SinOsc.ar(200, 0, 0.8) * EnvGen.kr(envelope) }, trig: cb.kr) }); w.close ) ------------------------------ Date: Wed, 24 Nov 1999 22:36:02 +0000 From: "Lawrence Ball" <---@---.---> Subject: How to convert precision patterns into floating sound? Hi Martin,Mic,James and all Harmonic Mathematics has to be performed in an engine which deals in integers or integer-equivalents. Several enthusiastic programmers have suggested to me that it's "quicker" in floating-point but the absolute precision which HM leans on absolutely critically rules out FP. One of them even refrained from contacting me again in disgust (I think). Its ironic that SCOL seems to be floats for signals. Never mind, the harmonic engine must be in integers and it will need to send its values to the signal output which THEN converts to floats. This will preserve the PERFECT precision reqired. I'm not entirely clear which way sounds in 16bit are dealt with by the DAC. I'm assuming that SCOL's floats are converted to 16bit integer first. James do you have a suggestion about possible routes to setting up such an interface of an integer-harmonic-engine to the floats output? If you have time I'm sure Mic and Martin would also be grateful. - ---------- >From: Martin Robinson <---@---.---> >To: sc-users@lists.io.com >Subject: Read any file as audio >Date: Wed, Nov 24, 1999, 4:10 pm > >When PlayBuf is supplied a Signal derived from a non-audio file, how is the >data interpreted? I'm assuming values are read as floats. > >But this... > > >( >// normal playback at same speed of recording >var filename, sound, signal; >filename = GetFileDialog.new.path; >sound = SoundFile.new; >if (sound.read(filename), { > signal = sound.data.at(0); > > Synth.scope({ > PlayBuf.ar(signal, > 44100, > MouseX.kr(0.01, 100, 'exponential'), > 0, 0, signal.size-2, > MouseY.kr(signal.peak.reciprocal, 1, 'exponential') > > ).fold2(1) > }); >},{ (filename ++ " not found.\n").post }); >) > >...sounds different from... > >( // ReadAnyFileAndPlaySomeDigitalNoise.ar > >Synth.scope({ > > > var file, signal, i=0; > > file = GetFileDialog.new.path; > file = File.new(file, "rb"); > file = file.readAllFloat; > > signal = Signal.newClear(file.size); > i = i-1; > > signal.waveFill({ > i = i + 1; > file.at(i); > > }, 0, file.size-1); > > PlayBuf.ar(signal, > 44100, > MouseX.kr(0.01, 100, 'exponential'), > 0, 0, signal.size-2, > MouseY.kr(signal.peak.reciprocal, 1, 'exponential') > ).fold2(1) > > > >}) >) > >Even if I mess with sampleFormat_ and numChannels_. > >Is there a better (faster) way to read a raw data file into a signal? >And since Signal inherits from FloatArray is it possible to have an asSignal >method for FloatArray? > >Also, the output of this blows any filter (or chain of Allpasses) I put it >through. > >Am I just being plain naughty? > >>>>>>>Martin Robinson :: (Ex)tractor :: && ________ >>>><<<_sonicArts.at(middlesexUniversity.london.uk); ______ ><><><>__this.liveElectronics.interFaces.diffusion ____ > > || ------------------------------ Date: Thu, 25 Nov 1999 00:45:04 +0100 From: Julian Rohrhuber <---@---.---> Subject: End of the line it seems that a Spawn that has stopped returns nil. Is that the reason? What does the debug info mean? ( var f, g; f = { arg trig, dur; var dec; dec = Line.kr(1, 0, dur); TSpawn.ar({ Line.ar(dec.poll, 0, [0.3, 0.2]); }, 2, 13, trig, 20, 200); // replace 13 with nil and it works... }; { g = f.value(Dust.kr(15), 15); //g = Plug.kr(g); SinOsc.ar(g, 0, 0.4); }.play; ) Instance of TSpawn ''{ (01C9F6F8, gc=02, fmt=00, flg=00, set=06) instance variables [17] synth : instance of Synth (01C980B0, size=0, set=06) inputs : instance of Array (01C8A030, size=3, set=02) rate : Symbol 'audio' state : Integer 2 channels : instance of Array (01C95A38, size=2, set=01) newEventFunction : instance of Function (01CA15A8, size=0, set=01) nextTime : nil nextTimeValue : nil defaultNextTime : nil maxRepeats : Integer 13 numRepeats : Integer 13 runningSynths : instance of Array (01C965D8, size=2, set=04) recentSynth : instance of Synth (01C9E2D0, size=0, set=06) maxVoices : nil stop : false envir : instance of Environment (01C84910, size=0, set=01) bufsync : false } ------------------------------ Date: Thu, 25 Nov 1999 18:54:38 +0000 From: finer@easynet.co.uk Subject: Files and SCPlay Just checking one last time : is there no way to read a file on hard disk, from SCPlay while a patch is running ? (ie have to store data as a list which will have to live in RAM) Sorry - just have to be sure before committing to vast RAM expansion. Jem ------------------------------ Date: Thu, 25 Nov 1999 22:47:02 -0700 From: James McCartney <---@---.---> Subject: Re: Files and SCPlay At 11:54 AM -0700 11/25/99, finer@easynet.co.uk wrote: >Just checking one last time : is there no way to read a file on hard disk, >from SCPlay while a patch is running ? > >(ie have to store data as a list which will have to live in RAM) > >Sorry - just have to be sure before committing to vast RAM expansion. > >Jem Look at Task.help --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Thu, 25 Nov 1999 22:48:34 -0700 From: James McCartney <---@---.---> Subject: Re: more tspawn asr At 1:12 PM -0700 11/24/99, Mark Polishook wrote: >James, > >The following works once - I can't repeatedly turn the Tspawn on and off (only >on and off once). > >What have I missed? The first problem is that you set the action proc so that it tries to release the synth that has already been released when you check it ON the second time. You should also use a lagTime of zero for the Plug on the check box. --- james mccartney james@audiosynth.com http://www.audiosynth.com If you have a PowerMac check out SuperCollider2, a real time synth program: ------------------------------ Date: Fri, 26 Nov 1999 03:23:15 -0500 From: Mic Berends <---@---.---> Subject: integers chop chop chop. since we need integer precision to be maintained through many iterations in an object that only uses floats, would it not be possible simply to determine the number of decimals precision we need and then truncate any additional bits (rounding / folding / aliasing errors) at each iteration (or even every n iterations)? this would have the effect of keeping each quanta in its own "bin", so to speak (as long as the walls were thick enough). or am i way off base (again :) here? i know it's not very elegant, but there you go. Parenthetically Yours, 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: Fri, 26 Nov 1999 10:03:32 +0100 From: Ioannis Zannos <---@---.---> Subject: Re: calculating the size a list needs in RAM Hmm, details: > >- for a #[ type list of lists full of numbers. > > > >The numbers are not defined as integers but could be if this will reduce > >the size. > > each slot takes 8 bytes. An object header is 32 bytes. > A slot can hold an Integer, Float, Char or Symbol all in place, > or a pointer to an object. So that means that each integer stored in the list would cost: 8 bytes for the slot of the list + 32 bytes for the header of the integer object stored + 4 bytes for the integer itself. - --- = 44 bytes total. Is that right? More generally speaking, my pure guess on how objects are stored in lists (for James to correct): 1. Using the general list (or array) type allows mixing different kinds of objects, but the tradeoff is that each object will have its own header, i.e. a character object will cost 32 bytes for the header and 1 byte for the character = 33 bytes total. 2. For more compact storage of lists of data where all data items are of the same kind its better to use one of Int8Array[int8] : RawArray { Int16Array[int16] : RawArray { Int32Array[int32] : RawArray { RGBArray[color] : RawArray { FloatArray[float] : RawArray { DoubleArray[double] : RawArray { These store the data items without an object header, but return proper object instances of the data (with a header for each object instance) when accessed with 'at'. James, corrections? other options? Iannis Zannos ===================== James McCartney wrote: > > At 4:26 AM -0700 11/24/99, finer@easynet.co.uk wrote: > >If I want to work out how much RAM a list will occupy what is the exact > >"formula". > > > >- for a #[ type list of lists full of numbers. > > > >The numbers are not defined as integers but could be if this will reduce > >the size. > > each slot takes 8 bytes. An object header is 32 bytes. > A slot can hold an Integer, Float, Char or Symbol all in place, > or a pointer to an object. > > --- james mccartney james@audiosynth.com http://www.audiosynth.com > If you have a PowerMac check out SuperCollider2, a real time synth program: > ------------------------------ Date: Fri, 26 Nov 1999 10:07:59 +0100 From: Ioannis Zannos <---@---.---> Subject: Re: Rhythm follower James McCartney wrote: > > At 3:40 AM -0700 11/22/99, Ioannis Zannos wrote: ... > >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. ... > 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.. Thanks, Amplitude will do. Will just take some tweaking of the parameters to adjust to the particular characteristics of the signal to be analysed. OK. Iannis Zannos ------------------------------ Date: Fri, 26 Nov 1999 10:23:17 +0000 From: finer@easynet.co.uk Subject: Task,Files & compile new library I tried to compile a new library with : TestTask{ *ar{ Synth.play({ Task({ var f, g; // write a File f = File("test", "w"); f.write("This is a test..."); f.close; 1.wait; loop({ // read from a File g = File("test", "r"); g.readAllString.postln; g.close; 1.wait; }); }); PinkNoise.ar(0.2); }); } } and got this error : ERROR: Message 'acquire' not understood. does this mean its not possible to read from a file in SCPlay ? (I think you once said it isn't - just checking !) Thanks Jem ------------------------------ End of sc-users-digest V1 #75 *****************************