Fit function in daisy tools

Hello folks!
I’m a bit of a newbie to daisy seed and programming in general and I have two questions. But I always use a feature like the arduino “map” function, that takes a value, clamps it between the inMin and inMax, and then scales it between the outMin and outMax. So something like fit(value, inMin, inMax, outMin, outMax). I could presumably create such a function myself, but I would really like it if there is already such a function in the daisy environment.
The other thing is , I saw in some of the daisy examples a conversion from linear to logarithmic scale of the potentiometer value, red by the ADC. I tried to reverse engineer it, but it looks like it’s build in to work only with the daisy patch, and I have the seed. Is this function available to be used with seed?

You’re probably looking for this: DaisySP/dsp.h at master · electro-smith/DaisySP · GitHub

2 Likes

Yes, thats exactly what I was looking for! Thanks a lot!
Well, on a second thought, this is missing the part where it scales the output between two values. So for example I may want the output to be between -10 and +10 with 0 to 1 float input

Yes, that’s what it actually does with min = -10, max = 10

oh, ok so it assumes the input is normalized from 0 to 1. That would work too :slight_smile: