AudioUnit

interface AudioUnit extends MIDIEffectHost, AudioEffectHost { midiEffects: readonly AnyMIDIEffect[] audioEffects: readonly AnyAudioEffect[] uuid: string kind: AudioUnitKind label: string output: Nullable<AuxAudioUnit | GroupAudioUnit | OutputAudioUnit> volume: number panning: number mute: boolean solo: boolean index: number tracks: readonly AnyTrack[] noteTracks: readonly NoteTrack[] audioTracks: readonly AudioTrack[] valueTracks: readonly ValueTrack[] addMIDIEffect<K extends keyof MIDIEffects>(key: K, props?: DeepPartial<MIDIEffects[K]>, index?: number): MIDIEffects[K] addAudioEffect<K extends keyof AudioEffects>(key: K, props?: DeepPartial<AudioEffects[K]>, index?: number): AudioEffects[K] addNoteTrack(props?: Partial<Pick<Track, 'enabled'>>, index?: number): NoteTrack addAudioTrack(props?: Partial<Pick<Track, 'enabled'>>, index?: number): AudioTrack addValueTrack<T extends Automatable>(target: T, parameter: ParameterPath<T>, props?: Partial<Pick<Track, 'enabled'>>, index?: number): ValueTrack valueTrack<T extends Automatable>(target: T, parameter: ParameterPath<T>): Nullable<ValueTrack> remove(): void }

A channel in the mixer: devices, tracks, volume, pan and routing

Hierarchy


Properties

midiEffects: readonly AnyMIDIEffect[]

readonly

Inherited from midiEffects

MIDI effects ordered by index

audioEffects: readonly AnyAudioEffect[]

readonly

Inherited from audioEffects

Audio effects ordered by index

uuid: string

readonly

Unique id

kind: AudioUnitKind

readonly

Unit type identifier

label: string

Custom label

output: Nullable<AuxAudioUnit | GroupAudioUnit | OutputAudioUnit>

Output routing (null = unplugged). Defaults to the primary output

volume: number

Volume in dB (-96 to 6, default 0)

panning: number

Pan (-1.0 = left, 0.0 = center, 1.0 = right)

mute: boolean

Mute

solo: boolean

Solo

index: number

readonly

Position in the project (instruments first, then aux, groups, output)

tracks: readonly AnyTrack[]

readonly

All tracks ordered by index

noteTracks: readonly NoteTrack[]

readonly

Note tracks

audioTracks: readonly AudioTrack[]

readonly

Audio tracks

valueTracks: readonly ValueTrack[]

readonly

Automation tracks

Methods

addMIDIEffect< K extends keyof MIDIEffects, >( key: K, props?: DeepPartial<MIDIEffects[K]>, index?: number, ): MIDIEffects[K]

Inherited from addMIDIEffect

Add a MIDI effect

Type Parameters

Parameters

  • key (K) — Effect type
  • props (DeepPartial<MIDIEffects[K]>, optional) — Initial parameter values
  • index (number, optional) — Insert position (default: end of chain)

Returns

Example

CODE
synth.addMIDIEffect("Arpeggio", {rate: 9, octaves: 2})

addAudioEffect< K extends keyof AudioEffects, >( key: K, props?: DeepPartial<AudioEffects[K]>, index?: number, ): AudioEffects[K]

Inherited from addAudioEffect

Add an audio effect

Type Parameters

Parameters

  • key (K) — Effect type
  • props (DeepPartial<AudioEffects[K]>, optional) — Initial parameter values
  • index (number, optional) — Insert position (default: end of chain)

Returns

Example

CODE
synth.addAudioEffect("Delay", {delay: 13, feedback: 0.4, wet: -9})
const composite = synth.addAudioEffect("Composite")
composite.addEntry({label: "Crushed"}).addAudioEffect("Crusher", {bits: 8})

addNoteTrack( props?: Partial<Pick<Track, 'enabled'>>, index?: number, ): NoteTrack

Add a note track (only meaningful for note instruments)

Parameters

  • props (Partial<Pick<Track, "enabled">>, optional)
  • index (number, optional)

Returns

addAudioTrack( props?: Partial<Pick<Track, 'enabled'>>, index?: number, ): AudioTrack

Add an audio track (only meaningful for audio instruments like Tape)

Parameters

  • props (Partial<Pick<Track, "enabled">>, optional)
  • index (number, optional)

Returns

addValueTrack< T extends Automatable, >( target: T, parameter: ParameterPath<T>, props?: Partial<Pick<Track, 'enabled'>>, index?: number, ): ValueTrack

Add an automation track for a parameter

Type Parameters

Parameters

  • target (T) — Any automatable object (this unit, a device, a send, ...)
  • parameter (ParameterPath<T>) — Parameter path, e.g. "cutoff" or "lfo.rate"
  • props (Partial<Pick<Track, "enabled">>, optional)
  • index (number, optional)

Returns

Example

CODE
const lane = synth.addValueTrack(synth.instrument, "cutoff")
lane.addRegion({duration: PPQN.Bar * 4}).addEvents([
    {position: 0, value: 0.2},
    {position: PPQN.Bar * 4, value: 0.9}
])

valueTrack< T extends Automatable, >( target: T, parameter: ParameterPath<T>, ): Nullable<ValueTrack>

The automation track controlling a parameter, if any

Type Parameters

Parameters

  • target (T)
  • parameter (ParameterPath<T>)

Returns

remove(): void

Remove this unit including all its tracks and devices (the output cannot be removed)

Returns

  • void