Sampling frequency dependent SPL for imported files

greatadrian

New Member
Thread Starter
Joined
Sep 4, 2017
Messages
19
Hi,

I've encountered a weird behaviour when importing an impulse response to REW. The issue is that if exported wav IR is being downsampled externaly, after importing it back to REW gain values are off. It looks like REW is scaling the levels based on the sampling frequency.

In order to allow for easier reproduction, I will use a generated sine waves instead. All of those will have the same level.

Code:
sox -n -t wavpcm -r48k sine_48k.wav synth 10 sine 1000 gain -0.1  # generate a 1 kHz sine @ 48 kHz
sox -n -t wavpcm -r16k sine_16k.wav synth 10 sine 1000 gain -0.1  # generate a 1 kHz sine @ 16 kHz
sox sine_48k.wav -t wavpcm sine_16k_resampled.wav rate -v -s 16k  # resample from 48 kHz to 16 kHz


Now I would expect those to have same level on the SPL plot, what I am getting instead is:

frequency_response.jpg


It looks like levels are dependent on the sampling frequency:

48 kHz: 78.4 dB
16 kHz: 68.9 dB

The difference is approximately 9.5 dB.

When I plot the time domain signal using the Impulse overlay, I am getting the right levels at -0.1 dBFS:

time_domain.jpg


Here is a deeper analysis for IR I've measured (unfortunately I can't attach a wav file).
The original recording is at 44.1 kHz and I used sox to change the sampling rate:

Code:
sox ir_44k.wav -t wavpcm ir_##k_resamp.wav rate -v -s ##k

Here is the all SPL plot for all those recordings imported in REW:


frequency_response_ir.jpg


The next thing I did was:
- Extracted dBFS levels for 1 kHz from each of these frequency responses
- For each fs calculated dB difference between 44.1 kHz level
- Calculated 20*log(fs/44100) and correlated it with the level differences

Jackpot!

Table with levels:

table.PNG


Lastly, here is a plot of 1 kHz levels vs sampling frequency together with a logarithmic trend line (x-axis is log):

plot.PNG


I hope that this will help you John to narrow down the issue. Maybe dB values are scaled by a value independent of sampling frequency? If you have any more questions, I am more than happy to help.
 

John Mulcahy

REW Author
Joined
Apr 3, 2017
Messages
7,314
It is being affected by FFT length rather than sample rate per se, but it is expected behaviour. If you imported the files as audio data rather than as impulse responses you would see they load showing the same SPL as each other, and the same as they would show on the RTA. Impulse responses are treated differently, as a consequence of trying to capture not just the transfer function but also the level it is measured at.

Nominally a device that doesn't alter the signals passing through it would have an IR with a single sample of value 1.0, but then it wouldn't be possible to see what level that was measured at. REW scales the IR so that a 1.0 impulse would only happen if the measurement was made at digital full scale, a measurement at -12 dBFS (say) would have a correspondingly scaled down IR. If an measurement is made, the IR exported as WAV (without normalisation) and then imported again it would show the same level as the original. Changing the sample rate before re-importing will alter the levels, because if the same system bandwidth was captured at a higher rate by REW the impulse peak would be lower to preserve the same overall energy (there will be more samples within the peak region). There are other ways that could be handled, changing the SPL data offset for each measurement, for example, but that makes life awkward for the SPL scaling.
 
Top Bottom