Why my spectrogram looks so bad? (white lines)

조회 수: 12 (최근 30일)
Juan
Juan 2017년 2월 27일
답변: Greg Dionne 2017년 3월 22일
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