MusicTheory Docs API Toolbox GitHub NuGet
Contents

FAQ

Why is C♯ not equal to D♭?

Because they are different notes that sound the same. In A major the third is C♯; in B♭ minor the third is D♭. Equality compares spelling; IsEnharmonicWith compares sound.

Console.WriteLine(Note.Parse("C#4") == Note.Parse("Db4"));                  // False
Console.WriteLine(Note.Parse("C#4").IsEnharmonicWith(Note.Parse("Db4")));   // True

Why does B♯3 have octave 3?

Scientific pitch notation changes the octave number at C. B♯3 is the B♯ just below C4, and sounds like C4.

Console.WriteLine(Note.Parse("B#3").MidiNumber);   // 60

How do I get the pitch class, or the MIDI number?

Console.WriteLine(Note.Parse("Eb4").PitchClass);   // 3
Console.WriteLine(Note.Parse("Eb4").MidiNumber);   // 63

How do I tune to A = 442 Hz?

Console.WriteLine(Note.Parse("A4").GetFrequency(442));   // 442

Why does transposing B𝄪 up a major second throw?

The result would be C𝄪♯, a triple sharp. The library supports up to two accidentals per note and refuses anything it cannot spell instead of returning a wrong note.

How do I write a German H?

Console.WriteLine(Note.Parse("H", NoteNotation.German));   // B4

What changed in versions 2 and 3?

  • Note, Interval, Chord, Scale and KeySignature are immutable records with value equality, and they validate their arguments.
  • Interval has qualities up to quintuply augmented and diminished, a direction, music21 names, Parse, Reverse and ToSimple. Transpose no longer takes a Direction: the interval carries it.
  • Interval.Between counts letters and follows the staff; it is checked against music21.
  • Chord.AddExtension returns a new chord and replaces the degree it alters.
  • ChordSymbol parses tensions: C7b9#11, Cmaj7(#11).
  • Every scale ends on the octave, and is built by interval.
  • KeySignature supports theoretical keys, and the circle of fifths no longer skips a key at C♯ and C♭.
  • IsEnharmonicWith compares the sounding pitch, octave included.
  • Every Parse throws FormatException.
  • MusicTheoryUtilities and MusicTheoryConstants are internal; use Note.PitchClass, Note.Respell and Interval.Semitones instead.
  • The library targets .NET 11.

What changed in 3.0.0

3.0.0 breaks the rhythm API only; the rest is additive. CHANGELOG.md has the full list.

  • Rhythm break. Duration is an exact sealed record on Rational, and TimeSignature is a record with an exact MeasureLength. Duration.Add, Duration.Divide and CompoundDuration are removed; Measures and tempo shows what replaces them.
  • Four new packages: MusicTheory.ChordPro, MusicTheory.Midi, MusicTheory.MusicXml and MusicTheory.Abc. See the overview.
  • KeySignature.TryParse accepts theoretical keys, and chord transposition spells by interval.
  • ChordSymbol parses 7sus2, m(maj9), add#11 and the mi alias, and has an opt-in ChordSymbolParseOptions for lower-case roots.
  • Transposition takes a SuffixHandling: KeepUnparsed moves the root and bass of a chord it cannot parse, and Verbatim keeps the writer's suffix.
  • VoicingDescriber speaks chord names and voicing labels in French.
  • Voicings that drop a chord tone rank behind complete ones.
  • New features: tuning and temperaments, solfège, pitch-class sets, piano voicings, modulation and cadence detection, ear-training drills. The overview links each guide.

Is it checked against a reference?

Yes. The tests replay intervals, transpositions, scales and key signatures computed by music21, the theory toolkit from MIT. See tools/reference/generate.py in the repository.