Why my spectrogram looks so bad? (white lines)

6 次查看(过去 30 天)
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

回答(3 个)

Star Strider
Star Strider 2017-2-27
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 个评论
Stephen23
Stephen23 2017-2-27
编辑:Stephen23 2017-2-27
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 2017-2-27
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.

请先登录,再进行评论。


Steve Jenkins
Steve Jenkins 2017-3-22
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 2017-3-22
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

类别

Help CenterFile Exchange 中查找有关 Time-Frequency Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by