ftom error?

Randy Stack's icon

Hi All~

I've been using [ftom] to show various frequencies on a [kslider] keyboard. Trouble is, I'm getting results that are a semitone off when attempting to use frequencies below about 8Hz. However, if I use the floating-point version of [ftom 0.], the results come out correctly.

In my example below, I'm using @base 430.538971 to tune to a C256. But I've noticed the error at A440 as well, just going down in octaves with A until I hit 6.875Hz where [ftom] gives me a note number of -2 (a semitone off) and [ftom 0.] gives me -3 (correct).

Is this a bug?

Cheers,
~Randy

ftom-test-sub-8hz.maxpat
Max Patch

Peter Ostry's icon

Looks like a bug in [ftom] when it goes negative.
Just use [ftom 0.]

Randy Stack's icon

Thanks, Peter, I thought as much. When I use the floating-point [ftom 0.] with [int], it does exactly the same as [ftom] with the semitone error, but in the positive note ranges. [ftom 0.] with [round], however, seems to give accurate results regardless of sign. ~R ⨳

Roman Thilenius's icon


yeah, thats a rounding error, somebody got the rounding not right when output is below 0.

i think i reported this in 2003, together with the math bugs in meter and degrade.

dont be always so impatient, guys! just wait a bit, i think there is an incremental update planned for 2037.

-8.51 should be rounded to -9