-
Notifications
You must be signed in to change notification settings - Fork 169
Update the text to reflect the resolution on GC observability #1810
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass. Overall, it looks good but I have few comments.
index.bs
Outdated
@@ -2581,6 +2581,37 @@ value explicitly. <em>block-size</em> is defined to be 128 | |||
sample-frames which corresponds to roughly 3ms at a sample-rate of | |||
44.1 kHz. | |||
|
|||
<h4 id="AudioNode-tail">AudioNode tail-time</h4> | |||
|
|||
An {{AudioNode}} can have a <dfn>tail-time</dfn>. This means that even when the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this can be:
All AudioNodes have a tail-time. When an AudioNode has a tail-time greater than zero, it can produce non-silent output even when it has silent input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm rephrasing this. I'm not a fan of saying that all nodes have X, but X has no consequences for most of the nodes.
index.bs
Outdated
|
||
<h4 id="AudioNode-actively-processing">AudioNode lifetime</h4> | ||
|
||
{{AudioNode}} can be <dfn id="actively-processing">actively processing</dfn> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this can be:
An AudioNode accessed during a render quantum is referred to as actively processing. When an AudioNode is not actively processing, it MUST generate a single channel of silence as an output. This state of "actively processing" varies on the type of AudioNodes:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find this to be too vague. When we're checking whether an AudioScheduledSource
is supposed to write something in its output, we're somehow accessing it, aren't we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then how about "being rendered" instead of "accessed"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a definition, this sentence basically ends without defining what actively processing. Maybe say that it's actively processing if the any of the following conditions hold? This probably also means that the links to "actively processing" shouldn't be links.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
index.bs
Outdated
|
||
<h4 id="AudioNode-actively-processing">AudioNode lifetime</h4> | ||
|
||
{{AudioNode}} can be <dfn id="actively-processing">actively processing</dfn> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then how about "being rendered" instead of "accessed"?
index.bs
Outdated
|
||
<h4 id="AudioNode-actively-processing">AudioNode lifetime</h4> | ||
|
||
{{AudioNode}} can be <dfn id="actively-processing">actively processing</dfn> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a definition, this sentence basically ends without defining what actively processing. Maybe say that it's actively processing if the any of the following conditions hold? This probably also means that the links to "actively processing" shouldn't be links.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @padenot for writing this up. This captures what I had in mind.
index.bs
Outdated
- All other {{AudioNode}}s start [=actively processing=] when any | ||
{{AudioNode}} connected to one of its inputs is [=actively processing=], and | ||
stops [=actively processing=] when the input that was received from other | ||
[=actively processing=] {{AudioNode}} no longer affects the output. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Referring to the tail-time is fine with me if that's clearer. See my comment on tail-time for an attempt to more clearly describe this there. We need to be a little careful to avoid the two definitions becoming too cyclic.
"the input that was received from other" is no longer required if using tail-time. Perhaps:
"When there are no longer any actively processing AudioNodes connected to its inputs, an AudioNode continues actively processing for the length of its tail-time. The AudioNode stops actively processing when its tail-time expires before it again has any actively processing AudioNodes connected to its inputs."
I've addressed all comments, often with something based of off @karlt's suggestions. |
This is now green on travis, but I pushed this before pushing the workaround in 354a193. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still looks really good. Just some minor comments and some corner cases I think we need to consider.
that is <code>true</code>. | ||
- A {{DelayNode}} in a cycle is [=actively processing=] only when the absolute value | ||
of any output sample for the current [=render quantum=] is greater than or equal | ||
to \( 2^{-126} \). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a really, really tight constraint. Let's say you have a biquad filter in the loop. It's possible, due to round-off that the biquad never produces 0 output for 0 input.
Not sure if this is achievable in practice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder whether you may have missed my reply to your previous comment about this.
#1810 (comment)
The reason for choosing FLT_MIN here rather than FLT_TRUE_MIN is that the output does not need to reach zero.
Because full precision is available at FLT_MIN, the round-off occurring with values around FLT_MIN is similar to round-off at larger values. If the decay (biquad or other) is such that input of any magnitude will attenuate, then values around FLT_MIN will attenuate. After values around FLT_MIN attenuate, the cutoff is passed and the node outputs a single channel of silence.
Regardless of the value of the cutoff, perhaps there may be a chance of instability due to the sharp gradient at the cutoff if a biquad does not attenuate that sufficiently. I don't know whether or not the output from such a biquad would decay to zero without the cutoff. Even if the cutoff is introducing some new instability, it would be preferable that any remaining non-zero output from this corner-case would be determined by the precision of float32 rather than an arbitrary cutoff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is acceptable to me. I still find the constraint very tight. Does Firefox stop a BiquadFilter tail when it reaches FLT_MIN? Chrome just estimates the tail time by computing when the impulse response is about 60 dB down (I think). Even then, there are filters whose tail time is in the thousands of seconds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't say RT60 is an arbitrary cutoff. It is considered the industry standard for reverberation decay. I think it has been accepted as a reasonable threshold for "perceptually inaudible" sound.
Can we make it up to UA? I think the numeric difference between RT60 and FLT_MIN is quite significant, but the audible difference would not really big. In that case, UA might be able to try different optimization techniques to improve the rendering performance.
- All other {{AudioNode}}s start [=actively processing=] when any | ||
{{AudioNode}} connected to one of its inputs is [=actively processing=], and | ||
stops [=actively processing=] when the input that was received from other | ||
[=actively processing=] {{AudioNode}} no longer affects the output. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"no longer affects the output" is rather vague. Say you have a constant source with a constant value of 1 that is actively processing. Say a 4x WaveShaper follows the source and the wave curve is the identity, more or less.. After a while, the constant source no longer affects the output because it too is a constant. Does this mean the WaveShaper is no longer actively processing? If so, the sentence below says it must output a single channel of silence. That would be wrong since it should continue to output a constant value.
Perhaps we should say it stops actively processing if the inputs are not actively processing and the tail-time has passed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The input affects the output, because if the input were to stop or change in value, then the output would change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if I have a gain node with a gain of 0? The input doesn't affect the output.
I'm not sure, but maybe what I'm looking for is that a nodes stops actively processing when all inputs are no longer actively processing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a bunch of nits
- All other {{AudioNode}}s start [=actively processing=] when any | ||
{{AudioNode}} connected to one of its inputs is [=actively processing=], and | ||
stops [=actively processing=] when the input that was received from other | ||
[=actively processing=] {{AudioNode}} no longer affects the output. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if I have a gain node with a gain of 0? The input doesn't affect the output.
I'm not sure, but maybe what I'm looking for is that a nodes stops actively processing when all inputs are no longer actively processing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions for clarification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor nits. Otherwise I'm happy with these changes once the nits are fixed.
index.bs
Outdated
@@ -2785,6 +2785,52 @@ enum ChannelInterpretation { | |||
</table> | |||
</div> | |||
|
|||
<h4 id="AudioNode-tail">AudioNode tail-time</h4> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Maybe capitalize as "AudioNode Tail-Time".
index.bs
Outdated
may continue to produce non-silent output for the calculated tail-time even | ||
after the input transitions from non-silent to silent. | ||
|
||
<h4 id="AudioNode-actively-processing">AudioNode lifetime</h4> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Capitalize as "AudioNode Lifetime".
index.bs
Outdated
@@ -4034,6 +3999,11 @@ the source MUST then output silence (0). | |||
{{AudioScheduledSourceNode}} cannot be instantiated directly, but | |||
is instead extended by the concrete interfaces for the source nodes. | |||
|
|||
An {{AudioScheduledSourceNode}} is said to be <dfn>playing</dfn> when | |||
its associated {{BaseAudioContext}}'s {{BaseAudioContext|currentTime}} is | |||
greater or equal to the time it's set to start, and lesser than the time it's |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"it's set to start" -> "AudioScheduledSourceNode is set to start"
"lesser than the time" -> "less than the time"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a nit.
that is <code>true</code>. | ||
- A {{DelayNode}} in a cycle is [=actively processing=] only when the absolute value | ||
of any output sample for the current [=render quantum=] is greater than or equal | ||
to \( 2^{-126} \). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't say RT60 is an arbitrary cutoff. It is considered the industry standard for reverberation decay. I think it has been accepted as a reasonable threshold for "perceptually inaudible" sound.
Can we make it up to UA? I think the numeric difference between RT60 and FLT_MIN is quite significant, but the audible difference would not really big. In that case, UA might be able to try different optimization techniques to improve the rendering performance.
The issue here is that there can be arbitrary processing after the delay, including very high gain, unlike a normal reverb. Any difference can be amplified to a point where it's really different. |
This is largely based off of @karlt's prose, with minor adjustments, and fixes a bunch of things. The commit that is the most important is the second one.
This fixes #1471.
Preview | Diff