Skip to content
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

RTCAudioSourceStats.audioLevel - what algorithm described in totalAudioEnergy? #757

Closed
hamishwillee opened this issue May 9, 2023 · 3 comments

Comments

@hamishwillee
Copy link

The spec on RTCAudioSourceStats.audioLevel says here:

The audioLevel is averaged over some small interval, using the algorithm described under totalAudioEnergy. The interval used is implementation dependent.

In totalAudioEnergy it is not clear what algorithm is meant? Is it that you expect user agents to calculate the value by doing something like: Math.sqrt((energy2 - energy1)/(duration2 - duration1)) using whatever duration they wish?

@hamishwillee
Copy link
Author

Since I'm here would it also be correct to assume that there is some kind of underlying accumulator for the associated audio source - so the RTCAudioSourceStats that you get on request will always be the same or greater than for the previous one for totalAudioEnergy and totalDuration?

The timestamp is just an indication of the point at which you sampled the underlying accumulator "thing".

@henbos
Copy link
Collaborator

henbos commented May 10, 2023

Is it that you expect user agents to calculate the value by doing something like: Math.sqrt((energy2 - energy1)/(duration2 - duration1)) using whatever duration they wish?

Yeah pretty much. I'm honestly not sure the implementations use the same algorithms in practise, but the idea is that this is a snapshot of something you could have calculated yourself over a short time interval

@hamishwillee
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants