Hiyve Components - v1.0.0
    Preparing search index...

    Follow a performance through a score as it happens.

    Feed it audio as it is captured (pushAudio) or MIDI notes as they arrive (pushMidi); it finds each attack, decides where in the score it belongs, and reports a verdict for every expected note — first a quick provisional one, then a confirmed one once enough of the note has been heard. A placement the audio alone cannot settle — a wrong note looks like a skipped one until the note after it — stays provisional until the next attack chooses between the alternatives, or until commitAfterMs has passed. The current snapshot is available at any time (getSnapshot) and after every change through onUpdate.

    By default the session follows the performer's own tempo. With tempo it judges against a set one: timing is early or late against the beat, an event whose beat passes unplayed shows as missing until a note claims it, and clockQuarters says where the beat is.

    Audio and MIDI are two ways of hearing the same performance; push one or the other, not both, or every attack is counted twice.

    const session = new LiveSession(score, { sampleRate: 48000, onUpdate: ({ snapshot }) => render(snapshot) });
    worklet.port.onmessage = ({ data }) => session.pushAudio(data.channels);
    // … later …
    const report = session.finish() && session.report();
    Index

    Constructors

    Properties

    events: ScoreEvent[]

    The events of the followed region, in score order

    score: Score

    Accessors

    • get streamTimeMs(): number

      Milliseconds of audio consumed, or the latest MIDI or tick time

      Returns number

    Methods

    • Where the running tempo places a stream time in the score, or null before a tempo is known.

      Parameters

      • timeMs: number

      Returns number | null

    • Consume the next chunk of captured audio — one channel, or several to be mixed. Chunks must be shorter than a second or two; an attack's spectrum is read from the most recent four seconds.

      Parameters

      • samples: Float32Array<ArrayBufferLike> | readonly Float32Array<ArrayBufferLike>[]

      Returns void

    • Let time pass without input: closes a MIDI chord whose window has elapsed and settles an overdue placement.

      Parameters

      • nowMs: number

      Returns void