[PD] match the closest number
Mathieu Bouchard
matju at artengine.ca
Wed Jun 20 07:39:54 CEST 2007
On Tue, 19 Jun 2007, Mathieu Bouchard wrote:
> Nice. That's what I was looking for to improve my closest-note abstraction.
> See http://wiki.dataflow.ws/PdMtlAbstractions/Contents#head-musical
> It is currently only "flooring" the values, I think. Closest is what
> it really means to be. (with floats, not just integers.
>
> If you need something that can work efficiently for a lot of intervals,
> what you ought to do is pre-sort them, then make a list of the averages
> of each two consecutive values. The result is a list of boundaries
> between the domains of each value; then you can find where is your
> closest value by a binary search in O(log n) time.
Sorry for messing up the quoting on that one. The top paragraph was
written by Alexandre Quessy, who I was replying to.
_ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada
More information about the Pd-list
mailing list