function [F,B,T] = loadftrs_mirex(A)
% [F,B,T] = loadftrslabs(A)
%     Read in features for data items defined by a file or cell list.
%     A is the name of a list file defining a set of tracks
%     (or a cell array containing all the file ID strings).
%     F returns as one 12xN matrix of chroma features
%     B returns the beat times within each block.
%     T is a vector of the start frames of each individual track.
% 2008-08-11 Dan Ellis dpwe@ee.columbia.edu

% optional common filename prefix
dataroot = '';

if iscell(A)
  trks = A;
else
  trks = listfileread(A);
end

ntrks = length(trks);
F = []; 
B = [];
T = [];

lowchroma = 1;
tonctrd = 0;

for i=1:ntrks; 

  fn = fullfile(dataroot, trks{i});
  FF=load(fn);
  f = chromnorm(chrompwr(FF.F,.25));
  if tonctrd
    f = chrom2tonctrd(f);
  end
  if lowchroma
    % convert "-400" into "-100"
    fn2 = fn;
    fn2(max(find(fn2=='4'))) = '1';
    FF2=load(fn2);
    f2 = chromnorm(chrompwr(FF2.F,.25));
    if tonctrd
      f2 = chrom2tonctrd(f2);
    end
    f = [f;f2];
  end
  
  F=[F,f];
  B=[B,FF.bts];
  T(i) = size(f,2);
end


