function outnote = keynroot2notetext(key,root,type)

switch type
    case 'normal'
        if root ~= 13
            scale{1} = {'A','Bb','B','C','C#','D','D#','E','F','F#','G','G#'};
            scale{2} = {'Bb','B','C','Db','D','Eb','E','F','Gb','G','Ab','A'};
            scale{3} = {'B','C','C#','D','D#','E','F','F#','G','G#','A','A#'};
            scale{4} = {'C','C#','D','Eb','E','F','F#','G','Ab','A','Bb','B'};
            scale{5} = {'Db','D','Eb','E','F','Gb','G','Ab','A','Bb','B','C'};
            scale{6} = {'D','D#','E','F','F#','G','G#','A','Bb','B','C','C#'};
            scale{7} = {'Eb','E','F','Gb','G','Ab','A','Bb','B','C','Db','D'};
            scale{8} = {'E','F','F#','G','G#','A','Bb','B','C','C#','D','D#'};
            scale{9} = {'F','Gb','G','Ab','A','Bb','B','C','Db','D','Eb','E'};
            scale{10} = {'Gb','G','Ab','A','Bb','Cb','C','Db','D','Eb','E','F'};
            scale{11} = {'G','G#','A','Bb','B','C','C#','D','D#','E','F','F#'};
            scale{12} = {'Ab','A','Bb','B','C','Db','D','Eb','E','F','Gb','G'};
            outnote = scale{key}{mod(root - key,12)+1};
        else
            outnote = '';
        end
    case 'lily'
        if root ~= 13
            scale{1} = {'a','bes','b','c','cis','d','dis','e','f','fis','g','gis'};
            scale{2} = {'bes','b','c','des','d','es','e','f','ges','g','as','a'};
            scale{3} = {'b','c','cis','d','dis','e','f','fis','g','gis','a','ais'};
            scale{4} = {'c','cis','d','es','e','f','fis','g','as','a','bes','b'};
            scale{5} = {'des','d','es','e','f','ges','g','as','a','bes','b','c'};
            scale{6} = {'d','dis','e','f','fis','g','gis','a','bes','b','c','cis'};
            scale{7} = {'es','e','f','ges','g','as','a','bes','b','c','des','d'};
            scale{8} = {'e','f','fis','g','gis','a','bes','b','c','cis','d','dis'};
            scale{9} = {'f','ges','g','as','a','bes','b','c','des','d','es','e'};
            scale{10} = {'ges','g','as','a','bes','ces','c','des','d','es','e','f'};
            scale{11} = {'g','gis','a','bes','b','c','cis','d','dis','e','f','fis'};
            scale{12} = {'as','a','bes','b','c','des','d','es','e','f','ges','g'};
            outnote = scale{key}{mod(root - key,12)+1};
        else
            outnote = 'r';
        end
end
