Array of Arrays to FluidDataSet (Beginner Question)

Hi dear Flucoma users,

im starting to use the environment in supercollider and have some issues understanding
whats going on. I want to transform a simple list of the form:

[[1,2,3,4],[1,2,3,4],etc]

to a FluidDataSet. Before i construct a .json myself with the File-Object asking might be better.
As im completely self-tought i most likely missed many things. If there is
a best practice for this please let me know. If i just have to rtfm a bit more let me know also =)

best

flo.

Hello

I presume you are in SuperCollider? In all cases, the FluidDataSet interacts with Dictionaries so you can use that approach. It is documented in the FluidDataSet helpfile.

My first question would be - do you care what identifier each item will have? If so, there is one way. If not, there is another way.

Not caring:

  • make a buffer, where each channel is a ‘dimensions’ and each frame is a ‘point’. Frame 0 will be named “0” (a string, not a number) and frame 1352 would be names “1352”. In SC, this looks like this:
s.reboot
// make 9 points of 5 dimensions in a buffer where CHAN=DIM and FRAME=POINT
b = Buffer.loadCollection(s, 9.collect{5.collect{1.0.rrand(-1)}}.flatten,5)

// check them
b.plot.plotMode_(\points)

// make and transfer
c = FluidDataSet(s).fromBuffer(b)

// voilà
c.print
1 Like

Hi,
“.flatten” method was the thing.
Thank you!
flo.

1 Like

There is a more principled way to do it, and you can decide how to call your points

d = FluidDataSet(s).load(Dictionary.newFrom([\cols, 5, \data, Dictionary.newFrom(9.collect{|i|["item-%".format(i), 5.collect{1.0.rrand(-1)}]}.flatten)]),{d.print})
1 Like

I never was into Dictionaries too much. It comes back to haunt me now =)
Thank you!

2 Likes