function [y,f,t,p] = MySonogram(axesDraw,song,Fs,timeOffset,CMAP, plotFlag) [y,f,t,p] = spectrogram(song,256,250,1024,Fs,'yaxis'); if~exist('plotFlag') plotFlag = 1; end if plotFlag == 0 close all return else axes(axesDraw) imagesc(t+timeOffset,f,10*log10(abs(p))); axis xy; axis tight; if exist('CMAP') C = CMAP; else C = colormap(jet);% view(0,90); n = 5; R = linspace(0,C(1,1),n); %// Red from 1 to 0 G = linspace(0,C(1,2),n); %// Green all zero B = linspace(0,C(1,3),n); %// Blue from 0 to 1 C2 = [R(:), G(:), B(:)]; C = [C2(1:4,:); C]; end colormap(axesDraw,C) axis([xlim,600 10000]); clim_default=get(gca,'Clim'); % adjust contrast directly change color range cmap = colormap; set(gca,'Clim',clim_default+[-clim_default(1)/2,0]); colormap(C); end end