Can anyone explain how spreaded Bin Size in GetSlice works?

I was looking into GetSlice help patch and don’t understand how SPREADED Bin Size works. Can anyone explain or point to a better explanation? Because I don’t see any logical correlation between Bin Size values and the result.

Have you read all of the documentation? It requires quite a lot of talking through to explain what’s happening in that patch to get those values from that spread. GetSpread (Spreads) is a sometimes-simpler way of retrieving values.

The Index pin’s function is relative to the corresponding Bin Size slice. The order of the outputs is dependent on order and spreadcount of inputs. See tutorial spreads

and from the help patch regarding negative bin size:

a negative bin size (nbs) is relative to the size of the input spread. the resulting bin size (rbs) is calculated by the following formula:
rbs := input.spread / |nbs|
where |-a| = a

I understand spreads. For fixed Bin Sized it seems clear — take index’s bin of size N or of size total/|N| if N<0. But what to do with spreaded Bin Size?

In the example above I have index 2 and Bin Size 3 at slice 0. So I brake the spread in triplets and take the second one (starting from zero)? It will be 10,20,25 because 2 mod 2 = 0. Nope, doesn’t seem to be the answer.

Alright, do I take the second slice in Bin Size which is -3 so bins are of size 2? Seems possible because the first two slices are 35,50 and output bin size is 2.

But WHY do I take the 2nd pair (starting with 0)? Because if I follow the same logic with index 1 and Bin Size 1 at index 1 I seem to get 30…

That’s the logic there?

*Bin Size values are resampled until their sum matches (a multiple of) the Slicecount

input: [0,1,2,3,4,5,6,7,8,9](0,1,2,3,4,5,6,7,8,9)
binsize: [2,3](2,3)
-> binsize: 2+3=5 but slicecount = 10 -> binsize: [2,3,2,3](2,3,2,3)
-> [0,1](0,1) , [2,3,4](2,3,4) , [5,6](5,6) , [7,8,9](7,8,9)

so in case of getslice the binsize is grouping the input spread, and is not the binsize of the index you are selecting, since that could result in overlapping bins within the input spread

Again I think using GetSpread (Spreads) in this scenario for what you’re specifically trying to do can save you some time and effort.

getslice and getspread.v4p (6.1 kB)

guess similar discussion from 3 years ago: https://discourse.vvvv.org/t/5197

I think this particular example must be explained better in the help patch. I am an experienced programmer and I couldn’t get my head around how exactly spreaded bin sizes work.

So this example with bin sizes (3, 1, -3) breaks spread (10, 20, 25, 30, 35, 50) into bins (10, 20, 25), (30), (35, 50). Index 2 takes (35, 50), index 1 takes (30), index 4 mod 3 = 1 takes (30) again and index 0 gets (35, 50). Right?

@VVVValentin: correct. and i agree the example is rubish as it tries to explain too many things at the same time and constructs a case that you’ll never see in the wild as usually you have either a positive spread of Bin Sizes or a single negative Bin Size.

anyway i found your explanation of the example so readable that i left the rubbish example and just pimped it with that great reading-advice.

Ok. Now I understand better: but there is an error in this eplanation and also in the explanation in the GetSlice-helppatch of vvvv .29 I guess

Index 0 refers to [35, 50](35, 50) <- WRONG
Index 0 refers to 10,20,25 <- RIGHT

The new spread calculated from the bin-sizes is the following
0[10, 20, 25](10, 20, 25)
130
235,50

The input-index refers to this.
Right?

dipboing: you’re right. thanks. my bad. fixed it in the helppatch.