[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] Similarity Clumping



Thanks - the fix works well! 

On Sun, Dec 1, 2019 at 7:56 PM <daniel-mayer@xxxxxxxx> wrote:

Am 02.12.2019 um 01:49 schrieb daniel-mayer@xxxxxxxx:

>
> What about this ?
>
>
> ~myClump = { |array, thr = 0.1|
>       var a = array.copy.sort, colcol, col;   
>       a.do { |x, i|
>               ((i > 0) and: { x - col[0] > thr }).if {
>                       colcol = colcol.add(col);
>                       col = [x]
>               }{
>                       col = col.add(x)                       
>               };
>               (a.size - 1 == i).if { colcol = colcol.add(col) }
>       };
>       colcol
> }     


Or a bit condensed - anyway the logic needs to differentiate some cases

~myClump = { |array, thr = 0.1|
        var a = array.copy.sort, colcol, col;   
        a.do { |x, i|                                   
                ((i > 0) and: { x - col[0] > thr }).if { colcol = colcol.add(col); col = nil };                                 
                col = col.add(x);
                (a.size - 1 == i).if { colcol = colcol.add(col) }
        };
        colcol
}       


Regards

Daniel

-----------------------------
http://daniel-mayer.at
-----------------------------




_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/