skip to content

Synth

A versatile element for creating synth sounds. The sound is sculpted using any number of subject <carrier-blam> and <modulator-blam> elements. Each of which can use any type of waveform and be associated with any <chain-blam> effects. In addition, modulation elements like <lfo-blam> and event-reactive elements like <blam-blam> can be used per <synth-blam> and/or per constituent operator (<carrier-blam> or <modulator-blam>).

DRAFT! This element is in early development and is liable to change or possibly be replaced.

class
Synth
extends
SynthBase
tag
<synth-blam>
see

Props

name type default description
detune number 0

For <synth-blam>, the detune vaue is applied to all of its subject operators. For example, two <carrier-blam> elements and a <modulator-blam> element, with different frequencies, inside <synth-blam> will each be detuned by the same amount relative to the value set here.

notes string ’C4 D#4 G4’

A space-separated list of notes (with the numbers representing the octaves) to be played where the play() method is fired omitting its first “note” argument. By default, notes are chosen at random from this array. Unless there is only one note, or there are multiples of the same note included, no note is ever played twice in a row.

robin boolean false

Whether to play the notes at random (false) or in order (true).

gain number 1

The overall output level of the element.

out string

The element to which the output is connected. This should rarely be changed, since SynthBase-derived elements have good sensible defaults.

Events

type description
blam

Fired whenever play() is executed. Contains the time data property as standard (which is used in synchronization by various elements). Proxy for subject operators’ play() methods.

blamstop

Fired whenever stop() is executed. Contains the time data property as standard (which is used in synchronization by various elements). Proxy for subject operators’ stop() methods.

Methods

name args description
play

note: The note (e.g. D#4) to play. time: When, relative to the context’s currentTime, to play the sound. Immediately, if not set.

Plays each of the subject/descendant operator elements simultaneously. To put it another way, makes a synthy sound.

stop

time: When, relative to the context’s currentTime, to play the sound. Immediately, if not set.

Triggers the release ramp for notes currently playing. This is applied automatically at the start of each play() but may be needed for manual intervention too.

Examples

Examples that use the Synth element: