Difference in dBFS with a WebAudio Worklet

jvanriel

Registered
Thread Starter
Joined
Oct 24, 2024
Posts
9
Hi,

I'm comparing dB FS and db SPL input readings between a Web Audio application that I'm developing and REW.
There is a big difference between the values I'm getting and what REW is providing.

Setup is :

* miniDSP E.A.R.S Gain: 18dB with calibration files.
* An M-Audio Headset
* REW v5.40 Beta 57 (using the API to read FS and SPL) on MacOS
* Audio Worklet processor

class dBFSProcessor extends AudioWorkletProcessor {
constructor() {
super();
this.buffer = [];
this.bufferSize = 512; // Process samples in chunks
}

process(inputs) { // called every 2.67 milliseconds
const input = inputs[0];
if (input && input[0]) {
const samples = input[0];
let sum = 0;
for (let i = 0; i < samples.length; i++) {
sum += samples ** 2;
}
const rms = Math.sqrt(sum / samples.length);
const dbFS = 20 * Math.log10(rms); // denominator is 1.0
this.port.postMessage({ dbFS });
}
return true;
}
}

I'm sending a 1Hz sine signal to the headset at 96 db SPL (REW reading)

REW dbFS is -25.6 (stable)

My db FS is ~ -49 dBFS and ~ 88 dBSPL (fluctuating even with a 30 second window average)
Also using calibration files (but at 1Hz this is only 0.2 offset difference)
I'm using a fixed SPL offset of 135 for dbSPL calculation

Why would there be a dB FS difference (-25.6 vs -49) ?

Jan Van Riel
 
Depends what happens in process(inputs) to produce your sample values and how those values are scaled.
 
I'm making progress but not quite there yet:

There is a repo with code that I wrote to do various comparisons:

(I can't seem to create posts with URLs yet)

Repo on github
Under id jvanriel
repo name: levels

Note that I'm using the multi-channel version of REW.

There is a screenshot with results in folder results

There are still some pending questions as noted in the README and mostly related calculating dBSPL
  • Why is there a 3dB difference in dBFS readings with REW?
  • What is the fixed SPL offset that we should use?. Current default is 94.
  • What are we supposed to do with the sensitivity factor precisely?
  • Do we just add the variable (frequency dependent) offsets?
  • Is there other processing that should be done first such a filtering or weighting?
Note that I'm using REW with E.A.R.S to validate a medical application. I really need to understand exactly what is happening. I'm not a sound engineer but learning a lot from this process.

Thanks
 
See the View preference "Full scale sine rms is 0 dBFS", which determines whether the rms level of a full scale sine wave is show as 0 dBFS or -3 dBFS. The AES standard is to select this, but it conflicts with the mathematical definition of rms.

For a current UMIK-1 using WASAPI Exclusive or ASIO (meaning the Windows volume control is not applied) you can convert dBFS to dB SPL by adding a fixed offset:

offset (dB) = 94 + 24 - sens factor + 6

94 dB is the reference level used when the mic sensitivity was measured during manufacture. 24 dB is the UMIK-1 gain at maximum volume, used when the mic measurement was made. The 6 dB is an offset that may depend on how you have defined 0 dBFS and the scaling of your FFT. You may not need it or you may need a different figure.

The SPL offset does not depend on frequency.
 
Back
Top