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

    What useNoteSynth returns.

    interface UseNoteSynthResult {
        needsGesture: boolean;
        play: (
            midi: number | readonly number[],
            durationMs?: number,
            listener?: NoteSynthListener,
        ) => () => void;
        playInOrder: (
            midis: readonly number[],
            stepMs?: number,
            durationMs?: number,
            listener?: NoteSynthListener,
        ) => () => void;
        preload: (midis: readonly number[]) => Promise<void>;
        supported: boolean;
    }
    Index

    Properties

    needsGesture: boolean

    The browser held the last sound back until the page is tapped — as iOS does with sound not started from a tap — so nothing was heard. Play again from a tap or a click; it is false again once sound runs

    play: (
        midi: number | readonly number[],
        durationMs?: number,
        listener?: NoteSynthListener,
    ) => () => void

    Sound a note, or several together; does nothing without Web Audio. listener is told as each note starts and stops sounding, by its place in midi. Returns a function that stops the notes early

    playInOrder: (
        midis: readonly number[],
        stepMs?: number,
        durationMs?: number,
        listener?: NoteSynthListener,
    ) => () => void

    Sound notes one after another, stepMs apart (default: 500). listener is told as each note starts and stops sounding, by its place in midis. Returns a function that stops what is left

    preload: (midis: readonly number[]) => Promise<void>

    Download the samples of some keys ahead of time; nothing to do without samples

    supported: boolean

    Whether this browser can sound notes