matthiasm@8: function param = add_keys(param) matthiasm@8: names = {'A','Bb','B','C','C#','D','Eb','E','F','F#','G','G#','Am','Bbm','Bm','Cm','C#m','Dm','Ebm','Em','Fm','F#m','Gm','G#m'}; matthiasm@8: switch param.key.set matthiasm@8: case 'major' matthiasm@8: param.key.names = names(1:12); matthiasm@8: profile = [1 0 1 0 1 1 0 1 0 1 0 1]; matthiasm@8: case 'majorminor' matthiasm@8: param.key.names = names; matthiasm@8: profile = [1 0 1 0 1 1 0 1 0 1 0 1; matthiasm@8: 1 0 1 1 0 1 0 1 1 0 0 1]; matthiasm@8: end matthiasm@8: matthiasm@8: nMode = size(profile,1); matthiasm@8: matthiasm@8: param.key.profiles = zeros(12 * nMode, 12); matthiasm@8: param.key.n = nMode * 12; matthiasm@8: matthiasm@8: for iMode = 1:nMode matthiasm@8: for iSemitone = 1:12 matthiasm@8: param.key.profiles(12 * (iMode-1) + iSemitone,:) = ... matthiasm@8: circshift(profile(iMode,:),[0,iSemitone-1]); matthiasm@8: end matthiasm@8: end matthiasm@8: matthiasm@8: matthiasm@8: param.chord.givenkey = zeros([param.key.n,param.chord.n]); matthiasm@8: matthiasm@8: for iKey = 1:param.key.n matthiasm@8: for iChord = 1:param.chord.n matthiasm@8: chord_prefit = ... matthiasm@8: (1-param.key.profiles(iKey,:)) * param.chord.mu(:,iChord); matthiasm@8: param.chord.givenkey(iKey,iChord) = 1 / (chord_prefit + param.key.c); matthiasm@8: end matthiasm@8: end matthiasm@8: param.chord.givenkey = qnormalise(param.chord.givenkey,1,2); matthiasm@8: