James Harkins | 1 Feb 2004 02:51
Picon
Favicon

Re: Limiter: weird behavior

Perfect! THANKS!!!!

H. James

On Saturday, Jan 31, 2004, at 15:02 US/Eastern, James McCartney wrote:

>
> On Jan 31, 2004, at 8:31 AM, James Harkins wrote:
>
>> Now... compander.
>
> OK I fixed it. I also increased the default for relax to 0.1, because 
> 0.01 is too short and can cause ring modulation due to the envelope 
> changing too quickly.
>
> _______________________________________________
> sc-users mailing list
> sc-users@...
> http://www.create.ucsb.edu/mailman/listinfo/sc-users
>
>
____________________________________

H. James Harkins /// dewdrop_world
http://www.duke.edu/~jharkins

"If attacked by a lion, thrust your arm down his throat.
This takes some practice."  -- Cyril Connolly
James Harkins | 1 Feb 2004 03:21
Picon
Favicon

Re: OT: "gcd" of non-integers


On Wednesday, Jan 28, 2004, at 23:30 US/Eastern, James Harkins wrote:

> If gcd(15, 25) = 5, I would like an algorithm that will compute 
> gcd(1.5, 2.5) = 0.5. I find tons of references online to Euclid's 
> algorithm, which presumes integers, but nothing for floats.

With the help of a mathematician friend, I came up with this. It's not 
bulletproof, but it should be good enough for my purposes. I have no 
plans to commit it.

1.5.fuzzygcd(2.500001)
0.499999

1000.fuzzygcd(2001)  // error margin = default 1.5% -- 2001/1000 
accepted
1000

1000.fuzzygcd(2001, 0.001)	// very low error margin -- 2001/1000 not 
accepted
1

1000.fuzzygcd(2160)
40

+ Integer {
	fuzzygcd { |that, error = 0.15, tries|
			// error = acceptable amount of error in deciding "equality"
			// tries = how many iterations before giving up & returning nil
		^this.asFloat.fuzzygcd(that.asFloat, error, tries)
(Continue reading)

David Loehlin | 1 Feb 2004 03:35

Re: function table help needed

On Sat, 31 Jan 2004, a p wrote:

> AFAIK, Osc (and other ugens) uses a specially formatted tables  
> ('wavetable format') which you can get via the .asWavetable message  
> from a signal. this is done to optimize interpolation of the table.  
> Playbuf uses a 'straight' table.

The b_gen methods get a workable wavetable format for Osc, but
Signal.asWavetable doesn't work right:

	~sig2 = Signal.newClear(512);
	~sig2.waveFill({ arg x, i; sin(x) }, 0, 2pi)
	~sig2 = ~sig2.asWavetable;
	~buf4 = Buffer.alloc(s, 512, 1);
	~buf4.setn(0, ~sig2);
	{Osc.ar(~buf4.bufnum, 200, 0, 0.5)}.play;

Playbuf works as a substitute for Osc, but there's no substitute as far as
I can tell for Shaper to do waveshaping (any thoughts anyone?).  Shaper
also requires wavetabled buffers.  

                             David Loehlin
	             dloehlin@...    

	                 Anticlimax radio:
		       whpk 88.5fm chicago
  	  	   fridays eight to ten am
        http://home.uchicago.edu/~dloehlin
David Loehlin | 1 Feb 2004 03:36

Re: function table help needed

On Sat, 31 Jan 2004, James McCartney wrote:

> That's painfully slow and causes a lot of messaging.
> 
> The best way is to load from a file if you are on the same machine:
> 
> z = Signal.newClear(512);
> 
> // .. fill signal z with something ..
> z[10,13..200] = 0.1;
> 
> f = File("mysignal","w");
> f.write(z);
> f.close;
> 
> s.sendMsg(\b_allocRead, 0, "mysignal");

Thanks James, this ought to be in a helpfile (probably Signal's).

                             David Loehlin
	             dloehlin@...    

	                 Anticlimax radio:
		       whpk 88.5fm chicago
  	  	   fridays eight to ten am
        http://home.uchicago.edu/~dloehlin
Joshua Parmenter | 1 Feb 2004 03:58

Re: More on "for", plus a MIDI question

In addition to Task, there is also Routine which I tend to use a lot... 
here is an example using a SynthDef:

SynthDef(\sinetest, {arg freq = 440, dur = 0.1;
	Out.ar(0, SinOsc.ar(freq, 0, 0.5) * Line.kr(1, 0, dur, doneAction: 2));
}).load(s);

(
var freqarray, durarray;
freqarray = [300, 330, 360, 390];
durarray = [0.3, 0.5, 0.3, 0.1];
a = Routine({var freq, dur;
	inf.do({arg i;
		freq = freqarray[i%freqarray.size];
		dur = durarray[i%durarray.size];
		Synth(\sinetest, [\freq, freq, \dur, dur]);
		dur.wait;
		});
	});
)
a.play;
a.stop;

Or, the calls can be more arbitrary:
(
var freqarray, durarray;
freqarray = [300, 330, 360, 390];
durarray = [0.3, 0.5, 0.3, 0.1];
a = Routine({var freq, dur;
	inf.do({arg i;
(Continue reading)

Joshua Parmenter | 1 Feb 2004 03:59

Re: function table help needed

I agree... makes much more sense then my 512 messages to the server!

Josh

On Jan 31, 2004, at 6:36 PM, David Loehlin wrote:

> On Sat, 31 Jan 2004, James McCartney wrote:
>
>> That's painfully slow and causes a lot of messaging.
>>
>> The best way is to load from a file if you are on the same machine:
>>
>> z = Signal.newClear(512);
>>
>> // .. fill signal z with something ..
>> z[10,13..200] = 0.1;
>>
>> f = File("mysignal","w");
>> f.write(z);
>> f.close;
>>
>> s.sendMsg(\b_allocRead, 0, "mysignal");
>
> Thanks James, this ought to be in a helpfile (probably Signal's).
>
>                              David Loehlin
> 	             dloehlin@...
>
> 	                 Anticlimax radio:
> 		       whpk 88.5fm chicago
(Continue reading)

David Loehlin | 1 Feb 2004 03:57

endless glissando

Thanks everyone for advice on getting transfer functions to work.  I ended
up using PlayBuf, which is sort of a hack, instead of Osc.  I had to write
the frequency curve myself to get it in audible range, so it's not exactly
like the original, but it's still a fun psychoacoustic 'trick'.  I spent
all morning freaking out my neighbors.

//Risset's endless glissando.  adapted from diagram in Dodge and Jerse's
_Computer Music_, p. 106
//The transfer functions really ought to be recalculated to work with
larger buffers, and keep the 
//partials in a harmonic ratio.  Vibrato doesn't sound great but it fuses
the spectra better 
(
SynthDef(\subunit, {arg i_unitnumber, i_numunits, phase, amp, dur,
topfreq, freqbuf, ampbuf;
	var freqfunc, ampfunc, synth, env;
	env = Env.new([0,1,1,0],[0.5,dur-1.0,0.5],\linear);
	
	freqfunc = PlayBuf.ar(1, freqbuf, 1/dur*512/44100, 0,
i_unitnumber/i_numunits*512, 1)*topfreq;
	ampfunc  = PlayBuf.ar(1, ampbuf,  1/dur*512/44100, 0,
i_unitnumber/i_numunits*512, 1)*amp;
	
	synth = SinOsc.ar(freqfunc, phase, ampfunc)*EnvGen.kr(env,
doneAction:2);
	Out.ar(0, [synth,synth]);
}).send(s);
SynthDef(\vibrato, {arg freq, width, i_ctlbus=0;
	Out.kr(i_ctlbus, SinOsc.ar(freq, 0, width));
}).send(s);
(Continue reading)

Shigeru Kobayashi | 1 Feb 2004 04:26
Picon

a small error in MIDIIn.help.rtf

Hello,

I'm sorry if this list is not an appropriate place to post this kind of 
topics. If I should use SourceForge's bug tracking system, please let 
me know.

I found a small error in MIDIIn.help.rtf. In the beginning of the 
document:

> Quick start for 1 port:
> 
> (
> 	MIDIIn.connect; 	// init for one port midi interface
> ...
> 	MIDIIn.touch = { arg src, chan, pressure; 	[chan,num,pressure].postln; };

It seems that 'num' is missing in arguments. I'm sorry if I 
misunderstand.

> (I% ERROR: Variable 'num' not defined.
>    in file 'selected text'
>    line 9 char 53 :
>   	MIDIIn.touch = { arg src, chan, pressure; 	[chan,num(I%,pressure].postln; 
};

Thanks,

shigeru kobayashi
e-mail: kotobuki@...
(Continue reading)

James McCartney | 1 Feb 2004 05:21
Picon

Re: function table help needed


asWavetable doubles the size of the data, so there are 1024 floats, not 
512.

On Jan 31, 2004, at 6:35 PM, David Loehlin wrote:

> The b_gen methods get a workable wavetable format for Osc, but
> Signal.asWavetable doesn't work right:
>
> 	~sig2 = Signal.newClear(512);
> 	~sig2.waveFill({ arg x, i; sin(x) }, 0, 2pi)
> 	~sig2 = ~sig2.asWavetable;
> 	~buf4 = Buffer.alloc(s, 512, 1);
> 	~buf4.setn(0, ~sig2);
> 	{Osc.ar(~buf4.bufnum, 200, 0, 0.5)}.play;
James McCartney | 1 Feb 2004 06:14
Picon

Re: a small error in MIDIIn.help.rtf


I fixed this a few days ago.

On Jan 31, 2004, at 7:26 PM, Shigeru Kobayashi wrote:

> Hello,
>
> I'm sorry if this list is not an appropriate place to post this kind of
> topics. If I should use SourceForge's bug tracking system, please let
> me know.
>
> I found a small error in MIDIIn.help.rtf. In the beginning of the
> document:
>
>> Quick start for 1 port:
>>
>> (
>> 	MIDIIn.connect; 	// init for one port midi interface
>> ...
>> 	MIDIIn.touch = { arg src, chan, pressure; 
>> 	[chan,num,pressure].postln; };
>
> It seems that 'num' is missing in arguments. I'm sorry if I
> misunderstand.
>
>> (I% ERROR: Variable 'num' not defined.
>>    in file 'selected text'
>>    line 9 char 53 :
>>   	MIDIIn.touch = { arg src, chan, pressure; 
>> 	[chan,num(I%,pressure].postln;
(Continue reading)


Gmane