Audio respons very jittery

alexbeim's picture

When I get a sphere to move as a response to audio it is very jittery. What patch can I use to affect the number coming from the audio fix this?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

DanieleCiabba's picture
smooth

Try to use the smooth patch. you can control the type pf smoothing (interpolation), the increasing and the decreasing duration...

alexbeim's picture
smooth patch

Hi Daniele I'm not sure what patch you refer with smooth patch. Can you clarify?

thank you

cwright's picture
Smooth

With QC Leopard, there's a patch called "Smooth" (Category is "Numeric"). It's new to Leopard, so if you're on Tiger you don't have this patch. (I think you're on Tiger, since you did some initial testing on the serial IO patch with Tiger...)

So, for Tiger, you'll need to write a Javascript smoother (a simple low-pass filter, if you're familiar with signal processing).

Without testing (or firing up Tiger), the code will probably look something like this: (it needs to have persistent memory, so it looks a bit ugly)

if(Object.x == undefined) { //initialize only once
   Object.x = new Array(1); //create array variable 
   Object.x[0] = 0; 
   } 
 
Object.x[0] = (Object.x[0] + inputs[0])/2;
 
outputs[0] = Object.x[0];

The line Object.x[0] = (Object.x[0] + inputs[0])/2; is your simple LPF, and you can tweak coefficients to change its behaviour. For example, if you did this:

Object.x[0] = (Object.x[0]*2 + inputs[0])/3;

you'd get an even smoother curve, but it would respond even slower to rapid changes in input (since it would be 2/3 is previous value, plus 1/3 the current value).

Hope this helps :)

[EDIT: if you go even deeper in DSP stuff, you can get some pretty cool, pretty complicated filters (Infinite Impulse Response, Finite Impulse Response, band pass, etc). that's probably beyond the scope of this thread though :) ]

alexbeim's picture
I tried that but failed

Tried that but failed to make it work. It may be something totally dumb sicne I know zero programming. I just copied and pasted your code here is the screen grab. I may just upgrade to panther to get to that patch you mentioned

Cheers

PreviewAttachmentSize
Picture 1.png
Picture 1.png27.12 KB

cwright's picture
what does it do?

what does it do, if anything?

franz's picture
smooth / alt

this would also be a smooth:

if (outputs[0]==undefined) {
  outputs[0]=inputs[0];
} else {
  outputs[0]=(inputs[0]+outputs[0]*inputs[1])/(inputs[1]+1);
}

where input 1 is the smooth factor. (that's what i used under tiger)

Leopard's built-in Smooth node is MUCH better as it allows different factors for increasing/decreasing signals, so it is quite easy to mimic an EQ (if that's what you wanna do)