-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fluid.bufstats~
should treat a buffer of zeroes like any other equal values
#308
Comments
I closed #198, but posted this code example there. Basically there's audio you can't analyze unless you build in some edge-case detection stuff around the objects. ----------begin_max5_patcher---------- |
I've said a couple of times now that the reason the object squawks on all-0-weights is that there isn't a sensible default action to take that covers all cases because those numbers could be anything, and a sensible thing to do ends up being task dependent. So we have to leave the responsibility to the caller to either avoid it or decide what to do. If you want to convince us to change it, then we'll need a proposal for a sensible default that would make sense in a very wide range of situations, not just one. As for whether this is an edge case when dealing with loudness data, I don't think it is: it's inherent to using loudness as a control source that silent frames need to be safely dealt with. I can't think of anything I've done with loudness that hasn't needed this to be handled. If all you need in this case is for silent frames to be unweighted rather than ditched, then add |
I'm struggling to think of a case where having the object throw up an error and dump out dummy values is beneficial. Is there a type of weighting where having zeros treated as "all values are equal" would be bad, or even a less-than-ideal? The main (only?) use cases for having weights as inputs I can think of are loudness weighting (the main reason the object was created if I remember right) and pitch confidence. In either of those cases if your loudness/confidence are zeros (loudness more clearly so), the object should just pass on the stats unweighted as at the moment it spits out zeroes (which for loudness would be "pretty loud"), which would actually be bad data. Just imagining a similar UX for other objects like setting the |
These are by no means the only things one could use as weights, because the weights are simply some probability distribution-like bunch of numbers. They could be counts of some things, they could be the results of sampling some generative process. They could be arbitrary weightings tied to time indexes to reflect some domain specific knowledge the coder has about their data. Loudness and pitch confidence were certainly motivating uses, but the weights were added as a general mechanism that happened to allow those specific things. All it requires is that the numbers in the weights can be made to sum to 1. So, all 0s and things that cross the 0 boundary are bad and require the caller to do some extra work reflecting their knowledge of the task at hand.
Or very quiet, depending on the loudness units. Which bufstats~ can't know.
This is beginning to feel needlessly snarky for something where you can literally get the behaviour you want by changing a single attribute value upstream. |
So we can agree that when weights of zeros come in that that is problematic. The current solution is to spit out zeros as the output (regardless of the input), which I'm arguing would never be a preferable alternative to just spitting out the stats with no weights applied (another (IMO) "valid" interpretation of the weights). At minimum, I would think that the current implementation would be such that a red warning should be issued and no output should be passed since that is more in line with the philosophy of the implementation: "there is a problem". That was a post-flight late night post, so I appoligize for coming across extra sassily. |
I'm much more amenable to treating it as an error, and it turns out that on its first commit, that was indeed what happened. I think it changed because without (yet) having programmatic error handling, it was deemed too disruptive to doing big batch analyses (though spitting out junk instead doesn't really delight me any more than it does you). So, for me this bumps the need for programmatic error handling up the queue somewhat (because we have a motivating example), and once that's in place it's easy enough to justify just treating this as an error instead. |
❤️ |
As discussed in #198, there is a use case when loudness-weighting descriptors and analyzing digital silence where
fluid.bufstats~
throws up a yellowInvalid Buffer
error message.I'm of the opinion that this is an engineering problem rather than a user problem where what the user is asking for (in this case, loudness-weighted descriptors) creates a technical edge case that they shouldn't have to think about (similar to rounding numbers for fft sizes, or scaling the internal envelope follower in ampslice so it doesn't start at negative infinity etc....).
I can't read through the code well enough to determine whether this is the case, but I would be surprised if AudioGuide/IRCAM approaches to loudness-weighting throw up similar errors when presented with digital silence.
The text was updated successfully, but these errors were encountered: