| | 1 | | using System; |
| | 2 | |
|
| | 3 | | namespace MusicTheory.Theory.Interval |
| | 4 | | { |
| | 5 | | public enum IntervalType |
| | 6 | | { |
| | 7 | | PerfectUnison = 0, |
| | 8 | | MinorSecond = 1, |
| | 9 | | MajorSecond = 2, |
| | 10 | | MinorThird = 3, |
| | 11 | | MajorThird = 4, |
| | 12 | | PerfectFourth = 5, |
| | 13 | | Tritone = 6, |
| | 14 | | PerfectFifth = 7, |
| | 15 | | MinorSixth = 8, |
| | 16 | | MajorSixth = 9, |
| | 17 | | MinorSeventh = 10, |
| | 18 | | MajorSeventh = 11, |
| | 19 | | Octave = 12, |
| | 20 | | MinorNinth = 13, |
| | 21 | | MajorNinth = 14, |
| | 22 | | AugmentedNinth = 15, |
| | 23 | | PerfectEleventh = 17, |
| | 24 | | AugmentedEleventh = 18, |
| | 25 | | MinorThirteenth = 20, |
| | 26 | | MajorThirteenth = 21 |
| | 27 | | } |
| | 28 | |
|
| | 29 | | public enum TensionFunction |
| | 30 | | { |
| | 31 | | None, |
| | 32 | | Modal, |
| | 33 | | Avoid, |
| | 34 | | Altered, |
| | 35 | | LeadingTone, |
| | 36 | | Suspensive, |
| | 37 | | ChromaticColor |
| | 38 | | } |
| | 39 | |
|
| | 40 | | // 新名称クラス (今後はこちらを使用) |
| | 41 | | public readonly record struct FunctionalInterval |
| | 42 | | { |
| 1038 | 43 | | public IntervalType Type { get; } |
| 1034 | 44 | | public int Semitones => (int)Type; |
| 0 | 45 | | public TensionFunction Function { get; } |
| | 46 | | public FunctionalInterval(IntervalType type, TensionFunction function = TensionFunction.None) |
| | 47 | | { |
| 67 | 48 | | Type = type; |
| 67 | 49 | | Function = function; |
| 67 | 50 | | } |
| 2 | 51 | | public string DisplayName => Type switch |
| 2 | 52 | | { |
| 0 | 53 | | IntervalType.MinorSecond => "♭9", |
| 0 | 54 | | IntervalType.MajorSecond => "9", |
| 0 | 55 | | IntervalType.AugmentedNinth => "♯9", |
| 0 | 56 | | IntervalType.PerfectEleventh => "11", |
| 0 | 57 | | IntervalType.AugmentedEleventh => "♯11", |
| 0 | 58 | | IntervalType.MinorThirteenth => "♭13", |
| 0 | 59 | | IntervalType.MajorThirteenth => "13", |
| 2 | 60 | | _ => Type.ToString() |
| 2 | 61 | | }; |
| | 62 | | } |
| | 63 | | } |