Float to Int for sending over serial
May 16 2021 | 4:58 pm
Hey, I've run into an issue in a project where I'm trying to send a list of floats from max to arduino. The data is a list of FFT bin amplitudes generated from the fft.list and fft.normalize objects in the fft tutorials https://cycling74.com/articles/fft-part-5.
I've been able to send data from max to arduino over serial, but only when the data are integers, but the FFT bins are floats - and while I get some data into arduino, it doesn't correspond to the digits I see in max and I don't know how to make sense of it. I've been reading a few threads, which suggested instead to convert the data to ints in max before it's sent which seems like a sensible strategy. I can edit the fft.normalize object to convert the range to 0-100 for a sensible range for whole-number amplitude values, but I don't know how to convert the float list to an int list in max.
Would anyone have any suggestions on how to solve this? or alternatively how to interpret float data sent from max over serial?