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
PeriodicWave constructor examines lengths of things that might not be there #2147
Comments
Put another way: there is no way to implement this part of spec right now based on just reading the spec, without reverse-engineering another implementation. That is not a desirable property for specs... |
I guess maybe the intent is that https://webaudio.github.io/web-audio-api/#dictdef-periodicwaveoptions describes what should happen when those members are missing? But that's a really weird comefrom-like way to write a spec, and still doesn't explain what step 4 is trying to do with taking the maximum. |
Teleconf: We'll rewrite this. I think the intent was if both arrays are given they have to have the same length. |
I think this is how we want this to work.
Probably want to remove some of the text from the description of the members of |
For what it's worth, this can't happen. It has a default value (empty dictionary), so it's always "given".
Should this case allow length 0 or length 1?
That sounds perfect, thank you! |
Oh, and "present" is the spec term for dictionary members whose value was provided. |
Thanks for your comments. Length 0 isn't really useful but could be spec'ed to produce 0 always. Length 1 isn't really useful because that represents the DC term, which is always ignored. So you'd always get 0 output here too. There are easier ways to produce 0-output. I'll write up a PR for this soon. |
Just to be clear, in the proposal above we disallow this if only one of real and imag is provided but allow it if both are provided; I was just checking whether that's intentional. |
Sorry I misunderstood. I think the length must be 2 or more in all cases. |
Cleans up the constructor for PeriodicWave based on the algorithm given in WebAudio#2147 (comment). A few other minor cleanups in the algorithm description were also done: * Move declaration of `[[real]]`, `[[imag]]`, and `[[normalize]]` to the beginning of the algorithm. * Remove extra text for the members of the `PeriodicWaveOptions` to the algorithm so that everthing is all in one place.
https://webaudio.github.io/web-audio-api/#PeriodicWave-constructors says (step 2):
but those parameters might not be present at all. Is this meaning to only compare the lengths when both are present? Or does being not present correspond to a length of 0? The text here needs to be a lot more explicit about what should happen.
Then step 4 says:
but the two things passed in must be the same length per step 2. Again, unless being missing means skipping the length check. But then what does the "maximum" mean if one of the lengths does not exist? If both lengths do not exist?
There's something in step 3 about the "options has not been passed in" case, which can't happen, because
options
has a default value, so it's always passed in. It may or may not havereal
andimag
present in it, of course, whether it's the default value or an explicit value passed from script.The text was updated successfully, but these errors were encountered: