Using AudioWorklet convert volume meter value into decibel
See original GitHub issueFirst, thanks for your sharing, I would like to know how to convert volume into decibel by using AudioWorklet. In your AudioWorklet volume meter example, I can get volume value. This link is the example I found https://github.com/GoogleChromeLabs/web-audio-samples/commit/7c109d7d21c24bfa031f843877837e36ea0028cb .
// volume need to * 100 to make sure value between 1 to 10
this._volume = Math.max(rms, this._volume * SMOOTHING_FACTOR) * 100;
// I would like to know is this the correct way to convert volume to decibel?
// My example is 16bits so I divided by 32767
const dB = 10 * Math.log10(this._volume / 32767);
Issue Analytics
- State:
- Created a year ago
- Comments:5
Top Results From Across the Web
How to get microphone volume using AudioWorklet
We need to communicate atleast from AudioWorkletProcessor to AudioWorkletNode the current value or for this example the volume to take any ...
Read more >Background audio processing using AudioWorklet - Web APIs
This article explains how to create an audio worklet processor and use it in a Web Audio application.
Read more >Web Audio API - W3C
Abstract. This specification describes a high-level Web API for processing and synthesizing audio in web applications.
Read more >Pro Audio Plugins | Decibel User Manual - PROCESS.AUDIO
Designed by award-winning engineers, Decibel features an extensive selection of meters in a completely customizable and resizable user interface.
Read more >Web Audio API - GitHub Pages
A ConstantSourceNode interface, an AudioNode for generating a nominally constant output value with an AudioParam to allow automation of the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This isn’t my area of expertise, so I could be wrong, but to get the “real” loudness in dB instead of just computing a ratio of current power to max power, I believe you need some reference measurement to know the relationship between the RMS of the actual sound pressure in pascals and the RMS of the unitless PCM data: https://en.wikipedia.org/wiki/Decibel#Acoustics. So unless you can ask your users to play some sort of calibration sound at a known fixed distance from the microphone or you know exactly what microphone they’re using and what the gain is and everything, you can’t know the absolute loudness.
I prefer to use AudioWorklet instead of using autoGainControl😅. Because I also have to manipulate float32 to int16…etc. I worked on an AI company and build ASR associated project. I know the reliability that you mention. Thank you.