Hiyve Components - v1.0.0
    Preparing search index...
    • Follow the score while a take is being recorded.

      Wire pushAudio and pushMidi to the recorder's onAudioChunk and onMidiEvent; the hook runs a LiveSession on whichever input source names, and snapshot carries a verdict for every expected note as soon as it is heard — provisional first, confirmed a little later — together with the performer's position and tempo. finish() grades the session.

      A session starts with the first input after a score is set and after each finish() or reset(), so one hook serves take after take. setTempo makes the next session judge against a set tempo — a metronome's, or a backing track's — instead of the performer's own; given the take's clock it keeps the beat moving between notes. A session that has placed nothing yet starts over on a new setting, so a clock read a moment after the first input still applies.

      Parameters

      Returns UseLivePerformanceResult

      const live = useLivePerformance({ score, source: 'audio' });
      <TakeRecorder onRecordingStarted={live.reset} onAudioChunk={live.pushAudio} onTakeCompleted={() => live.finish()} />
      {live.snapshot && <ScoreView verdicts={live.snapshot.verdicts} cursor={live.snapshot.cursor} />}