Note find

Finds notes by what they are: a pitch, ranges of velocity, length and chance, in or out of the scale, active or not, every few, or the rest.

Audio UI

Installation

pnpm dlx shadcn@latest add @audio-ui/note-find

Usage

import { findNotes } from "@audio-ui/core/piano-roll";
import { NoteFind } from "@/components/audio-ui/note-find";

<NoteFind
  onFind={(query) => setSelection(findNotes(notes, query))}
  scale={scale}
/>;

NoteFind is a search button that opens the form in a popover. Pressing Select hands onFind a NoteQuery, and findNotes from @audio-ui/core/piano-roll returns the ids of the notes it matches, ready to be a Piano roll's selection. The query is data, so it can also feed anything else that reads notes: a step sequencer, a list, an agent's tool.

Each field narrows the notes found, and an empty one sets no limit:

  • Pitch: one pitch class, in any octave.
  • Scale: in the scale or out of it. Off until scale is given.
  • State: active notes, or deactivated ones.
  • Every: of the notes found, in the order they play, every second, third or fourth.
  • Velocity (1 to 127), Length (in steps) and Chance %: a range, from and to, either end left open.
  • The notes that do not match: finds the rest instead.

Without the popover

NoteFindForm is the form alone, to put in a sheet, a sidebar or a panel of your own:

import { NoteFindForm } from "@/components/audio-ui/note-find";

<NoteFindForm onFind={selectFound} scale={scale} />;

API reference

NoteFind

Props · 2

NoteFindForm

Takes onFind and scale, and the props of a div.

Built by Ouest Labs, the source code is available on GitHub.
RSS