Trying and failing to convert float32 to integer

Dec 2, 2012 at 5:38am

Trying and failing to convert float32 to integer

I’m trying to use Jitter to generate a biased sine table made out of 8-bit integer values. I thought it would be easiest to start with floats and convert to integers at the end. I seem to be generating the data fine in float32 format, but I am not able to convert the resulting Jitter matrix to char or long. I have tried jit.coerce and a second jit.matrix object, but in both cases the result is garbage data. Am I misunderstanding what jit.coerce is supposed to do?

– Pasted Max Patch, click to expand. –
#65467
Dec 2, 2012 at 8:23am

like this?????

– Pasted Max Patch, click to expand. –
#235898
Dec 2, 2012 at 6:16pm

Thanks, that’s exactly what I need!
For my own understanding, why does it have to be of type long when all the integers are less than 256?

#235899

You must be logged in to reply to this topic.