dart-tonic
dart-tonic copied to clipboard
PitchClass octave
In the example, passing the octave does not seem to be an option anymore.
════════ Exception caught by widgets library ═══════════════════════════════════
E4 is not a pitch class name
The relevant error-causing widget was
https://github.com/osteele/dart-tonic/blob/4454afd1ddb03f83fd3d8ee1e43dca7f6ae52563/example/tonic_example.dart#L75
For anyone looking for this functionality, this is what I am currently using:
import 'package:tonic/tonic.dart';
List<Pitch> toPitch(List<PitchClass> pitchClasses, int octave) {
var _octave = octave ?? 0;
return pitchClasses
.asMap()
.map((i, e) {
if (i > 0 && pitchClasses[i - 1].integer > e.integer) {
_octave += 1;
}
return MapEntry(i, e.toPitch(octave: _octave));
})
.values
.toList();
}