Oscilloscope

oscilloscopeVisualizers

Feed it an analyser or a data callback and it draws the current frame at animation rate. Columns are plotted as min/max pairs so transients survive the downsample instead of being skipped over, and the zero-crossing trigger stops a steady tone from sliding across the display.

Synthetic signal for display only — this demo produces no audio.

Install

Copies the source into your project. Anything it depends on comes with it.

$ npx shadcn add @syntho-ui/oscilloscope

Pulls in

use-audio-sourcecontrol-theme

First time? Add the registry to your components.json once:

components.json
{
  "registries": {
    "@syntho-ui": "https://engine.syntho.app/r/{name}.json"
  }
}

Usage

Controlled or uncontrolled, whichever suits the surrounding state.

example.tsx
import { Oscilloscope } from "@/components/ui/oscilloscope"

<Oscilloscope analyser={analyserNode} height={140} trigger />

Props

PropTypeDefaultDescription
analyserAnalyserNodeA live analyser to read time-domain data from.
getData(target: Float32Array) => boolean | voidSupply samples yourself instead of using an analyser.
triggerbooleantrueAlign each frame to a rising zero crossing so a steady tone stands still instead of sliding.
gainnumber1Vertical zoom. 1 means a full-scale signal fills the display.
lineWidthnumber1.5Trace thickness in CSS pixels.
colorstringTrace colour. Defaults to the --uikit-accent token.
showGridbooleantrueDraw the centre line and vertical divisions.
heightnumber140Display height in pixels; width defaults to 100%.
pausedbooleanfalseStop the animation loop and hold the last frame.

Interaction

  • Drag with pointer capture, so the gesture keeps tracking past the edge of the control.
  • Shift while dragging for a fine pass; release it mid-gesture and coarse tracking resumes.
  • Double-click resets to defaultValue.
  • Arrow keys step normally, Shift+arrow steps finely, PageUp/PageDown jump by ten, Home/End go to the extremes.
  • Proper slider and switch roles with live aria-valuetext, so a screen reader announces the formatted value rather than the raw number.
  • The scroll wheel adjusts the value while the pointer is over the control; stepped ranges move at least one declared step per notch by default.