| | 1 | | namespace MusicTheory.Theory.Harmony; |
| | 2 | |
|
| | 3 | | // Public, instance-style options to control disambiguation and preference rules. |
| | 4 | | // Defaults mirror existing, validated behavior. Pass a customized instance to analyzer APIs |
| | 5 | | // to tweak behavior without mutating global state. |
| | 6 | | public sealed class HarmonyOptions |
| | 7 | | { |
| | 8 | | /// <summary> |
| | 9 | | /// Prefer Augmented Sixth (It6/Fr43/Ger65) over bVI7 when bass equals b6 and the pitch-class set matches. |
| | 10 | | /// Default: true. |
| | 11 | | /// </summary> |
| 58 | 12 | | public bool PreferAugmentedSixthOverMixtureWhenBassFlat6 { get; set; } = true; |
| | 13 | |
|
| | 14 | | /// <summary> |
| | 15 | | /// When the soprano is also b6, suppress Augmented Sixth labeling to keep the common Ab7 voicing as bVI7. |
| | 16 | | /// Default: true. |
| | 17 | | /// </summary> |
| 484 | 18 | | public bool DisallowAugmentedSixthWhenSopranoFlat6 { get; set; } = true; |
| | 19 | |
|
| | 20 | | /// <summary> |
| | 21 | | /// When an augmented-sixth set and a mixture seventh (e.g., bVI7) are enharmonically identical, |
| | 22 | | /// prefer labeling as the mixture seventh instead of Augmented Sixth. This changes only the |
| | 23 | | /// disambiguation order; exact matching rules remain the same. Default: false (prefer Aug6 first). |
| | 24 | | /// </summary> |
| 406 | 25 | | public bool PreferMixtureSeventhOverAugmentedSixthWhenAmbiguous { get; set; } = false; |
| | 26 | |
|
| | 27 | | /// <summary> |
| | 28 | | /// Prefer vii°7/V as the target for ambiguous fully-diminished seventh sets (secondary leading-tone preference). |
| | 29 | | /// Default: true. |
| | 30 | | /// </summary> |
| 77 | 31 | | public bool PreferSecondaryLeadingToneTargetV { get; set; } = true; |
| | 32 | |
|
| | 33 | | /// <summary> |
| | 34 | | /// In minor keys, prefer the diatonic iiø7 over any secondary interpretation. |
| | 35 | | /// Default: true. |
| | 36 | | /// </summary> |
| 53 | 37 | | public bool PreferDiatonicIiHalfDimInMinor { get; set; } = true; |
| | 38 | |
|
| | 39 | | /// <summary> |
| | 40 | | /// Neapolitan (bII) enforcement: when enabled, triadic bII is labeled as bII6 even if voicing indicates root or sec |
| | 41 | | /// Default: false (preserve factual inversion labeling and only emit warnings). |
| | 42 | | /// </summary> |
| 25 | 43 | | public bool EnforceNeapolitanFirstInversion { get; set; } = false; |
| | 44 | |
|
| | 45 | | /// <summary> |
| | 46 | | /// Show non-cadential 6-4 classifications (Passing / Pedal) in detailed cadence results. |
| | 47 | | /// When false, non-cadential entries (Type==None with Passing/Pedal) are suppressed. |
| | 48 | | /// Cadential 6-4 (I64→V→I) still contributes to the following cadence entry (e.g., Authentic) and remains attached |
| | 49 | | /// Default: true. |
| | 50 | | /// </summary> |
| 76 | 51 | | public bool ShowNonCadentialSixFour { get; set; } = true; |
| | 52 | |
|
| | 53 | | /// <summary> |
| | 54 | | /// If true, prefer the notation "V7(9)" instead of "V9" for dominant ninth chords. |
| | 55 | | /// This only affects the roman text label; the functional analysis remains Dominant (V). |
| | 56 | | /// Default is false (use "V9"). |
| | 57 | | /// </summary> |
| 26 | 58 | | public bool PreferV7Paren9OverV9 { get; set; } = false; |
| | 59 | |
|
| | 60 | | /// <summary> |
| | 61 | | /// Treat cadential 6-4 (typically notated as I64 preceding V→I) as a dominant appoggiatura |
| | 62 | | /// and label it as "V64-53" with Dominant function. This is a notational preference only; |
| | 63 | | /// analysis and cadence detection are unchanged. Effective in detailed progression analysis |
| | 64 | | /// where cadential 6-4 is detected. |
| | 65 | | /// Default: false (keep I64 labeling). |
| | 66 | | /// </summary> |
| 24 | 67 | | public bool PreferCadentialSixFourAsDominant { get; set; } = false; |
| | 68 | |
|
| | 69 | | /// <summary> |
| | 70 | | /// When labeling inversions of diatonic major-seventh chords (e.g., IVmaj7), |
| | 71 | | /// include "maj" in the inversion figure labels. For example: IVmaj65/IVmaj43/IVmaj42. |
| | 72 | | /// Root position remains "IVmaj7" regardless of this option. Default: false (use IV65/IV43/IV42). |
| | 73 | | /// </summary> |
| 13 | 74 | | public bool IncludeMajInSeventhInversions { get; set; } = false; |
| | 75 | |
|
| | 76 | | /// <summary> |
| | 77 | | /// When true, Perfect Authentic Cadence (PAC) 判定を、ドミナント側が拡張なしの V(三和音)で、かつトニック側がプレーン I(三和音)である場合に限定します。 |
| | 78 | | /// 既定:false (V7 / V9, Imaj7 も PAC とみなす従来挙動)。 |
| | 79 | | /// </summary> |
| 65 | 80 | | public bool StrictPacPlainTriadsOnly { get; set; } = false; |
| | 81 | |
|
| | 82 | | /// <summary> |
| | 83 | | /// When true, ドミナント側に七度/九度拡張 (V7 / V9 / V7(9)) が含まれている場合は PAC へ昇格しません。 |
| | 84 | | /// 既定:false (拡張付きでも root 位置であれば PAC)。 StrictPacPlainTriadsOnly と併用されるケースを想定し分離。 |
| | 85 | | /// </summary> |
| 40 | 86 | | public bool StrictPacDisallowDominantExtensions { get; set; } = false; |
| | 87 | |
|
| | 88 | | /// <summary> |
| | 89 | | /// When true, PAC requires the soprano of the cadence goal (tonic chord) to contain the tonic scale degree. |
| | 90 | | /// If voicing information is unavailable for the goal chord, PAC is not awarded under this option. |
| | 91 | | /// Default: false. |
| | 92 | | /// </summary> |
| 31 | 93 | | public bool StrictPacRequireSopranoTonic { get; set; } = false; |
| | 94 | |
|
| | 95 | | /// <summary> |
| | 96 | | /// When true, PAC additionally requires a leading-tone (7̂) in the soprano of the dominant resolving by step (↑ or |
| | 97 | | /// Effective only if <see cref="StrictPacRequireSopranoTonic"/> is also true. If voicings are missing, PAC is not a |
| | 98 | | /// Default: false. |
| | 99 | | /// </summary> |
| 5 | 100 | | public bool StrictPacRequireSopranoLeadingToneResolution { get; set; } = false; |
| | 101 | |
|
| | 102 | | /// <summary> |
| | 103 | | /// Shared default instance used when no options are supplied. |
| | 104 | | /// </summary> |
| 402 | 105 | | public static HarmonyOptions Default { get; } = new HarmonyOptions(); |
| | 106 | |
|
| | 107 | | /// <summary> |
| | 108 | | /// Pedagogical preset: keeps defaults but enforces Neapolitan first inversion (bII6). |
| | 109 | | /// Useful for teaching-focused outputs where bII is always shown as bII6. |
| | 110 | | /// </summary> |
| 2 | 111 | | public static HarmonyOptions Pedagogical { get; } = new HarmonyOptions |
| 1 | 112 | | { |
| 1 | 113 | | PreferAugmentedSixthOverMixtureWhenBassFlat6 = true, |
| 1 | 114 | | DisallowAugmentedSixthWhenSopranoFlat6 = true, |
| 1 | 115 | | PreferMixtureSeventhOverAugmentedSixthWhenAmbiguous = false, |
| 1 | 116 | | PreferSecondaryLeadingToneTargetV = true, |
| 1 | 117 | | PreferDiatonicIiHalfDimInMinor = true, |
| 1 | 118 | | EnforceNeapolitanFirstInversion = true, |
| 1 | 119 | | ShowNonCadentialSixFour = true, |
| 1 | 120 | | PreferV7Paren9OverV9 = false, |
| 1 | 121 | | PreferCadentialSixFourAsDominant = false, |
| 1 | 122 | | }; |
| | 123 | |
|
| | 124 | | /// <summary> |
| | 125 | | /// Notation preset: prefer "V7(9)" labeling for dominant ninths. |
| | 126 | | /// Other options remain default-friendly for analysis. |
| | 127 | | /// </summary> |
| 1 | 128 | | public static HarmonyOptions NotationV7Paren9 { get; } = new HarmonyOptions |
| 1 | 129 | | { |
| 1 | 130 | | PreferV7Paren9OverV9 = true, |
| 1 | 131 | | }; |
| | 132 | |
|
| | 133 | | /// <summary> |
| | 134 | | /// Preset: より厳密な PAC 判定(V → I のプレーン triad のみ)。 |
| | 135 | | /// </summary> |
| 2 | 136 | | public static HarmonyOptions StrictPac { get; } = new HarmonyOptions |
| 1 | 137 | | { |
| 1 | 138 | | StrictPacPlainTriadsOnly = true, |
| 1 | 139 | | StrictPacDisallowDominantExtensions = true, |
| 1 | 140 | | StrictPacRequireSopranoTonic = true, |
| 1 | 141 | | }; |
| | 142 | | } |