High amplitude signals

Jun 8, 2012 at 9:08pm

High amplitude signals

Hello to everyone,

I don't understand something going on, but maybe i'm just missing a basic concept..

I want to separate normal amplitude signals, below 1, from higher ones. The problem is, when the amplitude rises really much over 1 (for instance 77000 billions) , it seems like the “>1″ test fails, while the “<1" test starts "banging" again.
Actually what I test is a “meter~” output , which is always positive, with a refresh time of 50 ms… but anyway I took some screenshots, since they probably can explain the issue in a better way: the first 3 are ok, while the last shows the problem.

Thanks for your patience,
cheers
Marco

[attachment=196104,3997] [attachment=196104,3998] [attachment=196104,3999] [attachment=196104,4000]

Attachments:
  1. Schermata062456087alle22.28.23.png
#48972
Jun 8, 2012 at 10:30pm

Because the argument you typed into the > and < objects does not contain a decimal point, you are doing integer comparisons with a float input. The float gets converted to int by the < and > objects. But the maximum positive number that a 32-bit int can represent is 2147483647, so if you send in any float greater than that (or greater than 2147483520, in fact), it will get converted into a negative number. (Floats that large get very imprecise, but the trade-off is that they can go higher than 2147483647.) Perhaps this little patch will exemplify it. Try dragging the float number box to output numbers greater than or less than 2147483520.

– Pasted Max Patch, click to expand. –
#175906
Jun 8, 2012 at 11:02pm

Thanks a lot Christopher! I just didn’t need float precision and so i chose to compare integers (and I thought it was less expensive for the cpu), but now, since i’m forced to, I won’t scale the <1. signals at all. Well, the < =1. ones.
It’s so strange that ints turn negative… is it a sort of convention, just to let you (in some way) know that the number is out of digits?
thanks again,
m

#175907
Jun 9, 2012 at 5:37am

No. All 32-bit signed integers “greater than” 2147483647 are actually representations of negative numbers from -2147483648 to -1.

Bit 31 is considered the “sign” bit; if it’s set, the number is negative and all other bits mean their opposite (“ones’ complement”).

Do a Wikipedia search on “Integer_(computer_science) and/or “Signed number representations” and/or “Ones’_complement” for more info.

– Pasted Max Patch, click to expand. –
#175908
Jun 9, 2012 at 12:19pm

Ah yes! Bit depth is half positive and half negative, starting from 0 and coming back to -1. The negative half is the one with the last bit set… did you call it the 31st bit because the first is “bit 0″?

#175909
Jun 9, 2012 at 3:45pm

Yes. I think I should have more correctly said either “bit 31″ or “the 32nd bit”.

#175910
Jun 9, 2012 at 4:08pm

Thank you

#175911

You must be logged in to reply to this topic.