Specgram Amplitude Filtering - MATLAB R2008a

1k views Asked by At

So I have written a quick script in Matlab do some visualization for me-

function spectro(filename,maxFreq)

wavchunksizefix(filename);

[y,fs] = wavread(filename);

subplot(2,1,1);
plot(y);
ylim([0 1]);
title('Signal Amplitude');

subplot(2,1,2);
specgram(y,1024,fs);
ylim([0 maxFreq]);
cb = colorbar;
set(get(cb,'title'),'string','dB');
title('Original Signal Spectrogram');

What I was wondering is this- how do modify the specgram() output to only show a specific dB range? Right now it shows a whole bunch of unnecessary noise in the 0 to 40 dB range and I only want to see 0 to -50 dB (unfortunately, I can't post an example picture because I'm new).

1

There are 1 answers

0
user1172075 On

Very cool, thanks guys. I wrote this for filtering the signal over 40 dB and it seems to work-

[y,fs] = wavread('matrecord.wav'); 
centerval = mean(y); 
gdb = 20*log10(y/centerval);
ogv = (gdb > 40); 
x = y;
x(ogv) = 0; 

When I run specgram() on this, it seems to work.