Pitch constructor
const
Pitch({
- required String step,
- required int octave,
- double alter = 0.0,
- AccidentalType? accidentalType,
- String? customAccidentalGlyph,
Creates a pitch from a diatonic step, an octave and an optional
chromatic alter.
In debug builds the step must be one of validSteps (uppercase) and
the octave must be in the MIDI-representable range [-1, 10].
Implementation
const Pitch({
required this.step,
required this.octave,
this.alter = 0.0,
this.accidentalType,
this.customAccidentalGlyph,
}) : assert(
step == 'C' ||
step == 'D' ||
step == 'E' ||
step == 'F' ||
step == 'G' ||
step == 'A' ||
step == 'B',
'Invalid pitch step (expected one of C D E F G A B)',
),
assert(
octave >= -1 && octave <= 10,
'Octave out of range (expected -1..10)',
);