API / MusicTheory
TunedPitch record
A note plus a deviation in cents from its 12-TET pitch: a tuner reading or a microtonal pitch.
Constructors
TunedPitch(Note note, double cents)Creates a pitch
cents above (or below, when negative) note.note- The nearest 12-TET note.
cents- The deviation in cents, strictly between -100 and 100.
Throws ArgumentNullException note is null.
Throws ArgumentOutOfRangeException cents is not finite or not in (-100, 100).
Properties
Note Note { get; }The nearest 12-TET note.
double Cents { get; }The deviation from
TunedPitch.Note in cents.Methods
static double CentsBetween(double fromHz, double toHz)The distance in cents from
fromHz to toHz: 1200 per octave.Throws ArgumentOutOfRangeException Either frequency is not a positive, finite number.
double GetFrequency(double a4 = 440)The frequency in Hz, tuned to
a4.a4- The frequency of A4 in Hz.
Throws ArgumentOutOfRangeException a4 is not a positive, finite number.
string ToString()The note and its signed offset to one decimal, such as
A4 +23.4¢.