Recipes
Recipes
Click. Hear. Copy. Paste. Six clickable patterns covering most of the engine.
Every recipe below is a live React island running the actual engine. Click the buttons; hear the result; copy the snippet next to it into your project.
1. Slot reel — layered SFX with sample-accurate scheduling
engine.scheduleAt(engine.now, () => engine.sound('reel-spin').play());
// Tick during spin
for (let t = 0; t < 1.6; t += 0.12) {
engine.scheduleAt(engine.now + t, () => engine.sound('reel-tick').play({ volume: 0.5 }));
}
// Stagger the three reel-stops
[1.0, 1.4, 1.8].forEach((delay) => {
engine.scheduleAt(engine.now + delay, () => engine.sound('reel-stop').play({ pitch: { jitter: 0.06 } }));
});
// Win sting on top
engine.scheduleAt(engine.now + 2.1, () => engine.sound('win-sting').play({ volume: 0.9 })); 2. Random pitch / volume jitter — make stacked SFX feel organic
for (let i = 0; i < 6; i++) {
engine.sound('hit').play({
pitch: { jitter: 0.08 },
volume: { jitter: 0.05 },
});
} 3. Bus crossfade — click-free with curve
engine.bus('music').fadeTo(0, 1200, 'equal-power'); 4. Voice limit + steal strategy
engine.bus('sfx').setConcurrency({ max: 8, steal: 'lowest-priority' });
engine.sound('hero-attack').play({ priority: 10 });
engine.sound('footstep').play({ priority: 0 }); 5. Snapshot crossfade — switch the whole mix
const menu = engine.snapshot('menu', {
buses: { music: { level: 0.8, muted: false }, sfx: { level: 0.3, muted: false } },
parameters: {},
});
await menu.apply({ fadeMs: 800 }); 6. Parameter modulator — one knob, many targets
const intensity = engine.parameter('intensity', 0.3);
intensity.bindTo((v) => engine.bus('music').level = v, { from: 0.3, to: 1, curve: 'easeInOut' });
intensity.set(0.7);