Hi,
I would need to understand the approx variable in the reduce-points object:
I want to smooth a list of L elements as to have the delta between consecutive points, D, below a value k. What approx should I apply?
Thank you,
Fabio
Dear Fabio,
reduce-points was not written, initially, to smooth values, but to correct csound table definitions (GEN) when they were too long, for instance, tables produced by spectral analysis data (a Csound statement, at the moment, cannot have more than 1024 P-fields). One approx tries to automatically replace several consecutive points that are linearly spaced by two points at the beginning and at the end of the interval (since linear interpolation is always applied). The other approx forces the list to contain a maximum of “approx” values. You do not mention how spaced are your points (equally or not, for instance?) and how much you want to smooth the list. If it is not too much, I would experiement with the first approx method and, heuristically, see if a (small) value fits your needs. I hope this can help you.
Best,
Marco
Thank you Marco. In the meanwhile I found a nice solution by implementing the Douglas-Peucker algorithm as a List Function.
Best, Fabio
Ciao, Fabio, thank you for taking the time to reply to me. The Douglas-Peucker algorithm is certainly much more advanced than what we did with “reduce-points”.
May I propose, however, and only if you wish and do not mind, to include this function to the next release of OMChroma (giving you all the credits, of course)? In this case, would you, please, share your Lisp code with me (to my Ircam mail)? Only if you wish…
Ciao.
Marco