To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Revision:

root / _writetools / spellnote.m

History | View | Annotate | Download (4.24 KB)

1
function outnote = spellnote(key,root,varargin)
2
if nargin > 2
3
    type = varargin{1};
4
else
5
    type = 'normal';
6
end
7

    
8
switch type
9
    case 'normal'
10
        if root ~= 13
11
            scale{1} = {'C','C#','D','Eb','E','F','F#','G','Ab','A','Bb','B'};
12
            scale{2} = {'Db','D','Eb','E','F','Gb','G','Ab','A','Bb','B','C'};
13
            scale{3} = {'D','D#','E','F','F#','G','G#','A','Bb','B','C','C#'};
14
            scale{4} = {'Eb','E','F','Gb','G','Ab','A','Bb','B','C','Db','D'};
15
            scale{5} = {'E','F','F#','G','G#','A','Bb','B','C','C#','D','D#'};
16
            scale{6} = {'F','Gb','G','Ab','A','Bb','B','C','Db','D','Eb','E'};
17
            scale{7} = {'Gb','G','Ab','A','Bb','Cb','C','Db','D','Eb','E','F'};
18
            scale{8} = {'G','G#','A','Bb','B','C','C#','D','D#','E','F','F#'};
19
            scale{9} = {'Ab','A','Bb','B','C','Db','D','Eb','E','F','Gb','G'};
20
            scale{10} = {'A','Bb','B','C','C#','D','D#','E','F','F#','G','G#'};
21
            scale{11} = {'Bb','B','C','Db','D','Eb','E','F','Gb','G','Ab','A'};
22
            scale{12} = {'B','C','C#','D','D#','E','F','F#','G','G#','A','A#'};
23
            scale{13} = {'Eb','E','F','Gb','G','Ab','A','Bb','B','C','Db','D'};
24
            scale{14} = {'E','F','F#','G','G#','A','Bb','B','C','C#','D','D#'};
25
            scale{15} = {'F','Gb','G','Ab','A','Bb','B','C','Db','D','Eb','E'};
26
            scale{16} = {'Gb','G','Ab','A','Bb','Cb','C','Db','D','Eb','E','F'};
27
            scale{17} = {'G','G#','A','Bb','B','C','C#','D','D#','E','F','F#'};
28
            scale{18} = {'Ab','A','Bb','B','C','Db','D','Eb','E','F','Gb','G'};
29
            scale{19} = {'A','Bb','B','C','C#','D','D#','E','F','F#','G','G#'};
30
            scale{20} = {'Bb','B','C','Db','D','Eb','E','F','Gb','G','Ab','A'};
31
            scale{21} = {'B','C','C#','D','D#','E','F','F#','G','G#','A','A#'};
32
            scale{22} = {'C','C#','D','Eb','E','F','F#','G','Ab','A','Bb','B'};
33
            scale{23} = {'Db','D','Eb','E','F','Gb','G','Ab','A','Bb','B','C'};
34
            scale{24} = {'D','D#','E','F','F#','G','G#','A','Bb','B','C','C#'};
35
            outnote = scale{key}{mod(root - key,12)+1};
36
        else
37
            outnote = '';
38
        end
39
    case 'lily'
40
        if root ~= 13
41
            scale{1} = {'c','cis','d','es','e','f','fis','g','as','a','bes','b'};
42
            scale{2} = {'des','d','es','e','f','ges','g','as','a','bes','b','c'};
43
            scale{3} = {'d','dis','e','f','fis','g','gis','a','bes','b','c','cis'};
44
            scale{4} = {'es','e','f','ges','g','as','a','bes','b','c','des','d'};
45
            scale{5} = {'e','f','fis','g','gis','a','bes','b','c','cis','d','dis'};
46
            scale{6} = {'f','ges','g','as','a','bes','b','c','des','d','es','e'};
47
            scale{7} = {'ges','g','as','a','bes','ces','c','des','d','es','e','f'};
48
            scale{8} = {'g','gis','a','bes','b','c','cis','d','dis','e','f','fis'};
49
            scale{9} = {'as','a','bes','b','c','des','d','es','e','f','ges','g'};
50
            scale{10} = {'a','bes','b','c','cis','d','dis','e','f','fis','g','gis'};
51
            scale{11} = {'bes','b','c','des','d','es','e','f','ges','g','as','a'};
52
            scale{12} = {'b','c','cis','d','dis','e','f','fis','g','gis','a','ais'};
53
            scale{13} = {'es','e','f','ges','g','as','a','bes','b','c','des','d'};
54
            scale{14} = {'e','f','fis','g','gis','a','bes','b','c','cis','d','dis'};
55
            scale{15} = {'f','ges','g','as','a','bes','b','c','des','d','es','e'};
56
            scale{16} = {'ges','g','as','a','bes','ces','c','des','d','es','e','f'};
57
            scale{17} = {'g','gis','a','bes','b','c','cis','d','dis','e','f','fis'};
58
            scale{18} = {'as','a','bes','b','c','des','d','es','e','f','ges','g'};
59
            scale{19} = {'a','bes','b','c','cis','d','dis','e','f','fis','g','gis'};
60
            scale{20} = {'bes','b','c','des','d','es','e','f','ges','g','as','a'};
61
            scale{21} = {'b','c','cis','d','dis','e','f','fis','g','gis','a','ais'};
62
            scale{22} = {'c','cis','d','es','e','f','fis','g','as','a','bes','b'};
63
            scale{23} = {'des','d','es','e','f','ges','g','as','a','bes','b','c'};
64
            scale{24} = {'d','dis','e','f','fis','g','gis','a','bes','b','c','cis'};
65
            outnote = scale{key}{mod(root - key,12)+1};
66
        else
67
            outnote = 'r';
68
        end
69
end