This project is licensed under the terms of the MIT license.
A Music Theory Class Library
Bravura currently only supports the harmonic elements of music, but the plan is to add rhythmic elements at some point.
Bravura.Tonality provides all the harmonic building blocks of music.
It contains several types which have internal
constructors, which means you cannot create new instances. All instances are public static readonly
and are provided free of charge! Examples of these types are Note
, Accidental
, Pitch
, and Key
.
It also exposes several types for which you can create new instances, such as Interval
, ChordQuality
, Chord
, Mode
, and Scale
. You'll probably find most intervals, chord qualities, and modes have already been provided for you as public static readonly
instances, but chords and scales are all you, baby!
The Note struct is one of the internal types that can't be instantiated. It consists of a letter and a number. The letter should be obvious, I mean, we're talking about a musical note here. The number represents how many half-steps (semitones) it is above C. Why C? Well, we needed to choose a note as a frame of reference, and since the key of C has no sharps or flats it just seemed like the "natural" choice. ;)
It's important to keep in mind here that a Note is only the letter of the alphabet, not an actual pitch. We'll get to Pitches a bit later.
The 7 notes and their semitone values:
- C = 0 semitones above C Natural
- D = 2 semitones above C Natural
- E = 4 semitones above C Natural
- F = 5 semitones above C Natural
- G = 7 semitones above C Natural
- A = 9 semitones above C Natural
- B = 11 semitones above C Natural
An Accidental consists of a name, a number, and a symbol. The number represents how many half-steps (semitones) away from Natural that it will change the Note that it's paired with. New accidentals, like notes, cannot be instantiated.
The 5 accidentals and their semitone values:
- Double Flat (♭♭): -2 semitones
- Flat (♭): -1 semitones
- Natural (♮): 0 semitones
- Sharp (♯): 1 semitones
- Double Sharp (♯♯): 2 semitones
A Pitch is the combination of a Note and an Accidental. Two pitches are considered to be enharmonically equal when their distance (in semitones) above C natural are the same. New pitches cannot be instantiated. All instances are exposed through the static class Pitches.
An Interval is the distance (in semitones) between two pitches. You can create new instances of intervals, although all intervals within an octave are exposed through the static class Intervals.