normalize method
Normalizes the durations in the rhythm pattern so that they sum to 1.0.
Implementation
RhythmPattern normalize() {
final total = totalDuration;
if (total == 0.0) {
return RhythmPattern(durations.map((d) => 1.0 / durations.length).toList()); // Avoid division by zero
}
return RhythmPattern(durations.map((duration) => duration / total).toList());
}