Note
Note class holds a note's name and octave number. To get an instance of Note
, call appropriate Get
(for example, Get(noteName, octave)) static method or parse a note from string. You can also get specific note using corresponding property of Octave class.
Some examples of usage:
// Get note with number of 100
var note1 = Note.Get((SevenBitNumber)100);
// Get A#2 note
var note2 = Note.Get(NoteName.ASharp, 2);
// ... or
var note3 = Octave.Get(2).ASharp;
// Parse a note
var note4 = Note.Parse("a3");
var note5Parsed = Note.TryParse("c#2", out var note5);
Also see the Interval article for additional examples.
Parsing
Following strings can be parsed to Note
:
NoteName Accidental Accidental ... Accidental OctaveNumber
where
- NoteName is one of the letters:
C
,D
,E
,F
,G
,A
orB
. - Accidental is one of the following strings:
#
orsharp
for sharp;b
orflat
for flat.
- OctaveNumber is the number of an octave. A number must be between
-1
and9
.
Examples of valid note strings:
D3
F##3
Fb 1
C#b4