# FluidDataSet \*Over\* Wr

**URL:** <https://discourse.flucoma.org/t/fluiddataset-over-wr/727>\
**Category:** Toolbox 2 Improvement Ideas\
**Created:** [December 28, 2020, 9:18pm UTC](https://discourse.flucoma.org/t/fluiddataset-over-wr/727 "2020-12-28T21:18:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tedmoore](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/tedmoore/32/439_2.png) [@tedmoore](https://discourse.flucoma.org/u/tedmoore)\
**Post date:** [December 28, 2020, 9:18pm UTC](https://discourse.flucoma.org/t/fluiddataset-over-wr/727/1 "2020-12-28T21:18:20Z")

</div>

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:

```auto
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](https://discourse.flucoma.org/t/fluiddataset-from-buffer/466)

Thanks all!

T

---

<div class="post-metadata">

**Author:** ![weefuzzy](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/weefuzzy/32/362_2.png) [@weefuzzy](https://discourse.flucoma.org/u/weefuzzy)\
**Post date:** [December 29, 2020, 12:04am UTC](https://discourse.flucoma.org/t/fluiddataset-over-wr/727/2 "2020-12-29T00:04:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tedmoore](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/tedmoore/32/439_2.png) [@tedmoore](https://discourse.flucoma.org/u/tedmoore)\
**Post date:** [December 29, 2020, 3:06am UTC](https://discourse.flucoma.org/t/fluiddataset-over-wr/727/3 "2020-12-29T03:06:31Z")

</div>

> [@weefuzzy](#):
>
> 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.

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…

> [@weefuzzy](#):
>
> 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, this would work!

---

<div class="post-metadata">

**Author:** ![tremblap](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/tremblap/32/5_2.png) [@tremblap](https://discourse.flucoma.org/u/tremblap)\
**Post date:** [December 29, 2020, 12:07pm UTC](https://discourse.flucoma.org/t/fluiddataset-over-wr/727/4 "2020-12-29T12:07:49Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![tedmoore](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/tedmoore/32/439_2.png) [@tedmoore](https://discourse.flucoma.org/u/tedmoore)\
**Post date:** [December 29, 2020, 7:18pm UTC](https://discourse.flucoma.org/t/fluiddataset-over-wr/727/5 "2020-12-29T19:18:14Z")

</div>

> [@tremblap](#):
>
> updatePoint would create silently if that does not exist

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.

---

<div class="post-metadata">

**Author:** ![weefuzzy](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/weefuzzy/32/362_2.png) [@weefuzzy](https://discourse.flucoma.org/u/weefuzzy)\
**Post date:** [December 29, 2020, 11:09pm UTC](https://discourse.flucoma.org/t/fluiddataset-over-wr/727/6 "2020-12-29T23:09:34Z")

</div>

> [@tedmoore](#):
>
> More specifically I’m curious about having an overwrite functionality in `FluidDataSetWr.kr` so it can happen on the server.

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 😃
