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,ScaleandKeySignatureare immutable records with value equality, and they validate their arguments.Intervalhas qualities up to quintuply augmented and diminished, a direction, music21 names,Parse,ReverseandToSimple.Transposeno longer takes aDirection: the interval carries it.Interval.Betweencounts letters and follows the staff; it is checked against music21.Chord.AddExtensionreturns a new chord and replaces the degree it alters.ChordSymbolparses tensions:C7b9#11,Cmaj7(#11).- Every scale ends on the octave, and is built by interval.
KeySignaturesupports theoretical keys, and the circle of fifths no longer skips a key at C♯ and C♭.IsEnharmonicWithcompares the sounding pitch, octave included.- Every
ParsethrowsFormatException. MusicTheoryUtilitiesandMusicTheoryConstantsare internal; useNote.PitchClass,Note.RespellandInterval.Semitonesinstead.- 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.
Durationis an exact sealed record onRational, andTimeSignatureis a record with an exactMeasureLength.Duration.Add,Duration.DivideandCompoundDurationare removed; Measures and tempo shows what replaces them. - Four new packages:
MusicTheory.ChordPro,MusicTheory.Midi,MusicTheory.MusicXmlandMusicTheory.Abc. See the overview. KeySignature.TryParseaccepts theoretical keys, and chord transposition spells by interval.ChordSymbolparses7sus2,m(maj9),add#11and themialias, and has an opt-inChordSymbolParseOptionsfor lower-case roots.- Transposition takes a
SuffixHandling:KeepUnparsedmoves the root and bass of a chord it cannot parse, andVerbatimkeeps the writer's suffix. VoicingDescriberspeaks 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.