[PD] match the closest number

Alexandre Quessy listes at sourcelibre.com
Tue Jun 19 05:45:24 CEST 2007


Hey !
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.

Cheers !

a


2007/6/18, Chuckk Hubbard <badmuthahubbard at gmail.com>:
> Here's a possibility.  Not very elegant, but it works.
> Replace the list and the numberboxes with whatever input and output you need
> and it ought to work, if the differences are smaller than 100000.
> -Chuckk
>
>
>
> On 6/18/07, danja <binary.koala at gmail.com> wrote:
> > hello there,
> > i have a [list] of numbers and i'd like to search through it for the
> > value closest to the search subject. so to say, if i have '22 31 47 86'
> > in my list and i match it with '45' the answer would be '47' (closest in
> > the list). this rather useful function (fuzzy integer search?) must have
> > been written by someone already, it's just that i can't find it :)
> > i wouldn't ask if i could patch it myself, but i know how it might work:
> > all integers from the list are compared to the reference (subject)
> > number, and the integer in subtraction closest to '0' would be the
> > hit... you know what i mean?
> >
> > any advice is very much appreciated!
> >
> > p.s. apologies for my ignorance, i'm just starting here...
> >
> > --
> > danja
> > http://k0a1a.net
> >
> > _______________________________________________
> > PD-list at iem.at mailing list
> > UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list
> >
>
>
>
>  --
> http://www.badmuthahubbard.com
> _______________________________________________
> PD-list at iem.at mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list
>
>
>


-- 
Alexandre Quessy
http://alexandre.quessy.net
http://www.puredata.info/Members/aalex




More information about the Pd-list mailing list