function [spec,threshold]=filt_spec(wave,filtdata)
if filtdata(2)~=0
    %disp(' - infinite slope HPF applied to spectrogram');
    [y x]=size(wave.spec);
    filtlim=(filtdata(2)*2/wave.fs)*y;
    wave.spec(1:round(filtlim),:)=0;
end

if filtdata(3)~=0
    %disp(' - averaging spectrogram');
    wave.spec=conv2(wave.spec,ones(filtdata(3))/filtdata(3)^2,'same');
end

if filtdata(1)~=0
    %disp(' - thresholding spectrogram');
    threshold=filtdata(1);
    mask=wave.spec>=threshold;
    wave.spec=wave.spec.*mask;
else
    threshold=filtdata(1);
end
spec=wave.spec;