Files
skills/plugins/document-navigator/docs/media/audio/audio-transport/README.md
2026-06-09 21:06:27 +01:00

3.8 KiB

@suaveplan/audio-transport - Universal musical clock and transport: sample-accurate scheduling with PPQ, BPM automation, swing, time signatures, and loop regions. Zero browser or Node dependencies.

Universal musical clock and transport: sample-accurate scheduling with PPQ, BPM automation, swing, time signatures, and loop regions. Zero browser or Node dependencies.

Documentation tree

  • error-codes — This module defines the canonical error codes, metadata, and error class for the @suaveplan/audio-transport package.…
    • error-codes — This module defines the canonical error codes, metadata, and error class for the @suaveplan/audio-transport package.…
  • scheduler — The TransportScheduler class drives the lookahead loop that polls the transport and fires scheduled callbacks. It bri…
    • scheduler — The TransportScheduler class drives the lookahead loop that polls the transport and fires scheduled callbacks. It bri…
    • scheduler.schemas — Zod boundary schema for TransportScheduler construction options.
  • signal — The Signal class implements a piecewise automation curve for scalar parameters such as BPM. It stores automation poin…
    • signal — The Signal class implements a piecewise automation curve for scalar parameters such as BPM. It stores automation poin…
    • signal.schemas — Zod boundary schema for Signal construction options.
  • tick-source — The TickSource class converts between audio time (seconds) and musical ticks, integrating tempo curves for sample-acc…
    • tick-source — The TickSource class converts between audio time (seconds) and musical ticks, integrating tempo curves for sample-acc…
    • tick-source.schemas — Zod boundary schema for TickSource construction options.
  • time — This module parses musical time tokens and converts between ticks, seconds, and bars:beats:sixteenths notation.
    • time — This module parses musical time tokens and converts between ticks, seconds, and bars:beats:sixteenths notation.
    • time.schemas — Zod boundary schemas for time-related types.
  • transport — The Transport class is the core musical clock and scheduler. It manages playback state, event scheduling, loop region…
    • transport — The Transport class is the core musical clock and scheduler. It manages playback state, event scheduling, loop region…
    • transport.schemas — Zod boundary schema for Transport construction options.

Install

bun add @suaveplan/audio-transport

Quick start

import { Transport, TransportScheduler } from "@suaveplan/audio-transport";

const clock = () => Date.now() / 1000;
const tr = new Transport({ clock, bpm: 120, ppq: 192 });
const scheduler = new TransportScheduler(tr, clock);

tr.scheduleRepeat((time) => {
    console.log("beat at", time);
}, "4n");

tr.start();
scheduler.start();

Modules