FluidKDTree pseudo ugen

Greetings,

Here’s the “pseudo ugen” that @spluta and I were talking about a few weeks ago, in conversation with @tremblap. It works nicely–makes the server integration of KDTree lookup smoooooooth. Check out the test file to see the two options: (1) supply your own buffers if you want to get access to the buffers elsewhere or (2) if you just need the kr stream in the synth the method .krstreamlocal will make 2 LocalBufs for you.

I have one problem and one question for @tremblap, @weefuzzy, and @groma:

(1) When I run this code it works great (boots the server, loads the datasets, etc.), but then if I hit Command period to stop it and Command return to run it all again, the server crashes and says: ERROR: FluidKDTree wrong number of arguments.Ran out of arguments at dataSet Server 'localhost' exited with exit code 0..

(2) I believe I’ve correctly assumed that if numNeighbours is greater than 1, the outputBuffer needs to be (cols of lookupDataSet * numNeighbours) which is very slick, just checking that the output then would be, for example (cols = 2, neighbours = 2) [ neighbour1-col1, neighbour1-col2, neighbour2-col1, neighbor2-col2 ]. Is this order correct?

Thanks for finding a reproduce-able case for this: @tremblap had tripped over it near the end of testing but then had trouble making it happen again.

Turns out not all my code had got the memo about dataset IDs no longer being strings, so all kinds of hilarious things are happening with memory, and these get progressively more hilarious the more Fluid-Dataish objects one makes. Good Times.

Can’t think of a workaround offhand, sorry :grimacing: [other than the lookup dataset always having an ID of 1, but I don’t think that’s very practical :wink: )

1 Like

ohhhh that explains it. I got it after a lot of testing done and use and stuff, then restarting over and over did not make it happen ever…