To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / _writetools / keynroot2notetext.m
History | View | Annotate | Download (2.26 KB)
| 1 |
function outnote = keynroot2notetext(key,root,type) |
|---|---|
| 2 |
|
| 3 |
switch type |
| 4 |
case 'normal' |
| 5 |
if root ~= 13 |
| 6 |
scale{1} = {'A','Bb','B','C','C#','D','D#','E','F','F#','G','G#'};
|
| 7 |
scale{2} = {'Bb','B','C','Db','D','Eb','E','F','Gb','G','Ab','A'};
|
| 8 |
scale{3} = {'B','C','C#','D','D#','E','F','F#','G','G#','A','A#'};
|
| 9 |
scale{4} = {'C','C#','D','Eb','E','F','F#','G','Ab','A','Bb','B'};
|
| 10 |
scale{5} = {'Db','D','Eb','E','F','Gb','G','Ab','A','Bb','B','C'};
|
| 11 |
scale{6} = {'D','D#','E','F','F#','G','G#','A','Bb','B','C','C#'};
|
| 12 |
scale{7} = {'Eb','E','F','Gb','G','Ab','A','Bb','B','C','Db','D'};
|
| 13 |
scale{8} = {'E','F','F#','G','G#','A','Bb','B','C','C#','D','D#'};
|
| 14 |
scale{9} = {'F','Gb','G','Ab','A','Bb','B','C','Db','D','Eb','E'};
|
| 15 |
scale{10} = {'Gb','G','Ab','A','Bb','Cb','C','Db','D','Eb','E','F'};
|
| 16 |
scale{11} = {'G','G#','A','Bb','B','C','C#','D','D#','E','F','F#'};
|
| 17 |
scale{12} = {'Ab','A','Bb','B','C','Db','D','Eb','E','F','Gb','G'};
|
| 18 |
outnote = scale{key}{mod(root - key,12)+1};
|
| 19 |
else |
| 20 |
outnote = ''; |
| 21 |
end |
| 22 |
case 'lily' |
| 23 |
if root ~= 13 |
| 24 |
scale{1} = {'a','bes','b','c','cis','d','dis','e','f','fis','g','gis'};
|
| 25 |
scale{2} = {'bes','b','c','des','d','es','e','f','ges','g','as','a'};
|
| 26 |
scale{3} = {'b','c','cis','d','dis','e','f','fis','g','gis','a','ais'};
|
| 27 |
scale{4} = {'c','cis','d','es','e','f','fis','g','as','a','bes','b'};
|
| 28 |
scale{5} = {'des','d','es','e','f','ges','g','as','a','bes','b','c'};
|
| 29 |
scale{6} = {'d','dis','e','f','fis','g','gis','a','bes','b','c','cis'};
|
| 30 |
scale{7} = {'es','e','f','ges','g','as','a','bes','b','c','des','d'};
|
| 31 |
scale{8} = {'e','f','fis','g','gis','a','bes','b','c','cis','d','dis'};
|
| 32 |
scale{9} = {'f','ges','g','as','a','bes','b','c','des','d','es','e'};
|
| 33 |
scale{10} = {'ges','g','as','a','bes','ces','c','des','d','es','e','f'};
|
| 34 |
scale{11} = {'g','gis','a','bes','b','c','cis','d','dis','e','f','fis'};
|
| 35 |
scale{12} = {'as','a','bes','b','c','des','d','es','e','f','ges','g'};
|
| 36 |
outnote = scale{key}{mod(root - key,12)+1};
|
| 37 |
else |
| 38 |
outnote = 'r'; |
| 39 |
end |
| 40 |
end |