2.4 Sound — what makes a sound
The target is that what you see is what you hear: no flock (scattered, or jammed) → silence, scattered notes or a crackle; one big flock flowing as a wave → a continuous hum. Five sources make every sound, each from a relation between boids; all are sine waves, nothing is sampled, and nothing sounds by itself (radii 0 = silence).
| Source | When it sounds | Pitch | Length and loudness |
|---|---|---|---|
| Drone — one per flock, up to 4 (2.4.1) | while a flock exists (after 0.5 s) | height of the flock's centre: bottom 55 Hz → top 220 Hz (two octaves; the octave control moves it, 2.4.1). Four partials: an aligned flock is harmonic (1, 2, 3, 4 ×, clear), a disordered one bell-like (1, 2.76, 5.4, 8.9 ×, clashing) | continuous; fades in and out over about 1/3 s. Loudness = the flock's share of all boids; brightness = how stretched it is |
| Ping (2.4.1) | the moment a flock becomes highly ordered (0.85) | 4 × the flock's pitch | one note, rings 1.2 s |
| Encounter notes (2.4.2) | two boids enter each other's separation radius | the flock's pitch × a partial chosen by height on screen (high = high partial); on its harmonics when the flock is ordered, slightly free otherwise | very short: 0.08 s inside a flock, 0.4 s outside. Loudness = the pair's relative speed. At most 24 per second. Fade out as a boid trembles |
| Trembling crackle (2.4.3) | a boid pushed back and forth by its neighbours: its direction turns back more than 2.5 times a second | 4 × the pitch of an encounter note there: too short to be heard as a pitch | a 3 ms grain (a tick) per turn-back, so faster trembling crackles faster; louder from 2.5 to 7 turn-backs a second |
| Beat (key k, 2.4.5) | a flock's centre crosses a line of the invisible grid | the flock's 1st, 3rd and 8th partial | a short hit; a compact flock hits tight, a spread one longer and softer |
Drone, notes and crackle can each be muted while playing (d e j, on the controller strip 6); these are for playing only and never written into a score.
2.4.1 Macro — every flock sings
The four largest established flocks each get a drone voice: four sine partials forming one timbre. A voice fades in at its flock's own pitch when the flock forms, follows it, and fades out (~2 s) when the flock dissolves or merges away. With no flocks there is no drone.
| Flock measure | Sound | Mapping |
|---|---|---|
| centroid height | pitch | 55 – 220 Hz, exponential; top of screen = high. Jumps when the flock wraps across the top/bottom edge |
| centroid left/right | pan | −0.8 – 0.8, equal-power |
| polarization | harmonicity | partial ratios glide from bell-like (1, 2.76, 5.40, 8.93) to harmonic (1, 2, 3, 4) |
| size | loudness | 0.5 × flock size / all boids: the whole swarm as one flock is the loudest |
| elongation | brightness | upper-partial falloff 0.15 – 0.8 |
Ping: when a voiced flock's polarization rises above 0.85, a soft sine sounds two octaves above that flock's pitch (30 ms attack, 1.2 s release); it re-arms below 0.70.
Octave: the whole register — drones, pings, notes, crackle and beat — moves by whole octaves, −2 … +2 (MIDI knob 6, score cue octave). It jumps rather than glides, and the notes keep their relation to the drone. Notes above 18 kHz are left out: two octaves up, the crackle would alias.
2.4.2 Micro — encounter notes
- Each encounter plays one short sine note: height on screen → register, left/right → pan, the pair's relative speed → loudness.
- At most 24 notes per second (3 per step); when more encounters happen, the fastest ones play.
- Muted (
m) or switched off (e), the notes are still chosen and their free pitch drawn, only not played, so muting never changes the performance.
2.4.3 Trembling — the crackle
Boids that stay where they are and tremble (jammed at high separation, knots, a swarm circling in place) crackle instead of ringing clear notes, which would not fit the picture. A boid's direction, averaged over 0.1 s, is compared with the 0.1 s before; turning back by more than 90° means its neighbours pushed it back. The rate of these turn-backs (smoothed over about 1 s) separates the states cleanly:
| State | Turn-backs per second and boid | Crackle |
|---|---|---|
| flowing flocks and waves | 0 | none |
| roaming freely | 0.2 – 0.9 | none |
| evenly spread, trembling softly (separation 125) | 3.4 – 3.8 | soft, 400 – 460 grains/s |
| jam, knots, circling in place | 5.3 – 6.5 | strong, 630 – 800 grains/s |
- From 2.5 turn-backs a second every turn-back is a grain: a sine of 3 ms at 4 × the register's pitch, too short to have a pitch — a tick. Faster trembling gives more grains, so the crackle speeds up by itself; its loudness grows up to 7 turn-backs a second, and the boid's clear encounter notes fade out as it does.
- Only the frame-to-frame wobble is ignored: boids inside flowing flocks wobble left and right every frame which is not the trembling one sees.
- Still only sines and no random(): the grain's pitch comes from the boid's height, so a take stays the same.
- The crackle is a layer of its own:
j(on the controller R6) mutes it, and it also sounds with the encounter notes muted; with both on, a trembling boid's notes fade into its crackle.
2.4.4 Macro tunes micro
- Inside a voiced flock, a note takes that flock's pitch and order: free and scattered while the flock is disordered (polarization ≤ 0.2), locked to the nearest harmonic of its drone when aligned (≥ 0.9). Inside a flock notes are short (80 ms).
- Between flocks, notes are free and ring longer (400 ms).
- The flock's elongation sets the highest partial its notes can reach (6th – 12th).
2.4.5 The beat — flocks crossing a grid
Can a swarm keep time? Yes — if the flocks fly straight. An invisible grid (every 120 px at Full HD: 16 columns × 9 rows; a row line runs through the centre of the stage) lies over the stage. When the centre of an established flock crosses a grid line, a short sine hit sounds. An aligned flock flying straight at a steady speed crosses evenly spaced lines at even intervals: a regular beat, emerging from the flock's own motion. No clock is involved (logic first).
Lineage: lines in space that sound when crossed run through the whole series. In Swarm Synth I and II (2018) a boid crossing a line of a grid retuned layered sines or struck a note; IV had four horizontal “sine strings”, where a boid crossing a string retuned that string's sine. V takes the same idea to the level of the flock: a whole flock crossing a grid line strikes a short sine, and a straight-flying flock crosses lines at even intervals, which gives rhythm. As the beat grid, IV's lines are back with a new function.
| Flock | Beat | Detail |
|---|---|---|
| lines across its main direction | main beat | alternating low / middle sine hit (1st / 3rd partial of its drone) |
| lines along its main direction | high hits | high sine (8th partial); heading sets the main beat : high ratio (polyrhythm) |
| speed | tempo | speed 3 ≈ 70 – 90 BPM, speed 5 ≈ 140 BPM (grid 120) |
| size | loudness | share of all boids |
| compactness | tightness | compact = short, sharp hit; spread = longer, softer |
| its drone | tuning | every hit is a partial of the flock's own drone: the beat is the flock's chord, struck |
| several flocks | several pulses | slightly different tempi drift in and out of phase |
- Sounds: no drum samples or noise — pure sines that start at once (2 ms) and die away (decay 0.12 / 0.07 / 0.03 s for low / middle / high, longer for spread flocks), in the same language as the rest of the instrument: the beat is the flock's own chord, struck, not a drum kit. Nothing random, so the beat can't change the seed's performance.
- Visual: with the beat on, the grid is drawn as quiet but visible lines; a line flashes to half-transparent white when a flock crosses it and fades over a few frames.
- On when free play starts, on the 240 px grid;
ktoggles it. In a score it is off untilbeat on(beat offstops it). - Grid resolution:
,/.step through 40 · 60 · 80 · 120 · 240 px: clear tempo relations to 120, and every one runs through all three sliders. Measured in the beat atlas (one flock, force 0.15, the same flights counted on every grid): 240 = 0.50× (half time), 80 = 1.50×, 60 = 2.00× (double time), 40 = 3.01×. In a score,gridsets the start value and<time> grid <px>changes it during the piece. When the grid changes, one step is skipped so that no false burst of beats fires. The HUD shows “beat · grid 120”.
2.4.6 Steady flight is the key: max force
With a high max force (IV's 1.0), boids inside flocks turn about 40° per frame, the flock's centre moves unevenly, and the beat is irregular (interval variation 40 – 120%). With a low max force the flight is smooth and a straight-flying flock gives a metronomic beat: at 0.15, intervals 0.78, 0.78, 0.78, 0.80 s at speed 3; 0.42, 0.42, 0.43 s at speed 5. The default, 0.3, lies in between (2.2.3). The beat still breaks when a flock turns, merges or splits — grooves with breaks. A score that wants a steady beat therefore sets a low force; it is a score line, so each piece chooses its own flight.
2.4.7 The built-in synthesizer
The sound is made by a small synthesizer inside the sketch rather than by a library, so that the same sound goes to the speakers (preview) and into the video (render), sample-exact and in lockstep with the frames.
- 48 kHz, 16-bit stereo; 60 control steps per second, 800 samples each.
- 4 drone slots × 4 partials; frequency, amplitude and pan glide linearly across each block (no clicks).
- One-shot notes with attack / sustain / release; the trembling grains are the same notes, 3 ms long.
- Beat hits: one-shot sines on the flock's 1st, 3rd or 8th partial, 2 ms attack and an exponential decay; no samples, no noise, nothing random (2.4.5).
- Master: mute, score fade-out, then a peak limiter at −1 dBFS, so no combination of flocks can clip.