The present code is a Matlab program for signal analysis of a given sound file. The analysis includes:
1) Options for:
- signal detrending;
- signal normalization.
2) Plotting of the:
- signal in the time domain (oscillogram);
- signal in the frequency domain (spectrum);
- signal in the time-frequency domain (spectrogram);
- signal in the time-quefrency domain (cepstrogram);
- amplitude distribution of the signal (histogram);
- autocorrelation function of the signal (correlogram).
3) Displaying of the:
- minimum and maximum value of the signal;
- standard deviation (RMS-value);
- mean value (DC-value);
- crest-factor Q;
- dynamic range D;
- autocorrelation time.
The code is based on the theory described in:
 D. Manolakis, V. Ingle. Applied Digital Signal Processing. Cambridge, Cambridge University Press, 2011.
 J. Benesty, M. Sondhi, Y. Huang. Springer Handbook of Speech Processing. Berlin, Springer, 2008.
 Хр. Живомиров, Д. Пламенова. Изследване някои параметри на аудио сигналите. Национална конференция с м.у. „Акустика 2012”, 12 Октомври 2012, Варна / Списание Акустика, ISSN: 1312-4897, год. XIV, бр. 14, стр. 89-95, 2012.
Hristo Zhivomirov (2020). Sound Analysis with Matlab (https://www.mathworks.com/matlabcentral/fileexchange/38837-sound-analysis-with-matlab), MATLAB Central File Exchange. Retrieved .
thank you very much for your code.
Thank you for your interest on my submission!
(1) The amplitude could be transformed in dBV using the expression xdB = 20*log10(x) or in dB re 20 μPa as xdB = 20*log10(x/20e-6). (2) The reason to use a frequency log scale is to give more insight to the low frequency content of the signal and also to form a frequency decades which facilitates the spectral analysis. The scale could be changed if one type plot(f, X, 'r') on line 46.
Please I can see that the signal in the Time Domain is in Amplitude. Is there a way to convert it to decibel in the Time domain. And why it the frequency in FFT plotted in the log. Thank you.
Yes, the code treats only the first sound channel. In order to do the second one, please change line 11 to x = x(:, 2);. And yes, it is long-term-average spectrum, while the spectrogram on lines 26-33 is the short-time one.
Am I right in thinking that this will only do the left channel of an audio file? If so is there a way I can alter the code so it will analyse a stereo? My other query is how the "signal in the frequency domain" section works. Is this a long-term-average-spectrum?
Hi David! Yes, perhaps the frequency of your data is described in kHz...
Or do you think it is described in kHz instead of Hz?
Unfortunately in my sample the frequencies are between 0 and 25 and they actually should be from 0 to at least 10000. Do you know how I can fix it?
Hi David! I just do not want to restrict the spectral analysis to the human hearing frequency range. For instance, the analysed signal could be infrasound or ultrasound.
Hi Akshat! I use electrical (not sound) level when perform the spectral analysis. I treat the signal itself, regardless of the underlying process. The reference level is 1 V.
what is the reference decibel value for this code in this function?
Thank you very much! I still have a question, why is the Frequency Range not from around 16Hz to 20000Hz?
Just what I needed, thank you!
Thanks a lot! This code helped me create a very interesting GUI project for my Matlab class.
Question) How can i interpret from the autocorrelation graph & value ?
what is the autocorrelation of the music signal?
Hi, Nguyen! The basic reason for a minus sign in front of some dB value is because the logarithm of a number 0<x<1 is negative.
Why dB have "-"?
Thank you very much!
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!