function spec=cps_to_specgram(filename_or_cepstr,cmap) % spec=cps_to_specgram(filename_or_cepstr,cmap) % % makes FFT out of cps coeffs read from an HTK file - can process either % cepstral matrix or HTK file if out arg is specified, does not draw the spec. % % if colormap not supplied, uses the default one. if (isstr(filename_or_cepstr)) h = readhtk(filename_or_cepstr); else h =filename_or_cepstr; end if nargin==1, cmap = colormap; end [P,vecs] = size(h); spec = zeros(129,vecs); for ii=1:vecs, c = h(:,ii); ospec = abs(fft([c ; zeros(256-P-(P-1),1) ; c(P:-1:2)])); spec(:,ii) = ospec(1:129); % for fft end %imagesc(spec); axis xy if (nargout == 0) % image(spec/max(max(spec))*64); colormap(cmap); axis xy imagesc(spec); axis xy; colormap (cmap); colorbar; end