Why my spectrogram looks so bad? (white lines)

12 vues (au cours des 30 derniers jours)
Juan
Juan le 27 Fév 2017
I have an audio called audio.mp3 and I do:
[u Fs]=audioread('audio.mp3');
And then:
figure; spectrogram(u);
figure; spectrogram(u,Fs);
But in both cases I have an awful spectrogram, with white lines in it:
using spectrogram(u):
using spectrogram(u,Fs):
I hope you can help me. I really need this to work properly

Réponses (3)

Star Strider
Star Strider le 27 Fév 2017
The spectrogram plot is a surf plot, so if you want to see what the white lines actually mean, use the view function to see it as a 3D plot.
This is from the spectrogram documentation:
Fs = 1000;
t = 0:1/Fs:2-1/Fs;
y = chirp(t,100,1,200,'quadratic');
figure(1)
spectrogram(y,100,80,100,Fs,'yaxis')
view(-77,72)
shading interp
colorbar off
grid on
  2 commentaires
Stephen23
Stephen23 le 27 Fév 2017
Modifié(e) : Stephen23 le 27 Fév 2017
Juan's "Answer" moved here:
The 3D plot is:
It doesn't show any white lines. So the problem is in my 2D plot. What can I do?
Star Strider
Star Strider le 27 Fév 2017
There may be white lines that are hidden by the peaks. You may have to rotate it to see them. You can do this interactively using the ‘Rotate 3D’ icon in the plot GUI window. (It has an anti-clockwise circular arrow around a 3D box.)
Also, the white lines could simply be a problem with the resolution. Experiment with the input arguments to see if increasing the fft length, changing the overlap, and others could improve the plot.

Connectez-vous pour commenter.


Steve Jenkins
Steve Jenkins le 22 Mar 2017
I have the same problem. It seems like with older OpenGl renderers, these artifacts appear. The only methods I've found are to use a new version of OpenGl, or to switch to using painters as a renderer.
set(gcf, 'renderer','painters');

Greg Dionne
Greg Dionne le 22 Mar 2017
I've heard sometimes updating NVidia drivers help or maybe using the -softwareopengl switch when starting MATLAB. But if all you want is a 2-D image, try something like:
[~,f,t,P] = spectrogram(...)
imagesc(t,f,10*log10(abs(P)+eps))
xlabel('time')
ylabel('freq')
colorbar

Catégories

En savoir plus sur Time-Frequency Analysis dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by