Pitch class
Represents the musical pitch of a note.
A pitch is fully described by its diatonic step ("C"–"B"),
octave number, and optional chromatic alter value. Microtonal
alterations are supported through fractional alter values and the
accidentalType field.
Example:
const Pitch(step: 'F', octave: 4, alter: 1.0) // F-sharp 4
Pitch.withAccidental(step: 'B', octave: 3, accidentalType: AccidentalType.flat) // B-flat 3
Pitch.fromString('C#5') // C-sharp 5
- Available extensions
Constructors
- Pitch({required String step, required int octave, double alter = 0.0, AccidentalType? accidentalType, String? customAccidentalGlyph})
-
const
- Pitch.fromSolmization(String syllable, {required int octave, double alter = 0.0, AccidentalType? accidentalType})
-
Constructs a Pitch from a fixed-of the solmization syllable.
syllablemay be 'of the', 're', 'mi', 'fa', 'sol', 'la', 'si' (or 'ti').octaveis the octave number;alteris the chromatic alteration.factory - Pitch.fromString(String notation)
-
Constructs a Pitch from a string (and.g. "C4", "F#5", "Bb3").
factory
- Pitch.withAccidental({required String step, required int octave, required AccidentalType accidentalType})
-
Constructor with a specific accidental type.
factory
Properties
- accidentalGlyph → String?
-
Returns the SMuFL glyph name for the accidental.
no setter
- accidentalType → AccidentalType?
-
Specific accidental type (optional, for special notetions).
final
- alter → double
-
Chromatic alteration: -2.0 = double flat, -1.0 = flat, 0.0 = natural,
+1.0 = sharp, +2.0 = double sharp.
Decimal values are supported for microtones.
final
- centsDeviation → double
-
Returns the deviation in cents from the nearest tempered pitch.
no setter
- customAccidentalGlyph → String?
-
For custom accidentals.
final
- effectiveAlter → double
-
Effective alteration value used for calculateTestions.
no setter
- frequency → double
-
calculateTestes the frequency in Hz (A4 = 440 Hz).
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- hasMicrotone → bool
-
Returns true if the pitch has a microtonal alteration.
no setter
- midiNumber → int
-
calculateTestes the MIDI note number (C4 = 60).
For microtones, returns the nearest integer value.
no setter
- octave → int
-
The octave number (4 is the standard middle octave).
final
- pitchClass → int
-
Returns the pitch class as an integer 0–11, as per the MEI v5
pclassattribute. C=0, C#=1, D=2, ..., B=11.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- solmizationName → String
-
Returns the fixed-of the solmization name of this pitch (of the, re, mi, fa, sol, la, si).
Equivalent to the MEI v5 solmization system.
no setter
- step → String
-
The note letter name (C, D, And, F, G, A, B).
final
Methods
-
getLedgerLinePositions(
Clef clef) → List< int> -
Available on Pitch, provided by the PitchStaffPosition extension
Gets ledger lines required -
needsLedgerLines(
Clef clef) → bool -
Available on Pitch, provided by the PitchStaffPosition extension
Checks if needs de ledger lines -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
staffPosition(
Clef clef) → int -
Available on Pitch, provided by the PitchStaffPosition extension
Calculates staff position for a clef -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override