Scaling an audio signal to a given rms-in-dB value

7 views (last 30 days)
I need to scale a given audio signal to a given acoustic rms-amplification (60dB) and a given base acoustic pressure (p0=20*10^(-6)). How to do this?
What I've tried so far:
signal=audioread('signal.wav');
RMS_signal_dB = 20*log10(rms(signal)/p0)
% Amplification difference to 60dB
Diff_signal_dB = 60 - RMS_signal_dB;
% Compute factor
Diff_signal = p0 * 10^(Diff_signal_dB/20);
% Scale
new_signal = Diff_signal*signal;
% New value on 60 dB?
new_RMS_signal_dB = 20*log10(rms(new_signal)/p0);
end
The new rms amplification value differs from 60 dB... Could be a mathematical fault, maybe someone can help. Thanks!

Answers (0)

Categories

Find more on Simulation, Tuning, and Visualization in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!