Anaylsis on segments

So this is a somewhat tricky one.

I have segments of a buffer using bufnoveltyslice~. I want to then calculate descriptors on those segments and keep the data somewhere so that I can query the samples by their descriptors. These would properly be statistical averages/medians rather than all the frames for that given segment.

My first problem is that I’m not sure where I should discretise the segments. If I bufcompose~ out the segments into separate channels of another buffer every channel gets resized (which I’m assuming will affect any analysis I do later with all the 0’s). If I keep all my analysis as a continuous stream that I query knowing the boundaries of the segments the objects fail in that there is no destchan type attributes to take the analysis and put it in a complementary buffer of similar dimensions. The other head-f is that if I keep everything as a continuous stream knowing the segment boundaries as soon as I enter FFT land for an analysis I have to resynchronise my analysis knowing fftsettings parameters at time of analysis.

What really is the envisaged approach here (if at all) and how can I think my way around something like this? The only thing I thought to do, which smells code smelly and feels wrong, is to analyse a portion of the buffer, turn it into a list, do my stats in Max land then place all the info in some other format (dict, entrymatcher) etc. I could bufcompose individual analysis out to sequential channels of another buffer, where each segment corresponds to a channel but again I run into the problem of resizing and wanting to do any work on the data later.

1 Like

Yeah, curious how you get on with this, as this will be an important workflow for me at some point.

It does get tricky to get into stuff like this, and gets a bit annoying having to make (and manage) all manner of (temporary) buffers along the way, particularly if you have n amount of slices you want to analyze.

Right now, I’m willing to go into technical debt and do what I know because the problem feels too large. I’m keen to learn new ways of working and I think that fluid~ stuff overall is what I would prefer to use (especially for the stats stuff) but right now its a bit ???

A quick pointer first: did you check the help tab called ‘musical example’ in bufstats? That is a place to start maybe? It does exactly what I understand you are trying to do, but I might be wrong…

It is a good place to start I agree, but the example starts to scale pretty wildly if you go beyond analysing one sample. It’s fairly guaranteed at some point I’m going to have to bufcompose~ analysis from bufstats~ to somewhere else, which over many samples and slices is going to result in a lot of temporary memory being made just to copy things away. I’m going to try make something somewhat to my needs and post back here when its working - but atm conceptualising beyond a single sample starts to get really massive.

1 Like

Good luck. I can help with brainstorming, for instance each slice could be defined in any data structure (coll or dict) and appended to each item could be its descriptors you need and retrieve… except if you want to run stats on samples from various buffers as one item, in which case bufcomposing the source is probably more simple, but again the strength of the current design is that is allows you to experiments with your creative coding intuitions… su go for it and report when you’re stalled, your task might become clearer as you explore it, if you see what I mean.