annotate Sirtassa/createScore.m @ 2:13ec2fa02a26 tip

(none)
author Yannick JACOB <y.jacob@se12.qmul.ac.uk>
date Tue, 03 Sep 2013 15:33:42 +0100
parents 2cd427e000b0
children
rev   line source
y@0 1 function score = createScore(scoreLength,MIDI,timeFactor,freqFactor)
y@0 2
y@0 3 nbInstrument = length(MIDI);
y@0 4 instruments = cell(nbInstrument,1);
y@0 5 for ins = 1:nbInstrument
y@0 6 instruments{ins} = midi2nmat( MIDI{ins});
y@0 7 end
y@0 8 %Score frame by frame
y@0 9 score = zeros(scoreLength,nbInstrument);
y@0 10
y@0 11 % instrument : onset, offset, frequency
y@0 12 for ins = 1:nbInstrument
y@0 13
y@0 14 instruments{ins}(:,1) = max(1,round(instruments{ins}(:,6)*timeFactor)-1);
y@0 15 instruments{ins}(:,2) = round((instruments{ins}(:,6) + instruments{ins}(:,7))*timeFactor);
y@0 16 instruments{ins}(:,3) = 440/32*2.^((instruments{ins}(:,4)-9)/12);
y@0 17 instruments{ins}(:,4:end) = [];
y@0 18 for j = 1: size(instruments{ins},1)
y@0 19 score(instruments{ins}(j,1):instruments{ins}(j,2),ins) = instruments{ins}(j,3)*freqFactor;
y@0 20 end
y@0 21 end