I would like to somehow convert (maybe quantize is a better word) incoming floats between 0.0 and 1.0 to five fixed values.
Here is my array of values that I would like to map to:
[128, 512, 1024, 2048, 4096]
I am using this inside of a synthdef. It’s to do with a buffer so the whole things falls apart and takes SC with it when given a number which is not the ones in the array. Sure, I can remember to not give this synth bad values, but the thing is I’m sharing this synth with lots of other people whom I don’t want to create problems for.
I am aware of .linlin(0.0, 1.0, 128, 4096)
and I think that I am looking for something similar that I don’t know the name of so I can’t search for it.
Any help greatly appreciated.