y@0: function score = createScore(scoreLength,MIDI,timeFactor,freqFactor) y@0: y@0: nbInstrument = length(MIDI); y@0: instruments = cell(nbInstrument,1); y@0: for ins = 1:nbInstrument y@0: instruments{ins} = midi2nmat( MIDI{ins}); y@0: end y@0: %Score frame by frame y@0: score = zeros(scoreLength,nbInstrument); y@0: y@0: % instrument : onset, offset, frequency y@0: for ins = 1:nbInstrument y@0: y@0: instruments{ins}(:,1) = max(1,round(instruments{ins}(:,6)*timeFactor)-1); y@0: instruments{ins}(:,2) = round((instruments{ins}(:,6) + instruments{ins}(:,7))*timeFactor); y@0: instruments{ins}(:,3) = 440/32*2.^((instruments{ins}(:,4)-9)/12); y@0: instruments{ins}(:,4:end) = []; y@0: for j = 1: size(instruments{ins},1) y@0: score(instruments{ins}(j,1):instruments{ins}(j,2),ins) = instruments{ins}(j,3)*freqFactor; y@0: end y@0: end