Edge cases in analysis frames

Revisiting a pretty old subject here, but in searching on the forum, it doesn’t look like any of it took place on here.

Back at the second plenary there was a bunch of discussion between @tremblap, @a.harker, @weefuzzy, and myself about what to do when you’re analyzing a small number of samples and want the best representation of what’s in there.

As a point of reference, I’m talking about analyses like these:
@windowsize 256 @hopsize 64 @numframes 256

So in a situation like this, you are returned with only 7 analysis frames. So taking the vanilla mean from fluid.bufstats~ probably isn’t enough to remove the impact of the edge cases here, particularly since the only option here is zero-padding.

The intended use case here is that I’m trying to shorten the ‘onset descriptors’ analysis window down to 256 samples instead of 512, since I’m now doing some extra analysis stuff, and further post-processing. At the best of times my latency here is ca. 11ms, but now it’s getting closer to 15ms+, which starts feeling laggy.

From my vague recollection, what is “best” (generally speaking) varies on the type of descriptor in question.

For centroid, I believe mirroring (vs zero-padding) can be better because it keeps the spectral emphasis more-or-less in the same place (though that’s not possible here). For something like pitch, throwing out the outer frames is desirable(?) since you don’t know what is in there. For loudness doing something similar to avoid overly weighing the “zeroes” that surround the analysis window.

Is this about right?

I’m not sure why this is the case, but in my patches from around the second plenary (which I’ve just tweaked as we’ve carried on) I’ve been keeping the first 7 frames loudness (although from 512 samples, so 7 out of 11 frames), and frames 3-8 for spectral moments (again, out of 11).

So that doesn’t really line up with my memory of stuff (hence this thread, and generally inquiry). The spectral moments “middle frames” makes sense, but not sure why I would only take the first frames of loudness. I guess to try to capture the initial “oomph” of the sound only? With only 256 samples it’d be all “oomph” I suppose.

Do MFCCs and mel-bands fall into the spectral descriptors thing, where it would (perhaps) be better to grab the central frames?

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Another thing that occurred to me is that I may want different amount of frames for different statistics. Maybe for the mean it would be good to be more selective about the frames to not overly weigh it towards the zero-padding, but perhaps I do want the zero-padding-ness for the derivative, since that may capture more of what the actual morphology of the analyzed segment was?

I guess I can always ‘double dip’ the fluid.bufstats~-ing by taking some stats from the whole window, and other stats from just the middle etc…

I’ve found that on small windows it is so signal dependant that I have to test. Sorry for the ‘it depends’ answer but that is the most truthful. The best way to test I found is to test values with expectations. If I do something pitchy, and something noisy, what do i get value-wise. Some of these examples are in the Max helpfiles as demo (for instance bufpitch granulator on confidence).

So far, in comparing the results from the 512 version and the 256 version (doing frames 3-6 instead of 3-8 for spectral descriptors) appears to be about the same.

Am I correct in assuming that for all the spectral descriptors, with such short windows, that throwing out the outer frames will be better, since you otherwise risk pulling the stats down towards zero(padding)?

The statistics (derivative/deviation) tend to be pretty wildly different, but that doesn’t seem far fetched to me since it’s a different and shorter time-frame at play.

It doesn’t hurt that with loudness I was only doing the first 7 frames before (@512) and now I’m analyzing all 7 frames (@256).

So I guess the overall thinking is focusing on the frames you think will be important and testing from there?

indeed. For instance: I’m editing right now in Premiere and even there, super high level, you have the option for blurring on what to do with the edge cases (mirror or zero-pad - although the latter is not explained…)

I was about to make a new post, but discourse suggested this one and it was right!

So I built a patch to test some of this today.

For context, I’m working on the onset descriptors idea where I have a 256 sample analysis window which I’m running with @fftsettings 256 64 512. This gives me 7 frames of analysis, which I was then feeding frames 3-6 (@startframe 3 @numframes 3) into fluid.bufstats~, to avoid having the zero-padding on the edges muck about the spectral descriptors.

Since there’s no option to select what happens with edge cases in the fluid.verse~, I’ve “manually” mirrored the edges using fluid.bufcompose~. It’s a bit ugly and a bit slow, but it (appears to) work.

The patch below compares the original version of looking at only the middle 3 frames, with the version which mirrors the outer frames and then analyzes “all” 7 frames.

Don’t really know how to properly assess how effective this is, so I built a thing where you can manually listen to each fragment and compare the results using an sfv~ filter.


----------begin_max5_patcher----------
7231.3oc6ck9iaibk+y1+UPnr.KvtsEp6ic+xjIGd.x3IyF6fAASBZPIwtMs
USpPQ018DD+29VEKJJRwqhREoTOy3.zCCOT8pe06pd0qp2+5kuX1h3OGrcl2
+i2O58hW7ud4KdQ1sz23E4++ewrG7+7x09aydsYKie3gfnzY2XdVZvmSytOc
t2hv68VEd2cAIAQKC7tKNwac7m7tKI3etScmPUCk+UqCiBVFuKJ6Sw42bSRv
V0ureZXb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snWGnaqx1XiIxQzSn2Up5gX+fRKkXYP
aiGSpon+5C8rvRSH79C9OFnOjgb3DFNYuGKpttmcmakexGeUj9b+3UYS2ef7
81Fu3ZUncKiTZKwffbnhFWrBMEqUiHq8cP30FRYH2IQkv4gVykKw3Gx2zW.P
91i2E+Tng3mIs0UzXw5.kNayZK90wwebVqKTQmQ8DzKi2gUbo1EtKPX1Qg+h
fkKL5iCTiDSW0pDEliw5JZDoGkQV7MMNu39+rA+90XWOrFDYuNt7U8aDwhlr
MF8ap7WGDnW6ooIT+63tHE8ZkyIhIezLmrePmZOWZmkVqckneWnOiZWW8hYp
jjmhHRIVvyuhKb5DDpTf2sVYjn5jc347hm6hh29.o6bLT2gKcTYXyDVyKryk
sVoY+gtdbnxQYayD1TlpAkRZf8YgQ8q5PWEWnyJsaZ7pIzv84jmZUkNraTr7
gUmsAcqTN847P.XN7h9506B1e.1YepzA44qE8AcXxxZtbIAlD+onASg8pa0g
T3u6I+gSf.jjZRcCNGiQ77pirx6G2SfuNIH3DnvdJdwNh3diRyVTp+fIOAAv
LUgU.C.MURSNSBkT2Si+kfUCl93EdtAKlUCH2hgqou+Vv50wepaRrdl1Qk.f
nqr2vhJeua6.nmicfrkunbo11dVDaJt4mMAtYWxl0mlyC7hro6PYmWnUCP6w
CUBv3XDhBXxLg.jfxPBW1uRBVFD9X2qbWS7DESL4PeBTNIRcCwcnBrasEeFQ
oPSlaHfmmovT8Y4cmn8zvEsMHZ01qMKH0Ky8tS1qwrE1lxZ+Y2qJJe8sqGrq
RVuCZ+FJM8Vv+ZYIU+jJE8NqSkdRKZjsSU2E3gUkW9yGOJJi7WI6WfxkGdaH
oxkD99KG7mWof+bKC7mSIfeX.qYqy0RoJ3k+6W9+Ce2TxvB
-----------end_max5_patcher-----------

If someone knows of a better way to assess this, I’m all ears!

For the most part the results are very close. The biggest difference I’ve found (so far) is when the analysis frame has a low of low frequency energy. For some reason the version without the mirroring seems to capture that more. Don’t know if this a result of the windowing being more present in the mirrored version, which (somewhat) pulls the centroid up.

Also wish there was a way to reverse things with fluid.bufcompose~, since I have to manually copy each individual sample over. The mirroring part of the patch takes around 0.15-0.3ms, which isn’t slow, but I’m hesitant to add another bit of latency to the patch unless the results are kickass. I can also manually peek~ / poke~ the individual samples in, but not sure that would be any/much faster.

1 Like

This is essentially a question about what data is represented and how it is weighted.

With zero-padding the edge values are biased by the zero-padding in a manner that is dependent on the descriptor.

  • For spectral shape, as long as you have enough data in the window the biasing will come from the sharp onset that has been induced in the sample.
  • For pitch it can really mess up the measurement and it’s hard to predict how that will happen
  • For loudness etc. it may be less problematic, but you are biasing towards zero

To counter this - if you have a segment of audio that is very loud in the first few samples, then windowing that may significantly affect the result, so if you only start your window at the edge of the audio you are discarding useful data. These situations might be considered as different for streaming situations (analysing in chunks) rather than a file where the start is meaningful. You have to be careful that you are not throwing data away, or biasing it to induce error.

Mirroring or folding (I’m drawing a distinction between repeating the edge sample or not) or wrapping (reading modulo) can reduce some of these issues in that all frames are now full, and full of the original dat - however, you’ve now repeated samples to do so and therefore weighted those samples more highly in your estimates.

1 Like

Indeed, it’s quite pickle-y of a situation.

Based on my (fairly superficial) understanding, I like the idea of zero-padding for loudness, even though it creates “fake” data by isolating a window, but for my purposes that’s probably the better choice. The spectral ones are where I was hoping to improve things, and it looks like for my example I mirrored (duplicating the start/end frame (or is that folding?)).

As you point out, however, that overly represents those in the analysis, but perhaps that’s less problematic with loudness-weighted descriptors.

I hadn’t really considered what it would mean for pitch though, as that seems like a weirder one in terms of behavior.

I use mirror for when you repeat the edge sample (like holding a mirror at the end) and fold for when it doesn’t repeat (like folding a cloth back and forward - there’s a single edge point) - but that may simply be my terminology.