-
Notifications
You must be signed in to change notification settings - Fork 47
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
Adding audio level stat that can be used to compute averages. #221
Conversation
webrtc-stats.html
Outdated
for each audio sample sent/received for this object (and | ||
counted by <code><a>totalSamplesSent</a></code> or | ||
<code><a>totalSamplesReceived</a></code>), add the square of | ||
the sample's value divided by the highest-intensity encodable |
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.
Is this too ambiguous? It's meant to mean square(sample/max)
, not square(sample)/max
.
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.
Is the expression below and the explanation in the text here in sync?
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.
My bad, I think I get what you mean.
The first paragraph is about how totalAudioEnergy is computed. And the second paragraph is how it could be used by an application.
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
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 think it's clear but you could clarify with a formula at the end of the sentence, (sampleEnergy^2/maxEnergy)*sampleDuration.
56169e8
to
c531b2e
Compare
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
webrtc-stats.html
Outdated
for each audio sample sent/received for this object (and | ||
counted by <code><a>totalSamplesSent</a></code> or | ||
<code><a>totalSamplesReceived</a></code>), add the square of | ||
the sample's value divided by the highest-intensity encodable |
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
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 % nits
<code>Math.sqrt(totalAudioEnergy/totalSamplesDuration)</code> | ||
becomes <code>Math.sqrt(0.0026/0.02) = 0.36</code>, which is | ||
the same value that would be obtained by doing an RMS | ||
calculation over the contiguous 20ms segment of audio. |
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: Can you change this example to include two getStats calls so that people don't get confused about where to do the sqrt?
webrtc-stats.html
Outdated
This can be used to obtain a root mean square (RMS) value | ||
that uses the same units as <code><a>audioLevel</a></code>, | ||
using the formula | ||
<code>Math.sqrt(totalAudioEnergy/totalSamplesDuration)</code>. |
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: Can you also have the RFC reference here? (Same as the audioLevel reference)
webrtc-stats.html
Outdated
for each audio sample sent/received for this object (and | ||
counted by <code><a>totalSamplesSent</a></code> or | ||
<code><a>totalSamplesReceived</a></code>), add the square of | ||
the sample's value divided by the highest-intensity encodable |
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 think it's clear but you could clarify with a formula at the end of the sentence, (sampleEnergy^2/maxEnergy)*sampleDuration.
@taylor-b if you can make the changes (and merge) in the forthcoming days, I will make a new editor's release. |
Fixes w3c#220. It's slightly different than most of the stats of this sort, since the application needs to compute "sqrt(a)/b", not just "a/b". But the concept is the same.
This now takes a sample's duration into account when adding it to `totalAudioEnergy`, which prevents higher-frequency samples from being weighted more significantly than lower-frequency samples.
33f6d86
to
61b82d1
Compare
Updated and fixed merge conflicts. |
Fixes #220.
It's slightly different than most of the stats of this sort, since the
application needs to compute "sqrt(a/b)", not just "a/b". But the
concept is the same.