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,
[attachment=196104,3997] [attachment=196104,3998] [attachment=196104,3999] [attachment=196104,4000]
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.
----------begin_max5_patcher---------- 468.3ocyV10aBBCEF9Z3WAoW6VnU9P2EKY+NVVLEop0fERa04lw+6q8.L0ot w7K7lCom91Se6SJGXkqCJIeISg7dx6UOGmUtNNPJaBmpwNnYzkCynJPFRLeV BSh5TNEOERlmL8Ab25jixEZAcFCl5EImlUOiYwbQFSCkBukbE+SPNl7n+Fs4 y00hIUYKn5gS3hwCjrg5ReShsKxC2GdD5aiDSz6sp0TVF8GErxEf3BMpiGJg JFi9VUAUZ7rlIGvDzjLPqucp0tt1PmyFP3VBPUj4tGP8aI9zsDOQ8fGPEZS9 LJK2X8Cvm3159SDbkomei4i4HPul2fXua3Q8YVyVBFEY1zTXC2GcgWSzg+Sz girwnF7lWEvNAnLioTzwr8nBAGDGzqaHw+.bI3exExkkKAPLNFXTueiKmFSN xEkm87e7.vfzRvn9CXkMfLciBaR+mKLPNzGrZqKG8Oad.RQYbwO+4FX6r42E Rp74xg0Uq5r6sYCSYJMWP07bw1Z1UzDdZJClu9DmxU11boGuOWSsCoI1o6My NwMvNj6J2fuqbS+alaBZfahuYtIrAtI3DcS4q7zhhELoppjfQLc.mlKsCi5. C4hxgPEQR1Bds9PWa0V69EPLmNvl -----------end_max5_patcher-----------
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?
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").
----------begin_max5_patcher---------- 426.3ocyU10aBBCEF9Z3WQSuFMzBHvta+NVLlBT0ZfBosZby3+8YKferv1Tm N3llbNm2d3sOzO1YaASJ2RkPvKf2.VV6rsrLozIrZhsfEjso4DoQFrfJkjET nScMEcqxjG0lgkYhKSVMBEzlbdIWwIETSoWELRdaE95BFOmpLcGelbI6CibD dr6IskqUshQMYqHpzkL9hYBZppdofh0SBD4pG8viCb.nnwtfoMSotKp2qn05 gPvTck8115Am+HKb6hEd8EKl31mrXTmaLP8ELvQ8JLvH+P+HuI9QcPk3dBJ9 mwjHjd7+jIGQRXGHIrmPBF6ehIggOKlbvOITQGq6a8hSzsrtw+5kEMGShmnG wt+zBmwUPG.LgvW.OpphHN3YEULixII4FstOR938X4y7RQAwf.u6kX0u3f8c eRHyHDly3e84Zimz4ujixx0hz1uXyQIvISkQkJFmnXk7yzDbglkrrLpobKmx XRs2x99+mWqaPACK63MrrCZPYm3AkatlcNd2oapOkQpp1PExlVZLxg6kVUJz gSbLgLdcnoiPAcCqUefsta6s+D.V9Xom -----------end_max5_patcher-----------
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"?
Yes. I think I should have more correctly said either "bit 31" or "the 32nd bit".
Forums > Max For Live