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.

 _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada
_______________________________________________
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to