Skip to content

EZ Web Audio / Connectable

Interface: Connectable

Defined in: packages/core/src/interfaces/connectable.ts:10

Interface for audio sources with parameter control and routing.

Provides gain/pan control and audio parameter management via the fluent API. The update method accepts SoundControlType ('gain', 'pan', 'detune'). Oscillator overrides this to also accept 'frequency'.

Properties

audioSourceNode

audioSourceNode: OscillatorNode | AudioBufferSourceNode

Defined in: packages/core/src/interfaces/connectable.ts:12


changeGainTo()

changeGainTo: (value) => this

Defined in: packages/core/src/interfaces/connectable.ts:14

Parameters

value

number

Returns

this


changePanTo()

changePanTo: (value) => this

Defined in: packages/core/src/interfaces/connectable.ts:13

Parameters

value

number

Returns

this


percentGain

percentGain: number

Defined in: packages/core/src/interfaces/connectable.ts:11


update()

update: (type) => object

Defined in: packages/core/src/interfaces/connectable.ts:28

Update an audio parameter immediately: update(type).to(value).as(method).

Validation semantics (as of the R1#1 unification): 'gain' throws a ValidationError for negative values and warns on the console for values above 1; 'pan' warns for values outside [-1, 1] (the Web Audio API clamps these automatically, so it is not an error). This is the same validation changeGainTo()/changePanTo() apply — implementations route both through the same underlying check (see BaseParamController._update()) so update('gain').to(-1).as('ratio') and changeGainTo(-1) throw identically. 'detune' and 'frequency' (Oscillator only) are not range-validated.

Parameters

type

SoundControlType

Returns

object

to()

to: (value) => object

Parameters
value

number

Returns

object

as()

as: (method) => void

Parameters
method

RatioType

Returns

void