function plot_chroma(C,T)
% plot_chroma(C,T)
%    Plot chroma array in spectrogram style.
%    C is a 12xN chroma array, and T gives the start times of each
%    column.
%    If first element is an ENA struct, simply plot the pitches 
%    on the segment timebase.
% 2010-04-13 Dan Ellis dpwe@ee.columbia.edu

if isstruct(C)
  ENA = C;
  C = ENA.pitches;
  T = ENA.segment;
  D = ENA.duration;
else
  % predict that last segment will be the same length as
  % next-to-last one
  D = T(end) + (T(end) - T(end-1));
end

[nchr, ntim] = size(C);

if length(T) == 1
  % Scalar T means uniform spacing
  T = [0:ntim] * T; % ntim + 1 times to include end of last one
end

if length(T) ~= ntim+1
  T = [T,D]; % add duration as end of last segment
end

tres = 0.05;
tt = 0:tres:D;

CR = resample_mx(C,T,tt);

disp(['CR is ', num2str(size(CR,1)), ' x ', num2str(size(CR,2))]);

imagesc(tt,1:nchr,CR); axis xy
set(gca,'YTick',[1 3 5 8 10 12]);
set(gca,'YTickLabel','C|D|E|G|A|B');

color(1-gray);



