Confused about dB in MATLAB

10 views (last 30 days)
Mohammad
Mohammad on 31 Jul 2013
Hi;
I am fairly new to dB manipulations and I am getting really confused with it.
So if I produce a tone in MATLAB like this:
Fs = 16000;
duration = 60;
level = -2;
freq1 = 500;
t = 0: 1/Fs : duration*(Fs-1)/Fs;
fa1 = 10^(level/20);
y1 = fa1*sin(2*pi*freq1*t)';
sound(y1,Fs);
The dB level the user needs to input is in dB-full scale because the sound is being produced digitally correct?
So if I measure the sound using a dB sound meter, which measures the level in dB-SPL, I should be getting the max dB-SPL at 0 dB-full scale correct?
However, if I go down to -6dB-full scale, the dB-SPL goes down by 10dBSPL.
How can I modify the code such that -6dB-full scale causes the dB-SPL to be reduced by 6dBSPL.
I hope I did not confuse any one lol.
NOTE: my speakers are at MAX level
Thank you very much. Ali

Accepted Answer

Daniel Shub
Daniel Shub on 31 Jul 2013
Depends what you mean by full scale, but yes. As for what could cause a 6 dB reduction in input to give a 10 dB reduction in output there a a couple of things. Running at full scale for the soundcard and amplifier is probably not a good idea and can lead to nonlinear behaviour. Your sample rate of 16 kHz is unlikely to be the native sample rate of your soundcard. You are making a mono signal, but MATLAB converts it to a stero signal. Can you speaker handle this? Are you using your sound level meter correct?
I would connect the soundcard output to a volt meter and confirm with that.
  1 Comment
Mohammad
Mohammad on 31 Jul 2013
Hi; Thanks for replying. Yeah the issue is with playing the sound at MAX level. If I play it at half the max it works just fine.
Thanks again.

Sign in to comment.

More Answers (0)

Categories

Find more on Measurements and Spatial Audio 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!