FluidDataSet *Over* Wr

Greetings,

I’ve been continuing to roll on my kick to create krstream options for some of these objects so that there’s less buffer shuffling when it’s not necessary––and I realized that the FluidDataSetWr is not capable of overwriting in a dataset. It would be great to create a dataset that was a kind of “circle buffer” of the data of the last x amount of time, something like:

s.waitForBoot({
	Routine{
		var n_xdims = 6;
		~ds = FluidDataSet(s);

		s.sync;

		{
			var xstream = LFDNoise3.kr(2.dup(n_xdims));
			var trig = Impulse.kr(30);
			var counter = Stepper.kr(trig,0,0,59);
			var buf = LocalBuf(n_xdims);
			n_xdims.do({
				arg i;
				BufWr.kr(xstream[i],buf,i);
			});
			FluidDataSetWr.kr(~ds,"",counter,buf,trig);
		}.play;
	}.play;
});

But once the “wrap” happens in Stepper.kr the error is thrown: ERROR: Label already in dataset
// ===========================
Another solution would be to just write krstream into a circle buffer with RecordBuf.kr and then be able to do something like @spluta suggested here: https://discourse.flucoma.org/t/fluiddataset-from-buffer/466

Thanks all!

T

1 Like

Yes, I keep running into this (in Max as well). In the case of FluidDataSetWr, it delegates internally to addPoint on the dataset, so won’t overwrite.

I’ll talk to @tremblap and @groma about how to approach: the strict separation between addPoint and updatePoint is useful for being able to write very safe code (i.e. it’s harder to overwrite by mistake), but I think there are a number of use cases where having either an addPoint that overwrites or an updatePoint that creates would be useful.

In Max it’s a bit less onerous to work around in the circular buffer case by running a counter, and changing message after you’ve been round the buffer once, but that’s trickier to manage in a Synth.

Perhaps the UGen changes so that we can pass an overwrite flag, and then it can check whether a point exists on the server and then do the appropriate thing.

Yeah, I have done it this way in the language: switching over to update after it’s full, but then, yes, I’m doing a lot of language communicating…

Yeah, this would work!

I thin that my solution would be that updatePoint would create silently if that does not exist. This is very much in line with the Max Dict syntax and make the sideway use of using updatePoint as a checker of existence impossible, which is probably a good thing. So updatePoint would create the point as the coder using it assums it is a valid space to write. We could add the flag to that one if we want to be super safe and keep backward compatibility…

Yes I like this idea. More specifically I’m curious about having an overwrite functionality in FluidDataSetWr.kr so it can happen on the server.

1 Like

We hear you – it’s just that FluidDataSetWr is using basically the same API, server-side, so this is us thinking out loud about which stratum of code it would make sense to introduce any change into :smiley:

2 Likes