function [specData,F,T,parameter] = load_spectrogram(filename,parameter)


parameter.fs = 22050;



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% lin F axis spectrogram
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


switch parameter.featureType
    case 1 % linear spectrogram
        name = 'Original Spectrogram';
        suffix = '__spectrogram';
        parameter.logF = 0;
    case 2 % logarithmic frequency axis spectrogram
        name = 'Original Logarithmic Frequency Axis Spectrogram';
        suffix = '__logSpectrogram';
        parameter.logF = 1;
    case 3 % filterbank pitch representation
        name = 'Original Filterbank Pitch Representation';
        suffix = '__pitchRepresentation';
        parameter.logF = 1;
    otherwise
        error('Unknown feature');
end

spect = load([parameter.dirFeatures filename(1:end-4) suffix ]);
T = spect.T;
F = spect.F;
specData = spect.TFRData;
parameter.featureRate = spect.featureRate;

if parameter.logCompression
    specData = log(1+parameter.logCompression.*specData./max(max(specData)))./log(1+parameter.logCompression);
end

if parameter.visualize
    figure;
    imagesc(T, F, specData);
    colormap(hot); colorbar; axis xy;
    title(name); xlabel('Time (sec)'); ylabel('F');

    if parameter.logF
        set(gca,'YScale','log');
    end
end