Sound
type: "sound" · Style: changes colours or paint, not the geometry. · Editor menu: Effect.
Inside an Event, plays a note each time it fires, with Tone.js: a Material (Wood, Metal, Paper, Glass, Drum) or Custom, a patch that describes a Tone.js instrument and its effects as data (never run as code), edited in the formula editor. Harder events play louder, larger elements lower (Size pitch), and the note sits left or right where it happened (Pan). It plays in the editor while playing and in Play, with a mute button (browsers only allow sound after a click on the page), and goes into the MP4 export as its sound track.
Parameters
Section titled “Parameters”| Param | Type | Default | Range | Notes |
|---|---|---|---|---|
preset |
enum | "wood" |
wood, metal, paper, glass, drum, custom |
not animatable; label: Material |
patch |
text | "{\n instrument: 'MembraneSynth',\n options: { pitchDecay: 0.008, octaves: 2, envelope: { attack: 0.001, decay: 0.12, sustain: 0, release: 0.05 } },\n note: 'G4',\n duration: 0.08,\n effects: [{ effect: 'Filter', frequency: 2400, type: 'lowpass' }],\n}" |
not animatable; only when preset is custom |
|
volume |
number | 0.8 |
min 0, max 1, step 0.01 | shown as a percentage in the editor (0.5 is 50 %) |
pitch |
number | 0 |
min -36, max 36, step 1 | unit: st |
sizePitch |
number | 0.5 |
min 0, max 1, step 0.01 | shown as a percentage in the editor (0.5 is 50 %); label: Size pitch |
pan |
number | 0.6 |
min 0, max 1, step 0.01 |
Missing parameters take their default. Numbers and angles (and points and colours) can be animated with a track { on: "modifier", modifier: "<id>", param: "<name>" } unless noted.
In a scene
Section titled “In a scene”Inside a node’s stack (effects run top to bottom):
{ "id": "event-1", "type": "event", "params": { "trigger": "impact", "threshold": 120, "full": 1200, "decay": 0.5, "time": { "$expr": "scene.time", "fallback": 0 }, "seed": 1 }, "children": [ { "id": "sound-1", "type": "sound", "params": { "preset": "wood", "patch": "{\n instrument: 'MembraneSynth',\n options: { pitchDecay: 0.008, octaves: 2, envelope: { attack: 0.001, decay: 0.12, sustain: 0, release: 0.05 } },\n note: 'G4',\n duration: 0.08,\n effects: [{ effect: 'Filter', frequency: 2400, type: 'lowpass' }],\n}", "volume": 0.8, "pitch": 0, "sizePitch": 0.5, "pan": 0.6 } } ]}Generated from the schema of @svertik/engine. See the index.