-
Notifications
You must be signed in to change notification settings - Fork 12
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
Implement meaningful error for Float -asHoaOrder ? #119
Comments
We might consider a test like
If fractional orders make sense in other contexts (analyzing effective decoder orders, for example), there may need to be more plumbing involved to isolate cases where fractional orders are not allowed. |
Hm... I like the idea of accepting float representations of (integer) order as general, but I also remember that comparing equality of floats is generally not a good idea. Maybe something along the lines of what if((myFloat - myFloat.asInteger).abs <= someSmallNumber) {^myFloat} {error("Fractional orders aren't supported")} Actually... looking at this I see that HoaOrder can be instantiated with a float: HoaOrder(1.2); // no error Of course it would error out later on when trying to access other methods. With this in mind, I think that it would be better to move the check for float to |
good idea! I suppose the rest of the implementation question comes down to the fundamental question: should HoaOrder support |
Somewhat relatedly, we have used float tolerance elsewhere: atk-sc3/Classes/Tests/AtkTests.sc Line 58 in 94b3360
Maybe we should promote this value to an Atk class var? |
Just to be clear, I'm not saying it should support it necessarily, but if it won't work properly with a float (i.e. the current situation), it should check for it at the initialization time... |
Yep, you're right to point out the inconsistency between instantiating I'm suggesting that we might want to support fractional/float orders, but I haven't thought much about use cases for fractional orders. If the use cases are few, then maybe it's supported only in those contexts (effective decoder order, as mentioned before, or franctional-order beam patterns). |
I think that's good, and IMO this future direction would also support my suggestion to check for float inside |
Argh! Thanks @dyfer ;-) Actually, this brings up a few things to consider that can probably be divided into practical / theoretical AND authoring / analyzing. On the practical side, for instantiating HOA streams, we can only have integer orders (in terms of number of coefficients... weighting is another matter... see below). Theoretically, these directly relate to a boxcar, e.g., truncation, windowing. In our practical system, we want to know how big the signal set should be, so having a check for @dyfer's original error would be a good idea:
OK, so you asked for it ;-) Having a closer look at
whereas:
Where the latter fails makes good sense:
Where the latter succeeds makes some sense (if you know what you're doing):
I believe I left in the ability to declare floating point fractional orders as a way for expert users (actually, me) to have access to rule of thumb comparisons when designing crossovers, frequency dependent radial filters, etc. More theory... In practice, the idea of fractional orders are not super standardized in a general way... which makes some sense, as what we're really doing is smoothing in the spatial domain. What we're really talking about is different kinds of LP filtering of the SH. We DO have two standardized LP frequency independent (truncated, fractional order) filters:
We ALSO have some specialized LP frequency dependent (fractional order) filters. These are the focalisation filters:
More practice... If there is a limited use for expert users to instantiating a fractional instance of And... my assumption was that novices would never go into the deep water. So... some possible solutions:
|
Thanks @joslloand
Either would be fine, with different caveats/amount of work. I'd also suggest a possible 3rd option (not necessarily better, but different): |
@dyfer, I'm feeling an If moved to
More verbose is fine for expert users, though!! As an aside, by adding an Another side thought, while it would be great to support mixed orders (another kind of fractional order) like the ADT does for decoding, practically this is a headache best left to the ADT!!! |
Again, not necessarily a better option, but we could consider having
Cons:
|
Having been away from SC for a while and returning now, I have to say the proliferation of method arguments or state flags to fork functionality doesn't feel great (looking back at some of my more elaborate class methods) making future development more cumbersome, especially with experimental/expert functionality like fractional orders. Distilling a bit here, we know now that fractional/tapered orders is something to support. Am I correct that an implementation as @joslloand's helpful theory discussion points toward a division of instantiating stream channels and beam pattern design... For example, a new method could be added:
Not yet a fully flushed out idea, but seems like it's a good direction? |
Relatedly:
|
In case when one miscalculates the number of parameters in
Hoa*
ugens, one might pass a float to theorder
argument. The resulting errorERROR: Message 'asHoaOrder' not understood.
was confusing to me at first.I'm not saying that floats should be allowed (e.g. using
.asInteger
), since this could lead to silently erroneous behavior. However, I was wondering if-asHoaOrder
could be implemented forFloat
s to throw a more meaningful message? (likeHoaOrder needs to be an Integer
).Example:
Result:
@joslloand I'd be happy to submit a PR adding an Error message for
Float -asHoaOrder
if you think this is a desired feature.The text was updated successfully, but these errors were encountered: