function score = createScore(scoreLength,MIDI,timeFactor,freqFactor)

nbInstrument = length(MIDI);
instruments = cell(nbInstrument,1);
for ins = 1:nbInstrument
    instruments{ins} = midi2nmat( MIDI{ins});
end
%Score frame by frame
score = zeros(scoreLength,nbInstrument);

% instrument : onset, offset, frequency
for ins = 1:nbInstrument
    
    instruments{ins}(:,1) = max(1,round(instruments{ins}(:,6)*timeFactor)-1);
    instruments{ins}(:,2) = round((instruments{ins}(:,6) + instruments{ins}(:,7))*timeFactor);
    instruments{ins}(:,3) = 440/32*2.^((instruments{ins}(:,4)-9)/12);
    instruments{ins}(:,4:end) = [];
    for j = 1: size(instruments{ins},1)
        score(instruments{ins}(j,1):instruments{ins}(j,2),ins) = instruments{ins}(j,3)*freqFactor;
    end
end