К содержимому
sound·design галерея

← Все справочники · исходный .md · справочники написаны для агента, поэтому на английском

Ambience: beds, loops, scenes that change

Contents

  1. Anatomy of an ambience
  2. Kernels for beds
  3. One-shots for emitters
  4. Loops that do not betray themselves
  5. Scenes, zones and transitions
  6. Realtime mixing in the browser
  7. Recipes by place
  8. Verifying

1. Anatomy

An ambience is three strata, and they are produced and shipped differently:

StratumExamplesCharacterShip as
Bedwind, rain wash, traffic roar, room tone, sea, machine humcontinuous, no identifiable eventskernel (endless) or seamless loop
Texture eventsdrips, bird calls, clinks, distant horns, creaks, footstepssparse, recognisable, would expose a loopseparate one-shots scattered at random times (emitters)
Spacereverb of the place, muffling by walls, distancechanges with where the listener iszone parameters applied at mix time

Never bake recognisable events into a loop, never bake the room into a bed that must be reused elsewhere, and never leave digital silence — the quietest room still has RoomTone.

2. Kernels for beds

All are parametric in realtime and loopable (opts.period). Parameters are listed in each class's static params with ranges and meaning; summary:

Kernel (name)ParametersNotes
Wind (wind)speed, gust, whistle, leaves, rumblewhistle = howling through gaps; leaves = trees; opts.whistles: [Hz…]
Rain (rain)intensity, near, dropSizeopts.surface: any SURFACES key — roof, leaves, water, tent (drumSkin), window (glass)
Fire (fire)size, crackle, hisscandle → campfire → blaze
Stream (stream)flow, sizebubble cloud: trickle, brook, torrent, pouring
Sea (sea)height, period, distancethree wave trains; loop mode fits whole waves into the period
Birds (birds)density, distanceopts.individuals, fmin, fmax; each bird keeps its motif
Insects (insects)density, pitch, trillcrickets (chirps) ↔ cicadas (trill)
Traffic (traffic)density, distanceroar bed only; add pass-bys as emitters
Engine (engine)rpm, load, size, roughopts.cylinders; idle, drive-by source, generator, boat
Machine (machine)rate, clank, hiss, whirr, humcyclic: press, loom, pump; opts.material, f0, pattern
Hum (hum)freq, bright, odd, wobblemains, transformer, fridge, neon, sci-fi core
Air (air)flow, tone, rpm, ductvents, AC, server room, cabin
Clock (clock)period, size, swingtick ≠ tock; pocket watch → longcase
RoomTone (roomTone)level, air, humthe "silence" of interiors
GrainFlow (grains)see sand.mdhail, sand, debris beds

Combine and re-parameterize freely: a cave = Stream (low flow) + drips + Wind (rumble only); a spaceship = Hum (freq 90, wobble) + Air + Machine (slow, quiet). Write a new kernel when none fits: extend Kernel, declare static params, implement process(L, R, n), call register(name, Class) — it immediately works offline, in the worklet and in scenes.

3. One-shots for emitters

birdCall, thunder, horn, siren, strike/strikes (cups, tools, bells, doors), crunch (steps), shatter, speak/crowd (voices), whoosh (gusts, passes), spatialize(engineBuf, { path: passBy(...) }) (vehicles), recorded samples through enhance. An emitter is { make(rng, sr) → buf, every: [minS, maxS] }: make it return a different sound every time (seeded variation of pitch, size, force, call pattern).

4. Loops that do not betray themselves

Three methods, by material:

MaterialMethodWhy
Kernel bedsloopKernel(name, opts, { seconds, xfade })makes the slow modulations periodic over the loop, then crossfades the remaining waveform seam: level and tone at the end equal the start
Any stationary recording or rendermakeLoop(buf, { seconds, xfade })equal-power crossfade of the tail into the head (1–3 s for noise-like beds)
Event-based content with tails (drips in a cave, a clock in a hall)tailWrap(buf, seconds)start events only inside the loop length, let tails overrun, fold the overrun onto the start — no crossfade, every tail completes
A short recordinggranulate(buf, { seconds })grains wrap around, texture never repeats inside the loop

Rules of thumb: beds 15–60 s; give layers unequal, non-commensurate lengths (17 s, 23 s, 31 s) so the combination repeats only after hours; keep loudness within about ±2–3 dB across a loop unless the pulsing is the content (surf, machinery); the more featureless the bed, the shorter it may be (steady hum: 4 s is fine). Realtime kernels need no loop at all — prefer them when the platform allows.

5. Scenes, zones and transitions

A zone is a snapshot of "how the world sounds from here": per-layer level and low-pass (how muffled each bed is from this spot), which emitters are audible, and the room. A timeline moves between zones. renderScene(scene) renders it offline; each zone has its own reverb bus, so a temple's tail keeps ringing while the corridor fades in.

const scene = {
  seconds: 30, seed: 7,
  layers:   { wind: { kernel: 'wind', opts: { speed: 0.55 } }, traffic: { kernel: 'traffic' },
              roomTone: { kernel: 'roomTone' }, clock: { kernel: 'clock', opts: { period: 2, size: 0.8 } } },
  emitters: { horn: { make: (r, sr) => sd.mono(sd.horn(sr, { size: r.range(0.2, 0.8) }), sr), every: [2, 5], gainDb: -14 },
              cups: { make: (r, sr) => sd.mono(sd.strike(cupModes(r), { sr, velocity: r.range(0.3, 0.9), hardness: 0.9 }), sr), every: [0.6, 2.2], gainDb: -10 } },
  zones: {
    sky:      { layers: { wind: 0, traffic: -6 }, emitters: { horn: 0 }, room: 'openField', wetDb: -20 },
    temple:   { layers: { wind: { db: -16, lp: 700 }, traffic: { db: -24, lp: 400 }, roomTone: -6 }, emitters: { horn: -26 }, room: 'temple', wetDb: -5 },
    corridor: { layers: { wind: { db: -30, lp: 300 }, roomTone: -3, clock: { db: -22, lp: 1500 } }, room: 'corridor', wetDb: -8 },
    room:     { layers: { roomTone: 0, clock: 0 }, emitters: { cups: 0 }, room: 'smallRoom', wetDb: -22 } },
  timeline: [{ t: 0, zone: 'sky' }, { t: 10, zone: 'temple', xfade: 1.2 }, { t: 18, zone: 'corridor', xfade: 1.5 }, { t: 23, zone: 'room', xfade: 1 }],
};
const mixdown = sd.master(sd.renderScene(scene), { target: -20, glue: 0 });

Design notes:

6. Realtime mixing in the browser

AmbienceMixer.create(ctx, scene) builds the same scene from Web Audio nodes: kernels in worklets (or loops from buffers), one gain + low-pass per layer, one ConvolverNode per zone, send gains that crossfade. mix.goto('temple', 1.5) from game logic; mix.play(timeline) for scripted moves; mix.layer('wind').set({ speed: 0.9 }) to change a bed's parameters live (storm arriving). Emitters are scheduled on the audio clock with fresh variations. Positioned emitters: route through SpatialSource instead of the stereo panner. Budget: each convolver costs CPU — keep zones to those reachable; for many rooms reuse 3–4 IRs and vary wet/pre-delay.

7. Recipes by place (starting points — make them particular)

PlaceBedEmittersSpace
City street, daytraffic (density 0.6, distance 0.3), air, crowd wallapass-bys (engine + Doppler), horns, sirens far, door, footsteps, bicycle bellstreetCanyon, slap echoes
City from above / rooftopwind (speed 0.5, rumble), traffic (distance 0.8)far horns, siren, helicopter, flag flapopenField, almost dry
Forest, daywind (leaves 0.6), stream far, insects lowbirds (several species), twig cracks, woodpeckerforest (sparse, soft)
Night fieldinsects (crickets), light windowl, dog far, frogopenField
Seashoresea, wind (rumble)gulls (birdCall f 1500–2500, harsh), rope/mast clinksopenField
Stormrain (intensity 0.8), wind (gust 0.8, whistle)thunder (distance varies), shutter bang, debrisby shelter: sheetMetal roof, glass window
Factory floormachine ×2 at unrelated rates, hum, air (duct)clanks, pneumatic bursts, forklift beeper, shouts (mumble + pa)warehouse
Office / homeroomTone, air (low), hum (fridge)clock, cups, keyboard ticks, chair creak, fabriclivingRoom / smallRoom
Temple / cathedralroomTone (level 0.3), outside beds heavily low-passedfootsteps, a bell, cloth, a cough far awaytemple / cathedral, wet −6 dB
Cavestream (flow 0.1), wind (rumble only)drips (tailWrap loop or emitters), stonescave
Spaceship / labhum (freq 80–120, wobble), airbeeps, relay clicks, door hisscorridor, short and metallic

8. Verifying