sightPhraseExercise function

SightExercise sightPhraseExercise(
  1. SightStep step,
  2. Random rng, {
  3. SightPlan? plan,
})

Um exercício de frase de uma receita: a forma, a harmonia e a melodia sobre ela (T06). A direita canta sobre a harmonia e a esquerda a toca em baixos e acordes; o T07 escolhe as texturas e o resto. O plan sai da receita, no modo do tom do passo, quando não é dado.

Implementation

SightExercise sightPhraseExercise(
  SightStep step,
  Random rng, {
  SightPlan? plan,
}) {
  final recipe = step.recipe!;
  plan ??= sightPlan(recipe, rng, minor: step.tonic.endsWith('m'));
  assert(plan.barTicks == step.ticksPerMeasure, 'o compasso do plano');
  final harmony = sightProgression(plan, recipe, rng);
  final right = _planTune(step, rng, (
    plan: plan,
    harmony: harmony,
    range: recipe.rightRange,
  ));
  final left = _planBass(step, plan, harmony);
  final silent = [
    for (var m = 0; m < plan.bars; m++) [_Fig(step.unitsPerMeasure)],
  ];
  final (r, l) = switch (step.hands) {
    SightHands.right => (right, silent),
    SightHands.left => (silent, right),
    SightHands.both => (right, left),
  };
  return SightExercise(
    step: step,
    right: [_voice(r)],
    left: [_voice(l)],
    texture: step.hands == SightHands.both ? SightTexture.acompanhamento : null,
    harmony: harmony,
  );
}