Periodogram of my audio file gives magnitudes only below zero

3 views (last 30 days)
I downloaded a sample of 3 seconds (you can find it here) and tried to plot the periodogram using a MATLAB code I downloaded:
%% get a section of the sound file
[x, fs] = audioread('sample-3s.wav'); % load an audio file
x = x(:, 1); % get the first channel
N = length(x); % signal length
to = (0:N-1)/fs; % time vector
%% plot the signal spectrum
% spectral analysis
winlen = N;
win = blackman(winlen, 'periodic');
nfft = round(2*winlen);
[PS, f] = periodogram(x, win, nfft, fs, 'power');
X = 10*log10(PS);
% plot the spectrum
figure(2)
semilogx(f, X, 'r')
xlim([0 max(f)])
grid on
set(gca, 'FontName', 'Times New Roman', 'FontSize', 14)
title('Spectrum of the signal')
xlabel('Frequency, Hz')
ylabel('Magnitude, dBV^2')
Here is the result:
I can't figure out why the decibel scale goes below 0. It would mean that I could not hear any sound of the track since 0 dB is the threshold of a hearable sound by the human ear. Yet, I can hear this sound very well on my computer. Can someone explain me why please ?

Accepted Answer

Star Strider
Star Strider on 19 Mar 2023
That you can hear it simply means that the sound card is scaling it and amplifying it. (I have no idea what the actual amplitude is, since neither the signal itself nor the time domain plot are provided.) If you use the sound and then after it finishes, the soundsc functions in MATLAB, you can likely expect different results, with the first producing something that may be barely audible, and the second scaling it to produce a distinctly audible sound.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!