Skip to content

API Overview

mod provides a comprehensive set of audio components organized into categories:

Core

AudioProvider

The root component that initializes the Web Audio context.

tsx
<AudioProvider>
  {/* Your audio modules */}
</AudioProvider>

Learn more →

Sources

Components that generate audio signals:

CV Generators

Components that generate control voltage signals for modulation:

  • LFO - Low-frequency oscillator
  • ADSR - Envelope generator with gate input
  • Sequencer - Step sequencer
  • Clock - Timing source for triggers

Processors

Components that transform audio signals:

Mixers

Components that combine multiple audio signals:

Output

Component for audio output:

  • Monitor - Audio output with device selection

Visualizations

Components for visualizing audio signals:

Common Patterns

Component Structure

All mod components follow a consistent structure:

tsx
<Component input={inputRef} output={outputRef}>
  {(controls) => (
    <YourUI {...controls} />
  )}
</Component>

Props

  • input - ModStreamRef - Reference to input audio stream (processors/mixers/output only)
  • output - ModStreamRef - Reference to output audio stream (sources/processors only)
  • cv - ModStreamRef - Reference to CV input (optional, for modulatable parameters)
  • gate - ModStreamRef - Reference to gate input (ADSR only)
  • children - Render prop function that receives control functions

Render Props

Each component exposes controls through the render prop:

tsx
{({ parameter, setParameter, ... }) => (
  <input
    value={parameter}
    onChange={(e) => setParameter(e.target.value)}
  />
)}

Type Definitions

tsx
import type {
  ModStreamRef,
  ModStream,
  ToneGeneratorProps,
  ToneGeneratorRenderProps,
  // ... etc
} from '@mode-7/mod';

Next Steps

Explore the detailed API documentation for each component, or check out the Getting Started Guide to start building.

Released under the MIT License.