From ff1c793633a7a90819699b7c0c54388090e4741d Mon Sep 17 00:00:00 2001 From: Justin Parker Date: Wed, 4 Nov 2026 10:24:06 -0800 Subject: [PATCH] Add Snake and Light Trails music, dealt fresh each round AI Assisted --- .agents-docs/AGENTS-architecture.md | 10 +- .readme/web-console.md | 6 +- scripts/test-web-console-activities.mjs | 114 +++- scripts/test-web-console-page-activities.mjs | 5 +- scripts/test-web-console-tones.mjs | 33 + src/web-console/public/activities.js | 4 +- .../public/activities/snake-music.js | 508 +++++++++++++++ .../public/activities/snake-sfx.js | 8 +- src/web-console/public/activities/snake.js | 33 +- .../public/activities/trails-music.js | 611 ++++++++++++++++++ .../public/activities/trails-sfx.js | 8 +- src/web-console/public/activities/trails.js | 46 +- src/web-console/public/music.js | 12 +- src/web-console/static.mjs | 2 + 14 files changed, 1377 insertions(+), 23 deletions(-) create mode 100644 src/web-console/public/activities/snake-music.js create mode 100644 src/web-console/public/activities/trails-music.js diff --git a/.agents-docs/AGENTS-architecture.md b/.agents-docs/AGENTS-architecture.md index 8e7da3e..8aa0593 100644 --- a/.agents-docs/AGENTS-architecture.md +++ b/.agents-docs/AGENTS-architecture.md @@ -247,8 +247,8 @@ Optional local browser UI shipped with **every** skill. Source lives in `src/web | `static.mjs` | serving the page's own files: `SERVABLE` (the allow-list), `TYPES`, caching and ETags, the accent colors, and `CSS_ORDER` + `joinedStyles()`, the one place the cascade order is stated | | `workspace.mjs` | the session's extra folders, and the folders remembered per project and spec | | `public/activities.js` | the list of activities (`ACTIVITIES`: each game's id, title, picker card line `blurb` and module path) an optional `courses` list (Mini golf's six course ids, which open a course dashboard), `bestKey(id, course?)`, the flat looks.json key for its best score (`activityBestSnake`, one per golf course `activityBestGolfPirate` to `activityBestGolfFrost`, `activityBestTrails`, `activityBestBugs`, `activityBestDrive`, `activityBestStack`, `activityBestBumper`, `activityBestRapids`, `activityBestFuse`, `activityBestHop`, `activityBestBounce`, `activityBestGhoul`); lists Snake, Mini golf, Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring, Rapids Run, Hot Potato, Crossing Rush, Bounce Road and Ghoul Rush, `bestKeys(entry)`, every best key a game keeps, and documents the game contract including the course parts (`courses` and `preview()` on the export, `setCourse()` and `course` on the game), the optional `pointer(type, x, y)`, `release(name)` (a game key let go) and `lowerIsBetter`; data only, imported by the page and by Node | -| `public/activities/snake.js` | Snake: its rules as plain exported functions and the game contract (`create({ canvas, tone, onScore })` returning `start`, `pause`, `resume`, `key`, `tick`, `resize`, `score`, `state`); it never runs a timer or listens for keys, so the Activities window drives it | -| `public/activities/trails.js` | Light Trails: its rules as plain exported functions (`newRound`, `newHeat`, `turn`, `boost`, `advance` in 8 ms slices (where your crash is held for `GRACE_MS`, a turn in that time riding out of it; rivals get no grace), `choose` and `room` for the rivals' flood-fill steering, `applyPower`, `spawnItem`, `closeRing`), the `ARENAS` (rivals, sharpness and what each adds), the `POWERS` pads and the game contract; memo is the furthest arena reached; a read-only `round` getter for the tests only | +| `public/activities/snake.js` | Snake: its rules as plain exported functions and the game contract (`create({ canvas, tone, onScore })` returning `start`, `pause`, `resume`, `key`, `tick`, `resize`, `score`, `state`); it never runs a timer or listens for keys, so the Activities window drives it; it also holds the music's rules: `MUSIC_TRACKS`, `dealMusic(random, last)` (a round's shuffle of the ten tracks, never opening on the last round's opener), `trackFor(deck, level)` and `heat(round)` (the snake's speed as 0.3 to 1, so the lead and drums are in from the first step) | +| `public/activities/trails.js` | Light Trails: its rules as plain exported functions (`newRound`, `newHeat`, `turn`, `boost`, `advance` in 8 ms slices (where your crash is held for `GRACE_MS`, a turn in that time riding out of it; rivals get no grace), `choose` and `room` for the rivals' flood-fill steering, `applyPower`, `spawnItem`, `closeRing`), the `ARENAS` (rivals, sharpness and what each adds), the `POWERS` pads and the game contract; memo is the furthest arena reached; a read-only `round` getter for the tests only; it also holds the music's rules: `MUSIC_TRACKS`, `dealMusic(random, last)` (a round's shuffle of the fourteen tracks, never opening on the last round's opener), `trackFor(deck, level)` and `heat(round)` (0.3 while a heat lines up or ends, 0.7 racing, 0.85 down to the last rival, 1 on a boost) | | `public/activities/bugs.js` | Bug Hunt: its rules as plain exported functions (`newRound`, `spawnWave`, `slotPos`, `advance` in 8 ms slices over `round.input`, which `key()` and `release()` set, `hurtBug`, `hurtBoss`, `hitShip`, `applyPower`, `ghostly`, `tentacleTip`, `bossRadius`), the `BUGS` by first wave, the `BOSSES` every `BOSS_EVERY` waves, the `POWERS`, the `SECTORS` scenery and the game contract with `release()`; memo is the tally of `DISCOVERIES` as bits; a read-only `round` getter for the tests only | | `public/activities/drive.js` | Sunset Drive: its rules as plain exported functions (`newRound`, `buildStage`, which appends a stage of road and returns its `forkAt`, `gateAt` and `fork`, `segAt`, `advance` in 8 ms slices over `round.input`, which `key()` and `release()` set, `boost`, `usePower` (the oldest queued power-up, which space fires ahead of `boost`), `hopHeight`, `checkTime`), the `POWERS` in `POWER_ORDER`, the `REGIONS` (roads with their bonus, bends, hills, traffic, colors and props) in `REGION_ORDER`, the projection and drawing (sky, road far to near, props, traffic, Planny's car) and the game contract with `release()`; the next road is built only when the fork is chosen, and `FORK_LEN` must stay at least `DRAW` so it is built before it comes into view; memo is the roads found as bits; a read-only `round` getter for the tests only | | `public/activities/stack.js` | Stack Deploy: its rules as plain exported functions (`newRound`, `spawnBlock`, `advance` in 8 ms slices that slides the block between the walls, `drop`, which drops it where it was last drawn and returns `{ kept, sliced, perfect, miss }`, `isPerfect` and `zoneOf` (3% of the block's width, the slide in `PERFECT_MS`, or `round.minZone`, the `MIN_ZONE_PX` floor the game sets at each resize, whichever is most, but never more than half the block's width, so a drop off the tower is never perfect), `grow`, `speedAt`, `twistsAt`, `styleAt`, `comboPitch`), the `TWISTS` by floor (speed ramp, either side and turning back, lag spikes, wind, rush hour, faster) and the `STYLES` of the tower, the drawing (sky by height, blocks per style, Planny riding the top, the dashed marker of the highest floor) and the game contract with `pointer()` (a press on the board drops) and `release()` (a held up drops once, not at every key repeat, and `key(name, repeat)` ignores a repeat the window marks, so up held through the countdown never drops at its first repeat); a press waits for the first tick after a start or a play-on, so an arrow that resumes never also drops; a miss holds the round running for `OUTRO_MS` while the camera pulls back over the whole tower; memo is the highest floor ever reached, saved on a pause and at the end; a read-only `round` getter for the tests only | @@ -447,8 +447,10 @@ Optional local browser UI shipped with **every** skill. Source lives in `src/web | `public/spec-states.js` | the spec states (`diagnosed`, `fixed`, `exploring`, `mapped`, `planned`, `documented`, `building`, `built`, `unrecognized`): each one's picker label, the card it is the natural next step for and its recommendation, data only; which cards a state lights lives in `skills.js`, how a folder maps to a state in `classifySpec()` in `scan.mjs` | | `public/state.js` | the page's shared state (`page.S` the server's truth, `page.local` what is staged) and the `redraw()` / save hooks every screen calls; defines only | | `public/tones.js` | the activities' sound engine, all synthesized in the browser. Three parts: a shared kit of rich one-shot sounds (`RICH`: `layers` of parts played together, each a wave or a noise (`noise`, `pink`, `brown`) with its own `delay`, `gain`, `attack`, a sweeping `filter` and `vibrato`: `explode`, `smash`, `skid`, `whoosh`, `splashBig`, `fanfare`, `gameOver` and some fifty more, up to 1.2 s, at most `MAX_VOICES` parts sounding at once), held **hums** (`hum(id, name, level, pitch)`, called every frame a game wants it: oscillators and noise through one filter that follows the pitch, pulsed for an engine's strokes; a hum not asked for within `HUM_HOLD_MS` fades by itself, so a paused or closed game goes quiet without saying so, `hushTones()` quiets every one and the Activities window calls it whenever it stops ticking; at most `MAX_HUMS`; shared ones `car`, `toycar`, `electric`, `outboard`, `river`, `wind`, `cycle`, `fuse`, `haunt`, `squeal`, `meter`, `swarm`, `train`, `crowd`), and each game's own extras in `public/activities/-sfx.js` (`{ tones, hums }`, plain objects, names prefixed with the game id, merged and frozen here; a name may be defined once across all of them, which `scripts/test-web-console-tones.mjs` checks along with every spec's shape and every name a game's source asks for). Everything plays through one compressor. The older single blips (`BLIPS`): `tone(name, level, pitch)` with an optional loudness from 0 to 1 and an optional pitch that scales every frequency, kept between 0.25 and 4, `unlockTones()`; Snake's blips plus golf's `putt`, `wall`, `bump`, `cup`, `ace` (a three-note rise), `splash`, `power` (a power-up, three notes), `tunnel`, `boom` (a cannon putt), `sizzle` (lava) and `fall` (the pit), the countdown's `count` and `go`, Stack Deploy's `thunk`, `slice` and `perfect`, which it pitches up a scale step for each perfect in a row, and Bumper Ring's `ram`, pitched and leveled by how hard the hit, and `rev`, a rival winding up a dash, and Hot Potato's `tick`, the fuse, which it ticks quicker and pitches higher as the fuse burns down, and `pop`, a pass, and Crossing Rush's `hop`, which it pitches up a step for each quick hop forward in a row, `boing`, a send-back, `bell`, a train coming, and `horn`, and Bounce Road's `engine`, a soft low triangle hum it plays every few frames while you pick up speed (quiet once you cruise or coast), pitched up with your speed, `spring`, a jump, pitched with your speed, and `squash`, a rival flattened, pitched up a step for each in a chain, and `beat`, a low thump while your wheels run on the verge (it borrows the other games' blips for its hazards and rivals), and Rapids Run's `pew` (a shot, a short soft triangle played quietly about seven times a second while fire is held), `charge` (a buoy taken), `lowcell` (the low battery's two-note beep, quicker the lower it runs), `dambreak` (a dam bursting) and `skim` (a bank skimmed at speed, pitched up the more you have skimmed), and Ghoul Rush's `ghoulBlast` (the blaster's bolt, a short soft triangle repeated while fire is held), `zombiePop` (a kill, pitched up a step for each in the chain), `ghoulStomp`, `ghoulBoo`, `ghoulRoar` and `zombieGroan` (now kept for the other games and the tests: Ghoul Rush's monsters speak with their own voices from `ghoul-sfx.js`), `ghoulCandy` (pitched up for candy in quick succession), `batSwoop` (a bat's kill), `doorUnlock` (the key), `doorThrough` (the door to the next room) and `creakBoard` (a crawler coming up, a chandelier or a crumbling board about to go), all soft triangles and sines), silent while Play sounds is off; separate from `sound.js`'s cue queue | -| `public/music.js` | the games' chiptune music: a small sequencer over `tones.js`'s context and compressor (`audioOut()`). A game calls `music(name, intensity)` from its `tick`; the track fades out within `MUSIC_HOLD_MS` once it stops being asked for, picks up again on the bar it left, asking for a different track crossfades the two over `CROSSFADE_S` (the old one keeps playing as it fades, so a new level is not a cut), and `hushMusic()` stops it at once. Tracks are note data under `music` in each game's `activities/-sfx.js` (`{ bpm, rush, voices, patterns, order }`: pulse, triangle and noise-drum voices, each joining once the intensity reaches its `from`; a step a token, `A4`, `-` to hold, `.` a rest, `A3^037` an arpeggio, drums `k s h o`), read by `compileTrack()` and booked `LOOKAHEAD_S` ahead on the audio clock. The window plays it only while Play sounds, Play game sounds and Play game music (`looks.gameMusic`, off by default) are all on | -| `public/activities/snake-sfx.js` · `public/activities/golf-sfx.js` · `public/activities/trails-sfx.js` · `public/activities/bugs-sfx.js` · `public/activities/drive-sfx.js` · `public/activities/stack-sfx.js` · `public/activities/bumper-sfx.js` · `public/activities/rapids-sfx.js` · `public/activities/fuse-sfx.js` · `public/activities/hop-sfx.js` · `public/activities/bounce-sfx.js` · `public/activities/ghoul-rush/sfx/ghoul-sfx.js` | each game's own sound effects as data, `{ tones, hums }` in the shapes `tones.js` documents, every name prefixed with the game id (`driveEngine`, `ghoulMoan`), merged and frozen by `tones.js`; no imports, but for `ghoul-sfx.js`, which merges each Ghoul Rush stage's own `ghoul-sfx-.js` into its `tones`, `hums` and `music` | +| `public/music.js` | the games' chiptune music: a small sequencer over `tones.js`'s context and compressor (`audioOut()`). A game calls `music(name, intensity)` from its `tick`; the track fades out within `MUSIC_HOLD_MS` once it stops being asked for, picks up again on the bar it left, asking for a different track crossfades the two over `CROSSFADE_S` (the old one keeps playing as it fades, so a new level is not a cut), and `hushMusic()` stops it at once. Tracks are note data under `music` in each game's `activities/-sfx.js` (`{ bpm, rush, bar, voices, patterns, order }`, `bar` the steps in a bar when it is not 16, so the track resumes on a bar start and each pattern is whole bars: pulse, triangle and noise-drum voices, each joining once the intensity reaches its `from`; a step a token, `A4`, `-` to hold, `.` a rest, `A3^037` an arpeggio, drums `k s h o`), read by `compileTrack()` and booked `LOOKAHEAD_S` ahead on the audio clock. The window plays it only while Play sounds, Play game sounds and Play game music (`looks.gameMusic`, off by default) are all on | +| `public/activities/snake-sfx.js` · `public/activities/golf-sfx.js` · `public/activities/trails-sfx.js` · `public/activities/bugs-sfx.js` · `public/activities/drive-sfx.js` · `public/activities/stack-sfx.js` · `public/activities/bumper-sfx.js` · `public/activities/rapids-sfx.js` · `public/activities/fuse-sfx.js` · `public/activities/hop-sfx.js` · `public/activities/bounce-sfx.js` · `public/activities/ghoul-rush/sfx/ghoul-sfx.js` | each game's own sound effects as data, `{ tones, hums }` in the shapes `tones.js` documents, every name prefixed with the game id (`driveEngine`, `ghoulMoan`), merged and frozen by `tones.js`; no imports, but for `ghoul-sfx.js`, which merges each Ghoul Rush stage's own `ghoul-sfx-.js` into its `tones`, `hums` and `music`, `snake-sfx.js`, which merges `snake-music.js` as its `music`, and `trails-sfx.js`, which merges `trails-music.js` as its `music` | +| `public/activities/snake-music.js` | Snake's ten music tracks as data (no imports): `SNAKE_MUSIC`, `{ bpm, rush, voices, patterns, order }` each, named `snake` and listed in `MUSIC_TRACKS` in `snake.js`. A round deals them in a fresh order, one to each level, so a run hears a different track at every level and none twice. They were picked on the pages in `prototypes/music/snake` (rhythm-first folk and world tunes led by something plucked or reedy, mostly dark or modal), and their bars are not all sixteen steps: 6/8 is 12, 7/8 is 14, ten beats is 20, twelve beats is 24, each pattern a whole number of its bars; merged by `snake-sfx.js` | +| `public/activities/trails-music.js` | Light Trails' fourteen music tracks as data (no imports): `TRAILS_MUSIC`, `{ bpm, rush, voices, patterns, order }` each, named `trails` and listed in `MUSIC_TRACKS` in `trails.js`. A round deals them in a fresh order, one to each arena, so a run hears a different track in every arena and none twice. They were picked on the pages in `prototypes/music/light-trails` (mostly dark, cinematic grid electro in minor keys at 96 to 120 bpm, three leaning cyberpunk and synthwave), and build with `heat(round)`: bass, drums and sequence while a heat lines up, brass and lead once the riders go; merged by `trails-sfx.js` | | `public/activities/ghoul-rush/stages/graveyard/ghoul-sfx-graveyard.js` | The Graveyard's own sounds as data (no imports): `GRAVEYARD_SFX`, its `tones` (the picked `ghoul` sounds of the grasping hands, mourners, grave robbers, rotters and their legs, carrion crows and Mother Mourning) and `music` (`ghoulLychgate`, `ghoulGraves`, `ghoulMausoleums`, `ghoulAngel`, named in `ROOM_MUSIC`), merged by `ghoul-sfx.js` after the house's own. Every new stage gets its own `ghoul-sfx-.js`, listed in `STAGE_SFX` there | | `public/activities/ghoul-rush/stages/grounds/ghoul-sfx-grounds.js` | The Grounds' own sounds as data (no imports): `GROUNDS_SFX`, its `tones` (the 32 picked `ghoul` sounds of the topiary beasts, rootlings, lantern moths, mulch crawlers, the Groundskeeper and the Hedge shears' snip) and `music` (`ghoulMaze`, `ghoulTopiary`, `ghoulGazebo`, `ghoulYard`, named in `ROOM_MUSIC`), merged by `ghoul-sfx.js` after the house's own via `STAGE_SFX` | | `public/uploads.js` | pictures and documents attached to a note: chips, trays, re-encoding, upload, retry, and the page's shared full-screen picture preview (`openPicview`, the `#picview` dialog every thumbnail opens) | diff --git a/.readme/web-console.md b/.readme/web-console.md index 3c38687..46ac6b4 100644 --- a/.readme/web-console.md +++ b/.readme/web-console.md @@ -542,14 +542,16 @@ rivers, wind, light-cycle drones and the moans of nearby monsters run for as lon the moment lasts, and crashes, splashes, explosions, pickups, combos, bosses, new bests and game over each get a sound of their own. A game can play chiptune music too, made the same way, which builds as play heats up (Sunset -Drive has a song for each road, Ghoul Rush a track for each room, played at +Drive has a song for each road, Snake a different one at every level, dealt from ten at +the start of a round so none repeats, Light Trails a different dark grid-electro track in +every arena, dealt from fourteen the same way and fuller once the riders go, and Ghoul Rush a track for each room, played at one steady level and fuller in a boss fight): turn on **Play game music** in **User Preferences → Sounds & activities** (it starts off). **Play game sounds** there turns the games' sounds (the 3, 2, 1 and the new-best burst included) and their music on or off and leaves the page's own cues alone; the **Play sounds** switch above it silences all of it, and a paused or closed game goes quiet at once. A game with music has its own **Music** slider beside **Full screen**, which sets that -game's music volume and is remembered per game (Sunset Drive starts at 70, +game's music volume and is remembered per game (Snake, Light Trails and Sunset Drive start at 70, Ghoul Rush at 65). - **Snake** speeds up as it grows: 120 ms a step at its starting three cells, diff --git a/scripts/test-web-console-activities.mjs b/scripts/test-web-console-activities.mjs index 14e4517..6b45ad2 100644 --- a/scripts/test-web-console-activities.mjs +++ b/scripts/test-web-console-activities.mjs @@ -11,7 +11,7 @@ import assert from "node:assert/strict"; import path from "node:path"; import { fileURLToPath, pathToFileURL } from "node:url"; import { ACTIVITIES, bestKey, bestKeys, memoKey, musicKey, musicLevel } from "../src/web-console/public/activities.js"; -import { BOSS_BITES, COMBO_MS, DISCOVERIES, FOOD_PER_LEVEL, FRUITS, GRID, ICE_STEPS, LEVELS, MAX_COMBO, MIN_CELL, MIN_STEP_MS, POWERS, STEP_MS, SURPRISES, age, applyPower, applySurprise, fruitFor, tallyBit, newRound, onFood, SPECIALS, pace, placeFood, step, stepMs, turn } from "../src/web-console/public/activities/snake.js"; +import { BOSS_BITES, COMBO_MS, MAX_LEVEL, MUSIC_TRACKS, dealMusic, heat, trackFor, DISCOVERIES, FOOD_PER_LEVEL, FRUITS, GRID, ICE_STEPS, LEVELS, MAX_COMBO, MIN_CELL, MIN_STEP_MS, POWERS, STEP_MS, SURPRISES, age, applyPower, applySurprise, fruitFor, tallyBit, newRound, onFood, SPECIALS, pace, placeFood, step, stepMs, turn } from "../src/web-console/public/activities/snake.js"; import golf, * as golfRules from "../src/web-console/public/activities/golf.js"; import { COURSE_W, COURSE_H, COURSES, FRONT_NINE, HOLE_COUNT, courseById } from "../src/web-console/public/activities/golf-holes.js"; import { holeQuip, holeWord, knownGround, knownLiquid } from "../src/web-console/public/activities/golf-draw.js"; @@ -308,13 +308,13 @@ test("memoKey builds a flat looks.json key from a list id", () => { test("musicKey builds a flat looks.json key, and a game with music has a default volume a saved one replaces", () => { assert.equal(musicKey("ghoul"), "activityMusicGhoul"); - assert.deepEqual(ACTIVITIES.filter((a) => a.music !== undefined).map((a) => [a.id, a.music]), [["drive", 70], ["ghoul", 65]], "the games with music, at about the level they were picked at on the prototype pages"); + assert.deepEqual(ACTIVITIES.filter((a) => a.music !== undefined).map((a) => [a.id, a.music]), [["snake", 70], ["trails", 70], ["drive", 70], ["ghoul", 65]], "the games with music, at about the level they were picked at on the prototype pages"); const ghoulEntry = ACTIVITIES.find((a) => a.id === "ghoul"); assert.equal(musicLevel(ghoulEntry, undefined), 0.65, "nothing saved: the default"); assert.equal(musicLevel(ghoulEntry, "loud"), 0.65, "not a number: the default"); assert.equal(musicLevel(ghoulEntry, 0), 0, "turned all the way down"); assert.equal(musicLevel(ghoulEntry, 140), 1, "never past full"); - assert.equal(musicLevel(ACTIVITIES[0], 80), 0, "a game with no music has none"); + assert.equal(musicLevel(ACTIVITIES.find((a) => a.id === "golf"), 80), 0, "a game with no music has none"); }); test("every listed game, and a stub second game, answers the game contract", async () => { @@ -457,6 +457,58 @@ test("Snake: a wall hit ends the round and onScore fires once", async () => { assert.equal(scores.length, 1, "no second onScore after the round is over"); }); +test("Snake: a round deals every track once, never opens on the last opener, and gives each level its own", () => { + let n = 7; + const random = () => (n = (n * 1664525 + 1013904223) % 4294967296) / 4294967296; + for (let i = 0; i < 20; i++) { + const last = MUSIC_TRACKS[i % MUSIC_TRACKS.length]; + const deck = dealMusic(random, last); + assert.deepEqual([...deck].sort(), [...MUSIC_TRACKS].sort(), "every track once"); + assert.notEqual(deck[0], last, "never opens on the last opener"); + } + const deck = dealMusic(random, null); + const heard = Array.from({ length: MAX_LEVEL }, (_, i) => trackFor(deck, i + 1)); + assert.equal(new Set(heard).size, MAX_LEVEL, "nine levels hear nine different tracks"); + assert.equal(trackFor(deck, 0), deck[0], "a level below one hears the first"); + assert.equal(trackFor(deck, MUSIC_TRACKS.length + 1), deck[0], "past the deck it comes round again"); + assert.notDeepEqual(dealMusic(random, null), dealMusic(random, null), "a new deal is a new order"); +}); + +test("Snake: the music's heat starts at 0.3, climbs with the snake's speed to 1 and thins out in Slow-mo", () => { + const round = newRound(GRID, () => 0); + assert.ok(Math.abs(heat(round) - 0.3) < 1e-9, "the opening pace is 0.3, so the lead and drums are in from the first step"); + round.snake = Array.from({ length: 30 }, (_, i) => ({ x: i % GRID, y: 0 })); + assert.equal(heat(round), 1, "a long snake at its fastest pace is 1"); + round.effects = { slow: 7000 }; + assert.ok(heat(round) < 1 && heat(round) >= 0.3, "Slow-mo thins it out"); + round.snake = round.snake.slice(0, 3); + assert.equal(heat(round), 0.3, "and never under 0.3"); +}); + +test("Snake: it asks for the deal's track while a round runs, and the next round opens on another", async () => { + const { canvas } = stubCanvas(); + const asked = []; + const game = (await import("../src/web-console/public/activities/snake.js")).default; + const g = game.create({ canvas, music: (name, level) => asked.push([name, level]) }); + g.resize(GRID * MIN_CELL, GRID * MIN_CELL); + g.tick(STEP_MS); + assert.equal(asked.length, 0, "silent before a round"); + g.start(); + g.tick(16); + assert.equal(asked.length, 1, "asked once a tick"); + const [first, opening] = asked[0]; + assert.ok(MUSIC_TRACKS.includes(first), "a track the game has"); + assert.ok(Math.abs(opening - 0.3) < 1e-9, "at the opening heat"); + for (let i = 0; i < GRID + 2 && g.state === "running"; i++) g.tick(STEP_MS); + assert.equal(g.state, "over"); + const before = asked.length; + g.tick(STEP_MS * 10); + assert.equal(asked.length, before, "nothing asked for once the round is over"); + g.start(); + g.tick(16); + assert.notEqual(asked.at(-1)[0], first, "the next round opens on another track"); +}); + test("Snake: running into its own body ends the round", () => { const round = newRound(GRID, () => 0); // Head at (5,5) heading right into (6,5), which is body, not the tail. @@ -2307,6 +2359,62 @@ test("Light Trails: every pill's text reads at 4.5:1 on its backing and its time }); }); +test("Light Trails: a round deals every track once, never opens on the last opener, and gives each arena its own", () => { + let n = 11; + const random = () => (n = (n * 1664525 + 1013904223) % 4294967296) / 4294967296; + for (let i = 0; i < 20; i++) { + const last = trails.MUSIC_TRACKS[i % trails.MUSIC_TRACKS.length]; + const deck = trails.dealMusic(random, last); + assert.deepEqual([...deck].sort(), [...trails.MUSIC_TRACKS].sort(), "every track once"); + assert.notEqual(deck[0], last, "never opens on the last opener"); + } + const deck = trails.dealMusic(random, null); + const heard = Array.from({ length: trails.MAX_LEVEL }, (_, i) => trails.trackFor(deck, i + 1)); + assert.equal(new Set(heard).size, trails.MAX_LEVEL, "nine arenas hear nine different tracks"); + assert.equal(trails.trackFor(deck, 0), deck[0], "a level below one hears the first"); + assert.notDeepEqual(trails.dealMusic(random, null), trails.dealMusic(random, null), "a new deal is a new order"); +}); + +test("Light Trails: the music's heat is low while a heat lines up, rises once the riders go, more so down to the last rival, and is full on a boost", () => { + const round = trails.newRound(() => 0.5); + assert.equal(round.phase, "ready"); + const waiting = trails.heat(round); + assert.ok(waiting < 0.5, "lining up: no lead yet"); + round.level = 2; + trails.newHeat(round, () => 0.5); + round.phase = "race"; + assert.ok(round.riders.filter((r) => r.id !== 0).length >= 2, "two rivals at level 2"); + const racing = trails.heat(round); + assert.ok(racing >= 0.5 && racing < 1, "racing with rivals left: the lead is in"); + for (const r of round.riders.filter((r) => r.id !== 0).slice(1)) r.alive = false; + assert.ok(trails.heat(round) > racing && trails.heat(round) < 1, "down to the last rival it climbs"); + round.effects = { ...round.effects, boost: trails.BOOST_MS }; + assert.equal(trails.heat(round), 1, "a boost pushes it all the way"); +}); + +test("Light Trails: it asks for the deal's track while a round runs, silent before and after, and the next round opens on another", () => { + const { canvas } = stubCanvas(); + const asked = []; + const g = trails.default.create({ canvas, music: (name, level) => asked.push([name, level]) }); + g.resize(800, 600); + g.tick(16); + assert.equal(asked.length, 0, "silent before a round"); + g.start(); + g.tick(16); + assert.equal(asked.length, 1, "asked once a tick"); + const [first] = asked[0]; + assert.ok(trails.MUSIC_TRACKS.includes(first), "a track the game has"); + g.round.lives = 1; + for (let i = 0; i < 2000 && g.state === "running"; i++) g.tick(50); + assert.equal(g.state, "over", "riding straight ends the round"); + const before = asked.length; + g.tick(500); + assert.equal(asked.length, before, "nothing asked for once the round is over"); + g.start(); + g.tick(16); + assert.notEqual(asked.at(-1)[0], first, "the next round opens on another track"); +}); + test("Light Trails game: the opening banner sits in the board from the start's first frame, held through the 3, 2, 1, and does not jump on the first tick", () => { const { canvas, shades } = bannerCanvas("rgba(0, 0, 0, 0.3)"); const g = trails.default.create({ canvas }); diff --git a/scripts/test-web-console-page-activities.mjs b/scripts/test-web-console-page-activities.mjs index 8d93cce..fb2613b 100644 --- a/scripts/test-web-console-page-activities.mjs +++ b/scripts/test-web-console-page-activities.mjs @@ -1266,7 +1266,8 @@ test("a game with music has its own Music slider, at its default until moved, ke const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_WORKING }); const slider = s.page.locator("#activities-music-level"); await openActivities(s, "snake"); - assert.equal(await s.page.locator("#activities-music").isVisible(), false, "Snake has no music, so no slider"); + assert.equal(await s.page.locator("#activities-music").isVisible(), true, "Snake has a slider"); + assert.equal(await boxValue(slider), "70", "at its default"); await s.page.keyboard.press("Escape"); await s.page.waitForFunction(() => !document.getElementById("activities-modal").open); await openActivities(s, "ghoul"); @@ -2515,7 +2516,7 @@ test("Ghoul Rush plays in the real window: its board's shape and Planny big enou test("the server serves the activities' scripts, golf's seventeen, Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring's two, Rapids Run's two, Hot Potato's two, Crossing Rush's two, Bounce Road's seven, Ghoul Rush's ninety-five, every game's sound effects and the shared pills included", () => { const server = fs.readFileSync(new URL("../src/web-console/static.mjs", import.meta.url), "utf8"); const servable = server.slice(server.indexOf("const SERVABLE = new Set(["), server.indexOf("]);", server.indexOf("const SERVABLE = new Set(["))); - for (const file of ["activities.js", "tones.js", "music.js", "activities/snake.js", "screens/activities.js", "activities/golf.js", "activities/golf-holes.js", "activities/golf-draw.js", "activities/golf-decor.js", "activities/golf-kit.js", "activities/golf-paint.js", "activities/golf-looks.js", "activities/golf-course-pirate.js", "activities/golf-course-cave.js", "activities/golf-course-dino.js", "activities/golf-course-candy.js", "activities/golf-course-space.js", "activities/golf-course-frost.js", "activities/golf-look-dino.js", "activities/golf-look-candy.js", "activities/golf-look-space.js", "activities/golf-look-frost.js", "activities/trails.js", "activities/bugs.js", "activities/drive.js", "activities/stack.js", "activities/bumper.js", "activities/bumper-draw.js", "activities/rapids.js", "activities/rapids-draw.js", "activities/fuse.js", "activities/fuse-draw.js", "activities/hop.js", "activities/hop-draw.js", "activities/bounce.js", "activities/bounce-draw.js", "activities/bounce-roads.js", "activities/bounce-road.js", "activities/bounce-rivals.js", "activities/bounce-scenery.js", "activities/bounce-cars.js", "activities/ghoul-rush/ghoul.js", "activities/ghoul-rush/draw/ghoul-draw.js", "activities/ghoul-rush/core/ghoul-rooms.js", "activities/ghoul-rush/stages/wing/ghoul-bones.js", "activities/ghoul-rush/stages/wing/ghoul-bones-draw.js", "activities/ghoul-rush/stages/graveyard/ghoul-graveyard.js", "activities/ghoul-rush/stages/graveyard/ghoul-graveyard-draw.js", "activities/ghoul-rush/stages/grounds/ghoul-grounds.js", "activities/ghoul-rush/stages/grounds/ghoul-grounds-draw.js", "activities/ghoul-rush/stages/chapel/ghoul-chapel.js", "activities/ghoul-rush/stages/chapel/ghoul-chapel-draw.js", "activities/ghoul-rush/stages/sanatorium/ghoul-sanatorium.js", "activities/ghoul-rush/stages/sanatorium/ghoul-sanatorium-draw.js", "activities/ghoul-rush/stages/village/ghoul-village.js", "activities/ghoul-rush/stages/village/ghoul-village-draw.js", "activities/ghoul-rush/stages/village/ghoul-village-world.js", "activities/ghoul-rush/stages/village/ghoul-village-wolf.js", "activities/ghoul-rush/stages/mine/ghoul-mine.js", "activities/ghoul-rush/stages/mine/ghoul-mine-draw.js", "activities/ghoul-rush/stages/mine/ghoul-mine-world.js", "activities/ghoul-rush/stages/mine/ghoul-mine-tommy.js", "activities/ghoul-rush/rides/cart/ghoul-cart.js", "activities/ghoul-rush/rides/cart/ghoul-cart-draw.js", "activities/ghoul-rush/rides/sled/ghoul-sled.js", "activities/ghoul-rush/rides/sled/ghoul-sled-draw.js", "activities/ghoul-rush/rides/gurney/ghoul-gurney.js", "activities/ghoul-rush/rides/gurney/ghoul-gurney-draw.js", "activities/ghoul-rush/rides/banister/ghoul-banister.js", "activities/ghoul-rush/rides/banister/ghoul-banister-draw.js", "activities/ghoul-rush/rides/banister/ghoul-sfx-banister.js", "activities/ghoul-rush/rides/hearse/ghoul-hearse.js", "activities/ghoul-rush/rides/hearse/ghoul-hearse-draw.js", "activities/ghoul-rush/rides/wagon/ghoul-wagon.js", "activities/ghoul-rush/rides/wagon/ghoul-wagon-draw.js", "activities/ghoul-rush/rides/pew/ghoul-pew.js", "activities/ghoul-rush/rides/pew/ghoul-pew-draw.js", "activities/ghoul-rush/rides/pew/ghoul-pew-course.js", "activities/ghoul-rush/rides/pew/ghoul-pew-world.js", "activities/ghoul-rush/rides/mower/ghoul-mower.js", "activities/ghoul-rush/rides/mower/ghoul-mower-draw.js", "activities/ghoul-rush/rides/tray/ghoul-tray.js", "activities/ghoul-rush/rides/tray/ghoul-tray-draw.js", "activities/ghoul-rush/stages/carnival/ghoul-carnival.js", "activities/ghoul-rush/stages/carnival/ghoul-carnival-draw.js", "activities/ghoul-rush/stages/carnival/ghoul-carnival-world.js", "activities/ghoul-rush/stages/frozen/ghoul-frozen.js", "activities/ghoul-rush/stages/frozen/ghoul-frozen-draw.js", "activities/ghoul-rush/stages/frozen/ghoul-frozen-world.js", "activities/ghoul-rush/arms/ghoul-flare.js", "activities/ghoul-rush/stages/bog/ghoul-bog.js", "activities/ghoul-rush/stages/bog/ghoul-bog-draw.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow-draw.js", "activities/ghoul-rush/rides/mat/ghoul-mat-room.js", "activities/ghoul-rush/rides/mat/ghoul-mat.js", "activities/ghoul-rush/rides/mat/ghoul-mat-draw.js", "activities/ghoul-rush/stages/marrow/ghoul-dollhouse-room.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow-eye.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow-eye-draw.js", "activities/ghoul-rush/rides/bonestair/ghoul-bonestair-room.js", "activities/ghoul-rush/rides/bonestair/ghoul-bonestair.js", "activities/ghoul-rush/rides/bonestair/ghoul-bonestair-draw.js", "activities/ghoul-rush/stages/marrow/ghoul-pit-room.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow-heart.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow-heart-draw.js", "activities/ghoul-rush/story/ghoul-ending.js", "activities/ghoul-rush/story/ghoul-ending-draw.js", "activities/ghoul-rush/draw/ghoul-picker-draw.js", "activities/ghoul-rush/core/ghoul-powers.js", "activities/ghoul-rush/arms/ghoul-arms.js", "activities/ghoul-rush/arms/ghoul-arms-draw.js", "activities/ghoul-rush/arms/ghoul-rockets.js", "activities/ghoul-rush/arms/ghoul-rockets-draw.js", "activities/ghoul-rush/arms/ghoul-pans.js", "activities/ghoul-rush/arms/ghoul-sfx-arms.js", "activities/ghoul-rush/core/ghoul-run.js", "activities/ghoul-rush/core/ghoul-dice.js", "activities/ghoul-rush/core/ghoul-dice-draw.js", "activities/ghoul-rush/story/ghoul-gameover-draw.js", "activities/ghoul-rush/story/ghoul-intros.js", "activities/ghoul-rush/story/ghoul-intro-draw.js", "activities/ghoul-rush/story/ghoul-boss-intros.js", "activities/ghoul-rush/story/ghoul-bossintro-draw.js", "activities/ghoul-rush/story/ghoul-story.js", "activities/ghoul-rush/story/ghoul-story-draw.js", "activities/ghoul-rush/story/ghoul-sfx-story.js", "activities/ghoul-rush/core/ghoul-bonus.js", "activities/ghoul-rush/core/ghoul-bonus-draw.js", "activities/ghoul-rush/draw/ghoul-monsters-draw.js", "activities/pills.js", "activities/snake-sfx.js", "activities/golf-sfx.js", "activities/trails-sfx.js", "activities/bugs-sfx.js", "activities/drive-sfx.js", "activities/stack-sfx.js", "activities/bumper-sfx.js", "activities/rapids-sfx.js", "activities/fuse-sfx.js", "activities/hop-sfx.js", "activities/bounce-sfx.js", "activities/ghoul-rush/sfx/ghoul-sfx.js", "activities/ghoul-rush/stages/graveyard/ghoul-sfx-graveyard.js", "activities/ghoul-rush/stages/grounds/ghoul-sfx-grounds.js", "activities/ghoul-rush/stages/chapel/ghoul-sfx-chapel.js", "activities/ghoul-rush/stages/sanatorium/ghoul-sfx-sanatorium.js", "activities/ghoul-rush/stages/village/ghoul-sfx-village.js", "activities/ghoul-rush/stages/mine/ghoul-sfx-mine.js", "activities/ghoul-rush/stages/carnival/ghoul-sfx-carnival.js", "activities/ghoul-rush/stages/frozen/ghoul-sfx-frozen.js", "activities/ghoul-rush/rides/sled/ghoul-sfx-sled.js", "activities/ghoul-rush/rides/gurney/ghoul-sfx-gurney.js", "activities/ghoul-rush/rides/hearse/ghoul-sfx-hearse.js", "activities/ghoul-rush/stages/bog/ghoul-sfx-bog.js", "activities/ghoul-rush/stages/marrow/ghoul-sfx-marrow.js", "activities/ghoul-rush/stages/marrow/ghoul-sfx-marrow-eye.js", "activities/ghoul-rush/stages/marrow/ghoul-sfx-marrow-heart.js", "activities/ghoul-rush/rides/mat/ghoul-sfx-mat.js", "activities/ghoul-rush/rides/bonestair/ghoul-sfx-bonestair.js", "activities/ghoul-rush/story/ghoul-sfx-ending.js", "activities/ghoul-rush/rides/wagon/ghoul-sfx-wagon.js", "activities/ghoul-rush/rides/pew/ghoul-sfx-pew.js", "activities/ghoul-rush/rides/mower/ghoul-sfx-mower.js", "activities/ghoul-rush/rides/tray/ghoul-sfx-tray.js", "activities/ghoul-rush/rides/dark-ride/ghoul-ride-core.js", "activities/ghoul-rush/rides/dark-ride/ghoul-ride-scenes.js", "activities/ghoul-rush/rides/dark-ride/ghoul-ride.js", "activities/ghoul-rush/rides/dark-ride/ghoul-ride-gfx.js", "activities/ghoul-rush/rides/dark-ride/ghoul-ride-draw-kinds.js", "activities/ghoul-rush/rides/dark-ride/ghoul-ride-draw-sets.js", "activities/ghoul-rush/rides/dark-ride/ghoul-ride-draw-hud.js", "activities/ghoul-rush/rides/dark-ride/ghoul-ride-draw.js", "activities/ghoul-rush/rides/dark-ride/ghoul-ride-voices.js", "activities/ghoul-rush/rides/dark-ride/ghoul-sfx-ride.js"]) { + for (const file of ["activities.js", "tones.js", "music.js", "activities/snake.js", "activities/snake-music.js", "activities/trails-music.js", "screens/activities.js", "activities/golf.js", "activities/golf-holes.js", "activities/golf-draw.js", "activities/golf-decor.js", "activities/golf-kit.js", "activities/golf-paint.js", "activities/golf-looks.js", "activities/golf-course-pirate.js", "activities/golf-course-cave.js", "activities/golf-course-dino.js", "activities/golf-course-candy.js", "activities/golf-course-space.js", "activities/golf-course-frost.js", "activities/golf-look-dino.js", "activities/golf-look-candy.js", "activities/golf-look-space.js", "activities/golf-look-frost.js", "activities/trails.js", "activities/bugs.js", "activities/drive.js", "activities/stack.js", "activities/bumper.js", "activities/bumper-draw.js", "activities/rapids.js", "activities/rapids-draw.js", "activities/fuse.js", "activities/fuse-draw.js", "activities/hop.js", "activities/hop-draw.js", "activities/bounce.js", "activities/bounce-draw.js", "activities/bounce-roads.js", "activities/bounce-road.js", "activities/bounce-rivals.js", "activities/bounce-scenery.js", "activities/bounce-cars.js", "activities/ghoul-rush/ghoul.js", "activities/ghoul-rush/draw/ghoul-draw.js", "activities/ghoul-rush/core/ghoul-rooms.js", "activities/ghoul-rush/stages/wing/ghoul-bones.js", "activities/ghoul-rush/stages/wing/ghoul-bones-draw.js", "activities/ghoul-rush/stages/graveyard/ghoul-graveyard.js", "activities/ghoul-rush/stages/graveyard/ghoul-graveyard-draw.js", "activities/ghoul-rush/stages/grounds/ghoul-grounds.js", "activities/ghoul-rush/stages/grounds/ghoul-grounds-draw.js", "activities/ghoul-rush/stages/chapel/ghoul-chapel.js", "activities/ghoul-rush/stages/chapel/ghoul-chapel-draw.js", "activities/ghoul-rush/stages/sanatorium/ghoul-sanatorium.js", "activities/ghoul-rush/stages/sanatorium/ghoul-sanatorium-draw.js", "activities/ghoul-rush/stages/village/ghoul-village.js", "activities/ghoul-rush/stages/village/ghoul-village-draw.js", "activities/ghoul-rush/stages/village/ghoul-village-world.js", "activities/ghoul-rush/stages/village/ghoul-village-wolf.js", "activities/ghoul-rush/stages/mine/ghoul-mine.js", "activities/ghoul-rush/stages/mine/ghoul-mine-draw.js", "activities/ghoul-rush/stages/mine/ghoul-mine-world.js", "activities/ghoul-rush/stages/mine/ghoul-mine-tommy.js", "activities/ghoul-rush/rides/cart/ghoul-cart.js", "activities/ghoul-rush/rides/cart/ghoul-cart-draw.js", "activities/ghoul-rush/rides/sled/ghoul-sled.js", "activities/ghoul-rush/rides/sled/ghoul-sled-draw.js", "activities/ghoul-rush/rides/gurney/ghoul-gurney.js", "activities/ghoul-rush/rides/gurney/ghoul-gurney-draw.js", "activities/ghoul-rush/rides/banister/ghoul-banister.js", "activities/ghoul-rush/rides/banister/ghoul-banister-draw.js", "activities/ghoul-rush/rides/banister/ghoul-sfx-banister.js", "activities/ghoul-rush/rides/hearse/ghoul-hearse.js", "activities/ghoul-rush/rides/hearse/ghoul-hearse-draw.js", "activities/ghoul-rush/rides/wagon/ghoul-wagon.js", "activities/ghoul-rush/rides/wagon/ghoul-wagon-draw.js", "activities/ghoul-rush/rides/pew/ghoul-pew.js", "activities/ghoul-rush/rides/pew/ghoul-pew-draw.js", "activities/ghoul-rush/rides/pew/ghoul-pew-course.js", "activities/ghoul-rush/rides/pew/ghoul-pew-world.js", "activities/ghoul-rush/rides/mower/ghoul-mower.js", "activities/ghoul-rush/rides/mower/ghoul-mower-draw.js", "activities/ghoul-rush/rides/tray/ghoul-tray.js", "activities/ghoul-rush/rides/tray/ghoul-tray-draw.js", "activities/ghoul-rush/stages/carnival/ghoul-carnival.js", "activities/ghoul-rush/stages/carnival/ghoul-carnival-draw.js", "activities/ghoul-rush/stages/carnival/ghoul-carnival-world.js", "activities/ghoul-rush/stages/frozen/ghoul-frozen.js", "activities/ghoul-rush/stages/frozen/ghoul-frozen-draw.js", "activities/ghoul-rush/stages/frozen/ghoul-frozen-world.js", "activities/ghoul-rush/arms/ghoul-flare.js", "activities/ghoul-rush/stages/bog/ghoul-bog.js", "activities/ghoul-rush/stages/bog/ghoul-bog-draw.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow-draw.js", "activities/ghoul-rush/rides/mat/ghoul-mat-room.js", "activities/ghoul-rush/rides/mat/ghoul-mat.js", "activities/ghoul-rush/rides/mat/ghoul-mat-draw.js", "activities/ghoul-rush/stages/marrow/ghoul-dollhouse-room.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow-eye.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow-eye-draw.js", "activities/ghoul-rush/rides/bonestair/ghoul-bonestair-room.js", "activities/ghoul-rush/rides/bonestair/ghoul-bonestair.js", "activities/ghoul-rush/rides/bonestair/ghoul-bonestair-draw.js", "activities/ghoul-rush/stages/marrow/ghoul-pit-room.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow-heart.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow-heart-draw.js", "activities/ghoul-rush/story/ghoul-ending.js", "activities/ghoul-rush/story/ghoul-ending-draw.js", "activities/ghoul-rush/draw/ghoul-picker-draw.js", "activities/ghoul-rush/core/ghoul-powers.js", "activities/ghoul-rush/arms/ghoul-arms.js", "activities/ghoul-rush/arms/ghoul-arms-draw.js", "activities/ghoul-rush/arms/ghoul-rockets.js", "activities/ghoul-rush/arms/ghoul-rockets-draw.js", "activities/ghoul-rush/arms/ghoul-pans.js", "activities/ghoul-rush/arms/ghoul-sfx-arms.js", "activities/ghoul-rush/core/ghoul-run.js", "activities/ghoul-rush/core/ghoul-dice.js", "activities/ghoul-rush/core/ghoul-dice-draw.js", "activities/ghoul-rush/story/ghoul-gameover-draw.js", "activities/ghoul-rush/story/ghoul-intros.js", "activities/ghoul-rush/story/ghoul-intro-draw.js", "activities/ghoul-rush/story/ghoul-boss-intros.js", "activities/ghoul-rush/story/ghoul-bossintro-draw.js", "activities/ghoul-rush/story/ghoul-story.js", "activities/ghoul-rush/story/ghoul-story-draw.js", "activities/ghoul-rush/story/ghoul-sfx-story.js", "activities/ghoul-rush/core/ghoul-bonus.js", "activities/ghoul-rush/core/ghoul-bonus-draw.js", "activities/ghoul-rush/draw/ghoul-monsters-draw.js", "activities/pills.js", "activities/snake-sfx.js", "activities/golf-sfx.js", "activities/trails-sfx.js", "activities/bugs-sfx.js", "activities/drive-sfx.js", "activities/stack-sfx.js", "activities/bumper-sfx.js", "activities/rapids-sfx.js", "activities/fuse-sfx.js", "activities/hop-sfx.js", "activities/bounce-sfx.js", "activities/ghoul-rush/sfx/ghoul-sfx.js", "activities/ghoul-rush/stages/graveyard/ghoul-sfx-graveyard.js", "activities/ghoul-rush/stages/grounds/ghoul-sfx-grounds.js", "activities/ghoul-rush/stages/chapel/ghoul-sfx-chapel.js", "activities/ghoul-rush/stages/sanatorium/ghoul-sfx-sanatorium.js", "activities/ghoul-rush/stages/village/ghoul-sfx-village.js", "activities/ghoul-rush/stages/mine/ghoul-sfx-mine.js", "activities/ghoul-rush/stages/carnival/ghoul-sfx-carnival.js", "activities/ghoul-rush/stages/frozen/ghoul-sfx-frozen.js", "activities/ghoul-rush/rides/sled/ghoul-sfx-sled.js", "activities/ghoul-rush/rides/gurney/ghoul-sfx-gurney.js", "activities/ghoul-rush/rides/hearse/ghoul-sfx-hearse.js", "activities/ghoul-rush/stages/bog/ghoul-sfx-bog.js", "activities/ghoul-rush/stages/marrow/ghoul-sfx-marrow.js", "activities/ghoul-rush/stages/marrow/ghoul-sfx-marrow-eye.js", "activities/ghoul-rush/stages/marrow/ghoul-sfx-marrow-heart.js", "activities/ghoul-rush/rides/mat/ghoul-sfx-mat.js", "activities/ghoul-rush/rides/bonestair/ghoul-sfx-bonestair.js", "activities/ghoul-rush/story/ghoul-sfx-ending.js", "activities/ghoul-rush/rides/wagon/ghoul-sfx-wagon.js", "activities/ghoul-rush/rides/pew/ghoul-sfx-pew.js", "activities/ghoul-rush/rides/mower/ghoul-sfx-mower.js", "activities/ghoul-rush/rides/tray/ghoul-sfx-tray.js", "activities/ghoul-rush/rides/dark-ride/ghoul-ride-core.js", "activities/ghoul-rush/rides/dark-ride/ghoul-ride-scenes.js", "activities/ghoul-rush/rides/dark-ride/ghoul-ride.js", "activities/ghoul-rush/rides/dark-ride/ghoul-ride-gfx.js", "activities/ghoul-rush/rides/dark-ride/ghoul-ride-draw-kinds.js", "activities/ghoul-rush/rides/dark-ride/ghoul-ride-draw-sets.js", "activities/ghoul-rush/rides/dark-ride/ghoul-ride-draw-hud.js", "activities/ghoul-rush/rides/dark-ride/ghoul-ride-draw.js", "activities/ghoul-rush/rides/dark-ride/ghoul-ride-voices.js", "activities/ghoul-rush/rides/dark-ride/ghoul-sfx-ride.js"]) { assert.ok(servable.includes(`"${file}"`), `SERVABLE includes ${file}`); } }); diff --git a/scripts/test-web-console-tones.mjs b/scripts/test-web-console-tones.mjs index e5a4666..fa16bd6 100644 --- a/scripts/test-web-console-tones.mjs +++ b/scripts/test-web-console-tones.mjs @@ -13,6 +13,10 @@ import { looks } from "../src/web-console/public/looks.js"; import { compileTrack, hushMusic, music, musicNames, noteFreq } from "../src/web-console/public/music.js"; import { MUSIC_TABLES } from "../src/web-console/public/tones.js"; import { REGIONS, ROAD_MUSIC } from "../src/web-console/public/activities/drive.js"; +import { MUSIC_TRACKS } from "../src/web-console/public/activities/snake.js"; +import snakeSfx from "../src/web-console/public/activities/snake-sfx.js"; +import { MUSIC_TRACKS as TRAILS_TRACKS } from "../src/web-console/public/activities/trails.js"; +import trailsSfx from "../src/web-console/public/activities/trails-sfx.js"; const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); const GAMES = path.join(ROOT, "src/web-console/public/activities"); @@ -213,6 +217,16 @@ test("music: a track that does not read is turned away", () => { assert.equal(arp.patterns.A.lines.a[0].len, 3, "held for three steps"); }); +test("music: a track in another meter sets its bar, and a pattern that is not whole bars is turned away", () => { + const steps = (n) => Array(n).fill(".").join(" "); + const ok = { bpm: 120, bar: 12, voices: { a: { wave: "pulse" } }, patterns: { A: { a: steps(24) } }, order: ["A"] }; + assert.equal(compileTrack(ok).length, 24, "two bars of 6/8"); + assert.throws(() => compileTrack({ ...ok, patterns: { A: { a: steps(16) } } }), /whole bars/); + assert.throws(() => compileTrack({ ...ok, bar: 2 }), /bar/); + assert.throws(() => compileTrack({ ...ok, bar: 100 }), /bar/); + assert.equal(compileTrack({ ...ok, bar: undefined, patterns: { A: { a: steps(16) } } }).length, 16, "no bar: sixteen steps, as before"); +}); + test("music: a track plays notes while asked for, quiets when hushed, and stays silent while Play sounds is off", () => { const saved = { sound: looks.sound, ctor: globalThis.AudioContext }; const { Ctx, made } = AUDIO; @@ -335,6 +349,25 @@ test("music: the volume scales the track's level, a change glides there, and a v } }); +test("music: Snake lists exactly the tracks it has, each a real track that no other game defines", () => { + const tracks = new Set(musicNames()); + assert.deepEqual([...MUSIC_TRACKS].sort(), Object.keys(snakeSfx.music).sort(), "the game lists the tracks its sound file has"); + for (const name of MUSIC_TRACKS) { + assert.ok(tracks.has(name), `track "${name}" exists`); + assert.equal(MUSIC_TABLES.filter((t) => Object.hasOwn(t, name)).length, 1, `${name} is defined once`); + } +}); + +test("music: Light Trails lists exactly the tracks it has, each a real track that no other game defines, enough for every arena", () => { + const tracks = new Set(musicNames()); + assert.deepEqual([...TRAILS_TRACKS].sort(), Object.keys(trailsSfx.music).sort(), "the game lists the tracks its sound file has"); + assert.ok(TRAILS_TRACKS.length >= 9, "nine arenas, none hearing a track twice"); + for (const name of TRAILS_TRACKS) { + assert.ok(tracks.has(name), `track "${name}" exists`); + assert.equal(MUSIC_TABLES.filter((t) => Object.hasOwn(t, name)).length, 1, `${name} is defined once`); + } +}); + test("music: every Sunset Drive road has a song, and every song is a real track", () => { const tracks = new Set(musicNames()); assert.deepEqual(Object.keys(ROAD_MUSIC).sort(), Object.keys(REGIONS).sort(), "a song for every road"); diff --git a/src/web-console/public/activities.js b/src/web-console/public/activities.js index 80313e6..c236fb6 100644 --- a/src/web-console/public/activities.js +++ b/src/web-console/public/activities.js @@ -32,9 +32,9 @@ const entry = (id, title, blurb, more = {}) => Object.freeze({ id, title, blurb, module: `/activities/${id}.js`, ...more }); export const ACTIVITIES = Object.freeze([ - entry("snake", "Snake", "Eat, grow and dodge. Every level brings something new."), + entry("snake", "Snake", "Eat, grow and dodge. Every level brings something new.", { music: 70 }), entry("golf", "Mini golf", "Six themed 18-hole courses, from Pirate Cove to Cosmic Glow.", { courses: Object.freeze(["pirate", "cave", "dino", "candy", "space", "frost"]) }), - entry("trails", "Light Trails", "Box your rivals in with your trail. Last rider moving wins."), + entry("trails", "Light Trails", "Box your rivals in with your trail. Last rider moving wins.", { music: 70 }), entry("bugs", "Bug Hunt", "Squash waves of bugs before they dive at you, then beat the boss."), entry("drive", "Sunset Drive", "Race the clock down the open road, and pick your road at every fork.", { music: 70 }), entry("stack", "Stack Deploy", "Drop each block right on top. One button, how high can you go?"), diff --git a/src/web-console/public/activities/snake-music.js b/src/web-console/public/activities/snake-music.js new file mode 100644 index 0000000..b54fe60 --- /dev/null +++ b/src/web-console/public/activities/snake-music.js @@ -0,0 +1,508 @@ +// Plan2Code Web Console - snake: its music tracks, merged into snake-sfx.js beside the sounds; defines only. +// +// Ten tracks, one dealt to each level of a round (MUSIC_TRACKS and dealMusic in +// snake.js), picked on the pages in prototypes/music/snake. They share a sound: a +// rhythm from a real folk or world tradition, led by something plucked or reedy, +// mostly in a dark or modal key. Each is the shape music.js documents, +// { bpm, rush, voices, patterns, order }, and builds with the pace: the bass and +// the lead first, then the rest as the snake speeds up. Bars are not all sixteen +// steps: Pirate Cove is 6/8 (12), Clockwork Factory 7/8 (14), Oasis Sama'i and Raga +// Lantern ten beats (20) and Solea Sunrise twelve beats (24), and every pattern +// holds a whole number of its bars. A name may be defined only once across +// tones.js and every game's file. No imports. + +export const SNAKE_MUSIC = { + // Desert Bazaar: A busy desert bazaar in D phrygian dominant: an oud bass plucking around the D, a + // reed lead winding through the half steps, a drone underneath and darbuka drums in a rolling rumba. + // Listen for the reed sliding D, E-flat, F-sharp in the first bar, the long breath on the D, and the + // bridge where the reed breaks into sixteenth-note ornaments. + snakeBazaar: { + bpm: 104, + rush: 8, + voices: { + oud: { wave: "pulse", duty: 0.25, gain: 0.5, decay: 0.08, sustain: 0.2 }, + reed: { wave: "pulse", duty: 0.125, gain: 0.3, decay: 0.08, sustain: 0.7, vibrato: { rate: 6.5, depth: 0.018, delay: 0.1 } }, + drone: { wave: "sine", gain: 0.3, from: 0.15, decay: 0.3, sustain: 0.9 }, + drums: { kit: true, gain: 0.56, from: 0.1 }, + low: { wave: "triangle", gain: 0.3, from: 0.5, decay: 0.1, sustain: 0.8 }, + }, + patterns: { + A: { + oud: + "D2 . D2 . Eb2 . D2 . F#2 . G2 . F#2 . Eb2 . | D2 . D2 . D2 . Eb2 . D2 . D2 . A2 . G2 . | D2 . D2 . Eb2 . D2 . F#2 . G2 . F#2 . Eb2 . | D2 . D2 . D2 . Eb2 . D2 . D2 . A2 . G2 . | " + + "D2 . D2 . Eb2 . D2 . F#2 . G2 . F#2 . Eb2 . | D2 . D2 . D2 . Eb2 . D2 . D2 . A2 . G2 . | D2 . D2 . Eb2 . D2 . F#2 . G2 . F#2 . Eb2 . | D2 . D2 . D2 . Eb2 . D2 . D2 . A2 . G2 .", + reed: + "D5 - Eb5 D5 - F#5 - G5 F#5 - Eb5 D5 - - - - | A5 - G5 F#5 - Eb5 - D5 Eb5 - F#5 - Eb5 D5 - - | G5 - F#5 G5 - A5 - A5 G5 - F#5 - Eb5 - D5 - | D5 - - - - - - - . . . . A4 - Bb4 - | " + + "A4 - Bb4 A4 - D5 - Eb5 D5 - F#5 - G5 - A5 - | A5 - G5 F#5 - Eb5 - F#5 G5 - A5 - G5 F#5 - - | F#5 - Eb5 D5 - Eb5 - F#5 G5 - F#5 - Eb5 - D5 - | D5 - - - - - - - . . . . . . . .", + drone: + "D3 - - - - - - - - - - - - - - - | D3 - - - - - - - - - - - - - - - | D3 - - - - - - - - - - - - - - - | D3 - - - - - - - - - - - - - - - | " + + "D3 - - - - - - - - - - - - - - - | D3 - - - - - - - - - - - - - - - | D3 - - - - - - - - - - - - - - - | D3 - - - - - - - - - - - - - - -", + low: + "D4 - D#4 D4 - F#4 - G4 F#4 - D#4 D4 - - - - | A4 - G4 F#4 - D#4 - D4 D#4 - F#4 - D#4 D4 - - | G4 - F#4 G4 - A4 - A4 G4 - F#4 - D#4 - D4 - | D4 - - - - - - - . . . . A3 - A#3 - | " + + "A3 - A#3 A3 - D4 - D#4 D4 - F#4 - G4 - A4 - | A4 - G4 F#4 - D#4 - F#4 G4 - A4 - G4 F#4 - - | F#4 - D#4 D4 - D#4 - F#4 G4 - F#4 - D#4 - D4 - | D4 - - - - - - - . . . . . . . .", + drums: + "k . s . h . s . k . h . s . h . | k . s . h . s . k . h . s . h . | k . s . h . s . k . h . s . h . | k . s . h . s . k . h . s . h . | " + + "k . s . h . s . k . h . s . h . | k . s . h . s . k . h . s . h . | k . s . h . s . k . h . s . h . | k . s . h . s . s s s s s s s s", + }, + B: { + oud: + "D2 . D2 . D2 . Eb2 . D2 . D2 . A2 . G2 . | D2 . D2 . Eb2 . D2 . F#2 . G2 . F#2 . Eb2 . | D2 . D2 . D2 . Eb2 . D2 . D2 . A2 . G2 . | D2 . D2 . Eb2 . D2 . F#2 . G2 . F#2 . Eb2 .", + reed: + "D5 Eb5 D5 C5 D5 Eb5 F#5 Eb5 D5 Eb5 D5 C5 Bb4 A4 Bb4 C5 | D5 F#5 A5 G5 F#5 Eb5 D5 Eb5 F#5 G5 A5 G5 F#5 Eb5 D5 C5 | D5 Eb5 D5 C5 D5 Eb5 F#5 Eb5 D5 Eb5 D5 C5 Bb4 A4 Bb4 C5 | D5 - - - - - - - . . . . . . . .", + drone: + "D3 - - - - - - - - - - - - - - - | D3 - - - - - - - - - - - - - - - | D3 - - - - - - - - - - - - - - - | D3 - - - - - - - - - - - - - - -", + low: + "D4 D#4 D4 C4 D4 D#4 F#4 D#4 D4 D#4 D4 C4 A#3 A3 A#3 C4 | D4 F#4 A4 G4 F#4 D#4 D4 D#4 F#4 G4 A4 G4 F#4 D#4 D4 C4 | D4 D#4 D4 C4 D4 D#4 F#4 D#4 D4 D#4 D4 C4 A#3 A3 A#3 C4 | D4 - - - - - - - . . . . . . . .", + drums: + "k . s . h . s . k . h . s . h . | k . s . h . s . k . h . s . h . | k . s . h . s . k . h . s . h . | k . s . h . s . s s s s s s s s", + }, + }, + order: ["A","B","A"], + }, + // Jungle Drums: A drumming jungle in G minor pentatonic: a marimba tapping a pattern that never lands + // where you expect, a syncopated bass and drums that argue with each other. Listen for the marimba's + // double tap in the third bar, the low chant sitting under it, and the bridge where the marimba and + // drums trade turns. + snakeJungle: { + bpm: 124, + rush: 10, + voices: { + bass: { wave: "triangle", gain: 0.9, decay: 0.06, sustain: 0.4 }, + marimba: { wave: "pulse", duty: 0.125, gain: 0.34, decay: 0.05, sustain: 0.1 }, + chant: { wave: "sine", gain: 0.3, from: 0.4, decay: 0.3, sustain: 0.9, vibrato: { rate: 4.5, depth: 0.02, delay: 0.2 } }, + drums: { kit: true, gain: 0.66, from: 0.1 }, + echo: { wave: "pulse", duty: 0.125, gain: 0.12, from: 0.55, decay: 0.04, sustain: 0.3 }, + }, + patterns: { + A: { + bass: + "G2 . . G2 . G2 . . Bb2 . . C3 . D3 . . | G2 . . G2 . G2 . . Bb2 . . C3 . D3 . . | G2 . . G2 . G2 . . Bb2 . . C3 . D3 . . | G2 . . G2 . G2 . . Bb2 . . C3 . D3 . . | " + + "Bb1 . . Bb1 . Bb1 . . D2 . . F2 . G2 . . | Bb1 . . Bb1 . Bb1 . . D2 . . F2 . G2 . . | C2 . . C2 . C2 . . E2 . . G2 . A2 . . | G2 . . G2 . G2 . . Bb2 . . C3 . D3 . .", + chant: + "G3 - - - - - - - D3 - - - - - - - | G3 - - - - - - - D3 - - - - - - - | G3 - - - - - - - D3 - - - - - - - | G3 - - - - - - - D3 - - - - - - - | " + + "Bb3 - - - - - - - F3 - - - - - - - | Bb3 - - - - - - - F3 - - - - - - - | C3 - - - - - - - G3 - - - - - - - | G3 - - - - - - - D3 - - - - - - -", + marimba: + "G4 . Bb4 . D5 . Bb4 . G4 . C5 . D5 . F5 . | F5 . D5 . C5 . Bb4 . G4 . Bb4 . C5 . D5 . | G4 G4 . Bb4 . D5 D5 . F5 . D5 . C5 . Bb4 . | C5 . Bb4 . G4 . F4 . G4 - - - . . . . | " + + "Bb4 . D5 . F5 . D5 . Bb4 . C5 . D5 . F5 . | G5 . F5 . D5 . C5 . Bb4 . C5 . D5 . . . | G4 G4 . Bb4 . D5 D5 . F5 . G5 . F5 . D5 . | C5 . Bb4 . G4 . Bb4 . G4 - - - . . . .", + drums: + "k h k h s h k k h k h h s h k h | k h k h s h k k h k h h s h k h | k h k h s h k k h k h h s h k h | k h k h s h k k h k h h s h k h | " + + "k h k h s h k k h k h h s h k h | k h k h s h k k h k h h s h k h | k h k h s h k k h k h h s h k h | k h k h s h k k s s s s s s s s", + echo: + ". . . G4 . Bb4 . D5 . Bb4 . G4 . C5 . D5 | . F5 . F5 . D5 . C5 . Bb4 . G4 . Bb4 . C5 | . D5 . G4 G4 . Bb4 . D5 D5 . F5 . D5 . C5 | . Bb4 . C5 . Bb4 . G4 . F4 . G4 - - - . | " + + ". . . Bb4 . D5 . F5 . D5 . Bb4 . C5 . D5 | . F5 . G5 . F5 . D5 . C5 . Bb4 . C5 . D5 | . . . G4 G4 . Bb4 . D5 D5 . F5 . G5 . F5 | . D5 . C5 . Bb4 . G4 . Bb4 . G4 - - - .", + }, + B: { + bass: + "Eb2 . . Eb2 . Eb2 . . G2 . . Bb2 . C3 . . | F2 . . F2 . F2 . . A2 . . C3 . D3 . . | G2 . . G2 . G2 . . Bb2 . . C3 . D3 . . | G2 . . G2 . G2 . . Bb2 . . C3 . D3 . .", + chant: + "Eb3 - - - - - - - Bb2 - - - - - - - | F3 - - - - - - - C3 - - - - - - - | G3 - - - - - - - D3 - - - - - - - | G3 - - - - - - - D3 - - - - - - -", + marimba: + "Bb4 . . Bb4 . . D5 . . F5 . . D5 . . . | A4 . . A4 . . C5 . . F5 . . C5 . . . | G4 . . G4 . . Bb4 . . D5 . . G5 . . . | G5 - - - - - - - . . . . . . . .", + drums: + "k h k h s h k k h k h h s h k h | k h k h s h k k h k h h s h k h | k h k h s h k k h k h h s h k h | k h k h s h k k s s s s s s s s", + echo: + ". . . Bb4 . . Bb4 . . D5 . . F5 . . D5 | . . . A4 . . A4 . . C5 . . F5 . . C5 | . . . G4 . . G4 . . Bb4 . . D5 . . G5 | . . . G5 - - - - - - - . . . . .", + }, + }, + order: ["A","B","A"], + }, + // Pirate Cove: A pirate jig in D minor, rolling in 6/8: an accordion oompah, a fiddle skipping in + // pairs and a drum that thumps on the one and snaps on the four. Listen for the fiddle climbing D, F, + // A before falling back, the A major that closes every strain on a roar, and the shanty bridge in G + // minor. + snakePirate: { + bpm: 126, + rush: 10, + bar: 12, + voices: { + bass: { wave: "triangle", gain: 0.9, decay: 0.08, sustain: 0.5 }, + fiddle: { wave: "pulse", duty: 0.5, gain: 0.32, decay: 0.08, sustain: 0.7, vibrato: { rate: 6, depth: 0.012, delay: 0.2 } }, + drums: { kit: true, gain: 0.58, from: 0.1 }, + accordion: { wave: "pulse", duty: 0.25, gain: 0.18, from: 0.3, decay: 0.05, sustain: 0.4 }, + echo: { wave: "pulse", duty: 0.125, gain: 0.1, from: 0.7, decay: 0.04, sustain: 0.5 }, + }, + patterns: { + A: { + bass: + "D2 . . . . . A2 . . . . . | C3 . . . . . G2 . . . . . | Bb1 . . . . . F2 . . . . . | A1 . . . . . E2 . . . . . | " + + "D2 . . . . . A2 . . . . . | C3 . . . . . G2 . . . . . | Bb1 . . . . . F2 . . . . . | A1 . . . . . E2 . . . . .", + accordion: + ". . D4^037 . D4^037 . . . D4^037 . D4^037 . | . . C4^047 . C4^047 . . . C4^047 . C4^047 . | . . Bb3^047 . Bb3^047 . . . Bb3^047 . Bb3^047 . | . . A3^047 . A3^047 . . . A3^047 . A3^047 . | " + + ". . D4^037 . D4^037 . . . D4^037 . D4^037 . | . . C4^047 . C4^047 . . . C4^047 . C4^047 . | . . Bb3^047 . Bb3^047 . . . Bb3^047 . Bb3^047 . | . . A3^047 . A3^047 . . . A3^047 . A3^047 .", + fiddle: + "D5 - F5 - A5 - A5 - F5 - D5 - | E5 - G5 - E5 - C5 - E5 - G5 - | D5 - F5 - Bb4 - D5 - F5 - D5 - | C#5 - E5 - A5 - G5 - E5 - C#5 - | " + + "A5 - G5 - F5 - E5 - D5 - F5 - | G5 - E5 - C5 - E5 - G5 - E5 - | F5 - D5 - Bb4 - D5 - F5 - A5 - | A5 - G5 - E5 - C#5 - A4 - - -", + drums: + "k . h . h . s . h . h . | k . h . h . s . h . h . | k . h . h . s . h . h . | k . h . h . s . h . h . | " + + "k . h . h . s . h . h . | k . h . h . s . h . h . | k . h . h . s . h . h . | k . h . h . s . h . h .", + echo: + ". . D5 - F5 - A5 - A5 - F5 - D5 - E5 - | G5 - E5 - C5 - E5 - G5 - D5 - F5 - Bb4 - | D5 - F5 - D5 - C#5 - E5 - A5 - G5 - E5 - | C#5 - A5 - G5 - F5 - E5 - D5 - F5 - G5 - | " + + "E5 - C5 - E5 - G5 - E5 - F5 - D5 - Bb4 - | D5 - F5 - A5 - A5 - G5 - E5 - C#5 - A4 -", + }, + B: { + bass: + "G1 . . . . . D2 . . . . . | A1 . . . . . E2 . . . . . | D2 . . . . . A2 . . . . . | A1 . . . . . E2 . . . . .", + accordion: + ". . G3^037 . G3^037 . . . G3^037 . G3^037 . | . . A3^047 . A3^047 . . . A3^047 . A3^047 . | . . D4^037 . D4^037 . . . D4^037 . D4^037 . | . . A3^047 . A3^047 . . . A3^047 . A3^047 .", + fiddle: + "G5 - Bb4 - D5 - G5 - D5 - Bb4 - | A5 - E5 - C#5 - E5 - A5 - E5 - | F5 - A5 - F5 - D5 - F5 - A5 - | E5 - C#5 - A4 - C#5 - E5 - - -", + drums: + "k . h . h . s . h . h . | k . h . h . s . h . h . | k . h . h . s . h . h . | k . h . h . s . h . h .", + echo: + ". . G5 - Bb4 - D5 - G5 - D5 - Bb4 - A5 - | E5 - C#5 - E5 - A5 - E5 - F5 - A5 - F5 - | D5 - F5 - A5 - E5 - C#5 - A4 - C#5 - E5 -", + }, + }, + order: ["A","B","A"], + }, + // Clockwork Factory: A clockwork factory in F minor, seven beats to the bar: a glockenspiel picking + // out a small machine of a melody, a hi-hat ticking every beat and a bass that rocks in two-two-three. + // Listen for the bar that never feels finished because of the odd seventh beat, the cogs of the melody + // turning one chord at a time, and the bridge where it slows to long notes. + snakeClockwork: { + bpm: 132, + rush: 8, + bar: 14, + voices: { + bass: { wave: "triangle", gain: 0.88, decay: 0.08, sustain: 0.5 }, + glock: { wave: "pulse", duty: 0.125, gain: 0.3, decay: 0.06, sustain: 0.1 }, + drums: { kit: true, gain: 0.55, from: 0.1 }, + low: { wave: "triangle", gain: 0.3, from: 0.45, decay: 0.1, sustain: 0.7 }, + echo: { wave: "pulse", duty: 0.125, gain: 0.1, from: 0.7, decay: 0.04, sustain: 0.4 }, + }, + patterns: { + A: { + bass: + "F2 - - - C3 - - - F2 - - - - - | Db2 - - - Ab2 - - - Db2 - - - - - | Eb2 - - - Bb2 - - - Eb2 - - - - - | C2 - - - G2 - - - C2 - - - - - | " + + "F2 - - - C3 - - - F2 - - - - - | Db2 - - - Ab2 - - - Db2 - - - - - | Eb2 - - - Bb2 - - - Eb2 - - - - - | C2 - - - G2 - - - C2 - - - - -", + glock: + "F5 . C5 . F5 . Ab4 . C5 . . . . . | Db5 . Ab4 . Db5 . F5 . Ab4 . . . . . | Eb5 . Bb4 . Eb5 . G5 . Bb4 . . . . . | C5 . E5 . G5 . E5 . C5 . . . . . | " + + "C5 . F5 . Ab5 . F5 . C5 . . . . . | F5 . Db5 . Ab4 . Db5 . F5 . . . . . | G5 . Eb5 . Bb4 . Eb5 . G5 . . . . . | G5 . E5 . C5 . G4 . C5 - - - - -", + low: + "F4 . C4 . F4 . G#3 . C4 . . . . . | C#4 . G#3 . C#4 . F4 . G#3 . . . . . | D#4 . A#3 . D#4 . G4 . A#3 . . . . . | C4 . E4 . G4 . E4 . C4 . . . . . | " + + "C4 . F4 . G#4 . F4 . C4 . . . . . | F4 . C#4 . G#3 . C#4 . F4 . . . . . | G4 . D#4 . A#3 . D#4 . G4 . . . . . | G4 . E4 . C4 . G3 . C4 - - - - -", + drums: + "kh . h . sh . h . kh . h . sh . | kh . h . sh . h . kh . h . sh . | kh . h . sh . h . kh . h . sh . | kh . h . sh . h . kh . h . sh . | " + + "kh . h . sh . h . kh . h . sh . | kh . h . sh . h . kh . h . sh . | kh . h . sh . h . kh . h . sh . | kh . h . sh . h . kh . h . sh .", + echo: + ". . . . F5 . C5 . F5 . Ab4 . C5 . . . | . . Db5 . Ab4 . Db5 . F5 . Ab4 . . . . . | Eb5 . Bb4 . Eb5 . G5 . Bb4 . . . . . C5 . | E5 . G5 . E5 . C5 . . . . . C5 . F5 . | " + + "Ab5 . F5 . C5 . . . . . F5 . Db5 . Ab4 . | Db5 . F5 . . . . . G5 . Eb5 . Bb4 . Eb5 . | G5 . . . . . G5 . E5 . C5 . G4 . C5 -", + }, + B: { + bass: + "F2 - - - C3 - - - F2 - - - - - | F2 - - - C3 - - - F2 - - - - - | Bb1 - - - F2 - - - Bb1 - - - - - | Bb1 - - - F2 - - - Bb1 - - - - - | " + + "Db2 - - - Ab2 - - - Db2 - - - - - | Eb2 - - - Bb2 - - - Eb2 - - - - - | C2 - - - G2 - - - C2 - - - - - | C2 - - - G2 - - - C2 - - - - -", + glock: + "Ab4 - - - C5 - - - F5 - - - . . | Eb5 - - - C5 - - - Ab4 - - - . . | Bb4 - - - Db5 - - - F5 - - - . . | F5 - - - Db5 - - - Bb4 - - - . . | " + + "Db5 - - - F5 - - - Ab5 - - - . . | G5 - - - Bb4 - - - Eb5 - - - . . | E5 - - - G5 - - - C5 - - - . . | G5 - - - E5 - - - C5 - - - . .", + low: + "G#3 - - - C4 - - - F4 - - - . . | D#4 - - - C4 - - - G#3 - - - . . | A#3 - - - C#4 - - - F4 - - - . . | F4 - - - C#4 - - - A#3 - - - . . | " + + "C#4 - - - F4 - - - G#4 - - - . . | G4 - - - A#3 - - - D#4 - - - . . | E4 - - - G4 - - - C4 - - - . . | G4 - - - E4 - - - C4 - - - . .", + drums: + "kh . h . sh . h . kh . h . sh . | kh . h . sh . h . kh . h . sh . | kh . h . sh . h . kh . h . sh . | kh . h . sh . h . kh . h . sh . | " + + "kh . h . sh . h . kh . h . sh . | kh . h . sh . h . kh . h . sh . | kh . h . sh . h . kh . h . sh . | kh . h . sh . h . kh . h . sh .", + echo: + ". . . . Ab4 - - - C5 - - - F5 - - - | . . Eb5 - - - C5 - - - Ab4 - - - . . | Bb4 - - - Db5 - - - F5 - - - . . F5 - | - - Db5 - - - Bb4 - - - . . Db5 - - - | " + + "F5 - - - Ab5 - - - . . G5 - - - Bb4 - | - - Eb5 - - - . . E5 - - - G5 - - - | C5 - - - . . G5 - - - E5 - - - C5 -", + }, + }, + order: ["A","B","A"], + }, + // Tango Tarantula: A tango in A minor on the 3-3-2 pulse: a marcato bass, a bandoneon snapping chords + // on two and four and a staccato violin that strikes, stops and strikes again. Listen for the sharp + // G-sharp that leans into every A, the held pause at the end of the verse, and the major-key bridge + // that sweeps through C and G before the E chord drags it back. + snakeTango: { + bpm: 112, + rush: 10, + voices: { + bass: { wave: "triangle", gain: 0.92, decay: 0.05, sustain: 0.3 }, + lead: { wave: "pulse", duty: 0.25, gain: 0.34, decay: 0.05, sustain: 0.5, vibrato: { rate: 5.5, depth: 0.014, delay: 0.3 } }, + drums: { kit: true, gain: 0.58, from: 0.1 }, + stab: { wave: "pulse", duty: 0.5, gain: 0.2, from: 0.2, decay: 0.04, sustain: 0.2 }, + echo: { wave: "pulse", duty: 0.125, gain: 0.1, from: 0.7, decay: 0.04, sustain: 0.4 }, + }, + patterns: { + A: { + bass: + "A2 . . E3 . . A2 . E3 . . A2 . . E3 . | A2 . . E3 . . A2 . E3 . . A2 . . E3 . | E2 . . B2 . . E2 . B2 . . E2 . . B2 . | A2 . . E3 . . A2 . E3 . . A2 . . E3 . | " + + "D2 . . A2 . . D2 . A2 . . D2 . . A2 . | A2 . . E3 . . A2 . E3 . . A2 . . E3 . | E2 . . B2 . . E2 . B2 . . E2 . . B2 . | A2 . . E3 . . A2 . E3 . . A2 . . E3 .", + stab: + ". . . . A3^037 . . . . . . . A3^037 . . . | . . . . A3^037 . . . . . . . A3^037 . . . | . . . . E3^047 . . . . . . . E3^047 . . . | . . . . A3^037 . . . . . . . A3^037 . . . | " + + ". . . . D4^037 . . . . . . . D4^037 . . . | . . . . A3^037 . . . . . . . A3^037 . . . | . . . . E3^047 . . . . . . . E3^047 . . . | . . . . A3^037 . . . . . . . A3^037 . . .", + lead: + "A4 - - C5 - - E5 - A5 - - - G#5 - A5 - | E5 - - D5 - - C5 - B4 - - C5 - - A4 - | G#4 - - B4 - - D5 - E5 - - D5 - - B4 - | A4 - - - - - - - C5 - B4 - A4 - G#4 - | " + + "F5 - - A5 - - F5 - D5 - - F5 - - A4 - | C5 - - E5 - - A5 - G#5 - - E5 - - C5 - | B4 - - G#4 - - E4 - G#4 - - B4 - - E5 - | A4 - - - - - - - A4 - - - . . . .", + drums: + "kh . h s . . s . kh . h s . . s . | kh . h s . . s . kh . h s . . s . | kh . h s . . s . kh . h s . . s . | kh . h s . . s . kh . h s . . s . | " + + "kh . h s . . s . kh . h s . . s . | kh . h s . . s . kh . h s . . s . | kh . h s . . s . kh . h s . . s . | kh . s s . . s . s . s s . . s .", + echo: + ". . . A4 - - C5 - - E5 - A5 - - - G#5 | - A5 - E5 - - D5 - - C5 - B4 - - C5 - | - A4 - G#4 - - B4 - - D5 - E5 - - D5 - | - B4 - A4 - - - - - - - C5 - B4 - A4 | " + + "- G#4 - F5 - - A5 - - F5 - D5 - - F5 - | - A4 - C5 - - E5 - - A5 - G#5 - - E5 - | - C5 - B4 - - G#4 - - E4 - G#4 - - B4 - | - E5 - A4 - - - - - - - A4 - - - .", + }, + B: { + bass: + "C3 . . G2 . . C3 . G2 . . C3 . . G2 . | G2 . . D3 . . G2 . D3 . . G2 . . D3 . | A2 . . E3 . . A2 . E3 . . A2 . . E3 . | E2 . . B2 . . E2 . B2 . . E2 . . B2 .", + stab: + ". . . . C4^047 . . . . . . . C4^047 . . . | . . . . G3^047 . . . . . . . G3^047 . . . | . . . . A3^037 . . . . . . . A3^037 . . . | . . . . E3^047 . . . . . . . E3^047 . . .", + lead: + "G5 - - E5 - - C5 - E5 - - G5 - - E5 - | B4 - - D5 - - G5 - B5 - - G5 - - D5 - | C5 - - E5 - - A5 - E5 - - C5 - - A4 - | G#4 - - B4 - - E5 - G#5 - - - E5 - - -", + drums: + "kh . h s . . s . kh . h s . . s . | kh . h s . . s . kh . h s . . s . | kh . h s . . s . kh . h s . . s . | kh . s s . . s . s . s s . . s .", + echo: + ". . . G5 - - E5 - - C5 - E5 - - G5 - | - E5 - B4 - - D5 - - G5 - B5 - - G5 - | - D5 - C5 - - E5 - - A5 - E5 - - C5 - | - A4 - G#4 - - B4 - - E5 - G#5 - - - E5", + }, + }, + order: ["A","B","A"], + }, + // Raga Rush: A raga rush in D bhairav: a tanpura drone shimmering underneath, a sitar sliding up the + // scale with the flat second and sharp third that give bhairav its edge, and a tabla keeping a + // sixteen-beat theka. Listen for the sitar climbing D, E-flat, F-sharp, G, A in the first bar, the + // long pause on the dark C-sharp, and the bridge that races the same climb at double speed. + snakeRaga: { + bpm: 126, + rush: 10, + voices: { + bass: { wave: "sine", gain: 0.5, decay: 0.4, sustain: 0.9 }, + drone: { wave: "triangle", gain: 0.3, from: 0, decay: 0.4, sustain: 0.7 }, + sitar: { wave: "pulse", duty: 0.125, gain: 0.34, decay: 0.12, sustain: 0.35, vibrato: { rate: 6, depth: 0.022, delay: 0.1 } }, + drums: { kit: true, gain: 0.5, from: 0.1 }, + echo: { wave: "pulse", duty: 0.125, gain: 0.12, from: 0.55, decay: 0.08, sustain: 0.2 }, + }, + patterns: { + A: { + drone: + "D3 . . . A3 . . . D4 . . . D3 . . . | D3 . . . A3 . . . D4 . . . D3 . . . | D3 . . . A3 . . . D4 . . . D3 . . . | D3 . . . A3 . . . D4 . . . D3 . . . | " + + "D3 . . . A3 . . . D4 . . . D3 . . . | D3 . . . A3 . . . D4 . . . D3 . . . | D3 . . . A3 . . . D4 . . . D3 . . . | D3 . . . A3 . . . D4 . . . D3 . . .", + bass: + "D2 - - - - - - - - - - - - - - - | D2 - - - - - - - - - - - - - - - | D2 - - - - - - - - - - - - - - - | D2 - - - - - - - - - - - - - - - | " + + "D2 - - - - - - - - - - - - - - - | D2 - - - - - - - - - - - - - - - | D2 - - - - - - - - - - - - - - - | D2 - - - - - - - - - - - - - - -", + sitar: + "D5 - Eb5 - F#5 - G5 - A5 - - - G5 - F#5 - | Eb5 - D5 - C#5 - D5 - F#5 - - - Eb5 - D5 - | A5 - Bb5 - A5 - G5 - F#5 - G5 - F#5 - Eb5 - | D5 - - - C#5 - D5 - A4 - - - D5 - - - | " + + "D5 - Eb5 - F#5 - G5 - A5 - - - G5 - F#5 - | A5 - Bb5 - A5 - G5 - F#5 - G5 - F#5 - Eb5 - | Eb5 - D5 - C#5 - D5 - F#5 - - - Eb5 - D5 - | D5 - - - C#5 - D5 - A4 - - - D5 - - -", + drums: + "ks k k ks ks k k ks ks h h s s k k ks | ks k k ks ks k k ks ks h h s s k k ks | ks k k ks ks k k ks ks h h s s k k ks | ks k k ks ks k k ks ks h h s s k k ks | " + + "ks k k ks ks k k ks ks h h s s k k ks | ks k k ks ks k k ks ks h h s s k k ks | ks k k ks ks k k ks ks h h s s k k ks | ks k k ks ks k k ks ks h h s s k k ks", + echo: + ". . . . D5 - Eb5 - F#5 - G5 - A5 - - - | G5 - F#5 - Eb5 - D5 - C#5 - D5 - F#5 - - - | Eb5 - D5 - A5 - Bb5 - A5 - G5 - F#5 - G5 - | F#5 - Eb5 - D5 - - - C#5 - D5 - A4 - - - | " + + "D5 - - - D5 - Eb5 - F#5 - G5 - A5 - - - | G5 - F#5 - A5 - Bb5 - A5 - G5 - F#5 - G5 - | F#5 - Eb5 - Eb5 - D5 - C#5 - D5 - F#5 - - - | Eb5 - D5 - D5 - - - C#5 - D5 - A4 - - -", + }, + B: { + drone: + "D3 . . . A3 . . . D4 . . . D3 . . . | D3 . . . A3 . . . D4 . . . D3 . . . | D3 . . . A3 . . . D4 . . . D3 . . . | D3 . . . A3 . . . D4 . . . D3 . . .", + bass: + "D2 - - - - - - - - - - - - - - - | D2 - - - - - - - - - - - - - - - | D2 - - - - - - - - - - - - - - - | D2 - - - - - - - - - - - - - - -", + sitar: + "D5 Eb5 F#5 G5 A5 G5 F#5 Eb5 D5 Eb5 F#5 G5 A5 Bb5 A5 G5 | F#5 G5 A5 Bb5 A5 G5 F#5 Eb5 D5 C#5 D5 Eb5 D5 - D5 - | D5 Eb5 F#5 G5 A5 G5 F#5 Eb5 D5 Eb5 F#5 G5 A5 Bb5 A5 G5 | D5 - - - C#5 - D5 - A4 - - - D5 - - -", + drums: + "ks k k ks ks k k ks ks h h s s k k ks | ks k k ks ks k k ks ks h h s s k k ks | ks k k ks ks k k ks ks h h s s k k ks | ks k k ks ks k k ks ks h h s s k k ks", + echo: + ". . . . D5 Eb5 F#5 G5 A5 G5 F#5 Eb5 D5 Eb5 F#5 G5 | A5 Bb5 A5 G5 F#5 G5 A5 Bb5 A5 G5 F#5 Eb5 D5 C#5 D5 Eb5 | D5 - D5 - D5 Eb5 F#5 G5 A5 G5 F#5 Eb5 D5 Eb5 F#5 G5 | A5 Bb5 A5 G5 D5 - - - C#5 - D5 - A4 - - -", + }, + }, + order: ["A","B","A"], + }, + // Oasis Sama'i: An Arabic sama'i in E hijaz, ten beats to the bar in groups of three, two, two and + // three: an oud plucking around the E, a nay flute winding through the augmented second between F and + // G-sharp, and a darbuka that dances through the long rhythm. Listen for the nay sliding E, F, G-sharp + // in the first bar, the long fall to D-sharp, and the bridge where the oud moves down to A. + snakeSamai: { + bpm: 100, + rush: 8, + bar: 20, + voices: { + oud: { wave: "pulse", duty: 0.25, gain: 0.5, decay: 0.08, sustain: 0.2 }, + nay: { wave: "pulse", duty: 0.125, gain: 0.3, decay: 0.1, sustain: 0.75, vibrato: { rate: 5.5, depth: 0.02, delay: 0.15 } }, + drone: { wave: "sine", gain: 0.26, from: 0.15, decay: 0.3, sustain: 0.9 }, + drums: { kit: true, gain: 0.56, from: 0.1 }, + low: { wave: "triangle", gain: 0.28, from: 0.5, decay: 0.1, sustain: 0.8 }, + echo: { wave: "pulse", duty: 0.125, gain: 0.1, from: 0.6, decay: 0.05, sustain: 0.3 }, + }, + patterns: { + A: { + oud: + "E2 . . . . . E2 . . . F2 . . . E2 . G#2 . . . | E2 . . . . . E2 . . . F2 . . . E2 . G#2 . . . | E2 . . . . . E2 . . . F2 . . . E2 . G#2 . . . | E2 . . . . . E2 . . . F2 . . . E2 . G#2 . . .", + nay: + "E5 - - - F5 - G#5 - - - A5 - - - G#5 - F5 - E5 - | B5 - - - A5 - G#5 - - - F5 - - - E5 - - - D#5 - | E5 - F5 - G#5 - A5 - B5 - A5 - - - G#5 - F5 - E5 - | E5 - - - - - B4 - - - E5 - - - E5 - - - - -", + drone: + "E3 - - - - - - - - - - - - - - - - - - - | E3 - - - - - - - - - - - - - - - - - - - | E3 - - - - - - - - - - - - - - - - - - - | E3 - - - - - - - - - - - - - - - - - - -", + drums: + "k . h . h . s . h . s . h . k . h . h . | k . h . h . s . h . s . h . k . h . h . | k . h . h . s . h . s . h . k . h . h . | k . s . s . s . s . s . s . k . s . s .", + low: + "E4 - - - F4 - G#4 - - - A4 - - - G#4 - F4 - E4 - | B4 - - - A4 - G#4 - - - F4 - - - E4 - - - D#4 - | E4 - F4 - G#4 - A4 - B4 - A4 - - - G#4 - F4 - E4 - | E4 - - - - - B3 - - - E4 - - - E4 - - - - -", + echo: + ". . . . E5 - - - F5 - G#5 - - - A5 - | - - G#5 - F5 - E5 - B5 - - - A5 - G#5 - | - - F5 - - - E5 - - - D#5 - E5 - F5 - | G#5 - A5 - B5 - A5 - - - G#5 - F5 - E5 - | " + + "E5 - - - - - B4 - - - E5 - - - E5 -", + }, + B: { + oud: + "A1 . . . . . A1 . . . B1 . . . A1 . C2 . . . | A1 . . . . . A1 . . . B1 . . . A1 . C2 . . . | E2 . . . . . E2 . . . F2 . . . E2 . G#2 . . . | E2 . . . . . E2 . . . F2 . . . E2 . G#2 . . .", + nay: + "A5 - - - G#5 - F5 - - - E5 - - - F5 - G#5 - A5 - | B5 - - - A5 - G#5 - - - A5 - - - B5 - - - A5 - | G#5 - A5 - B5 - A5 - G#5 - F5 - - - E5 - F5 - G#5 - | E5 - - - - - B4 - - - E5 - - - E5 - - - - -", + drone: + "E3 - - - - - - - - - - - - - - - - - - - | E3 - - - - - - - - - - - - - - - - - - - | E3 - - - - - - - - - - - - - - - - - - - | E3 - - - - - - - - - - - - - - - - - - -", + drums: + "k . h . h . s . h . s . h . k . h . h . | k . h . h . s . h . s . h . k . h . h . | k . h . h . s . h . s . h . k . h . h . | k . s . s . s . s . s . s . k . s . s .", + low: + "A4 - - - G#4 - F4 - - - E4 - - - F4 - G#4 - A4 - | B4 - - - A4 - G#4 - - - A4 - - - B4 - - - A4 - | G#4 - A4 - B4 - A4 - G#4 - F4 - - - E4 - F4 - G#4 - | E4 - - - - - B3 - - - E4 - - - E4 - - - - -", + echo: + ". . . . A5 - - - G#5 - F5 - - - E5 - | - - F5 - G#5 - A5 - B5 - - - A5 - G#5 - | - - A5 - - - B5 - - - A5 - G#5 - A5 - | B5 - A5 - G#5 - F5 - - - E5 - F5 - G#5 - | " + + "E5 - - - - - B4 - - - E5 - - - E5 -", + }, + }, + order: ["A","A","B","A"], + }, + // Bouzouki Blaze: A Greek dance in A harmonic minor: a bouzouki picking every note twice in a + // shimmering tremolo, a bass that booms on the beat and a drum that drives it forward. Listen for the + // raised G-sharp that bites into every A, the climb to the high B over the E chord, and the bridge + // that brightens to C major before the dark returns. + snakeBouzouki: { + bpm: 124, + rush: 10, + voices: { + bass: { wave: "triangle", gain: 0.9, decay: 0.05, sustain: 0.3 }, + lead: { wave: "pulse", duty: 0.125, gain: 0.32, decay: 0.05, sustain: 0.5 }, + drums: { kit: true, gain: 0.6, from: 0.1 }, + low: { wave: "triangle", gain: 0.3, from: 0.4, decay: 0.1, sustain: 0.8 }, + echo: { wave: "pulse", duty: 0.125, gain: 0.1, from: 0.7, decay: 0.04, sustain: 0.4 }, + }, + patterns: { + A: { + bass: + "A2 . . . E3 . . . A2 . . . E3 . . . | A2 . . . E3 . . . A2 . . . E3 . . . | E2 . . . B2 . . . E2 . . . B2 . . . | A2 . . . E3 . . . A2 . . . E3 . . . | " + + "D2 . . . A2 . . . D2 . . . A2 . . . | A2 . . . E3 . . . A2 . . . E3 . . . | E2 . . . B2 . . . E2 . . . B2 . . . | A2 . . . E3 . . . A2 . . . E3 . . .", + lead: + "A4 A4 C5 C5 E5 E5 A5 A5 G#5 G#5 E5 E5 C5 C5 A4 A4 | B4 B4 C5 C5 D5 D5 E5 E5 F5 F5 E5 E5 C5 C5 B4 B4 | G#4 G#4 B4 B4 E5 E5 G#5 G#5 B5 B5 G#5 G#5 E5 E5 B4 B4 | A4 A4 C5 C5 A4 A4 E4 E4 A4 A4 . . . . . . | " + + "D5 D5 F5 F5 A5 A5 F5 F5 D5 D5 F5 F5 A4 A4 D5 D5 | C5 C5 E5 E5 A5 A5 E5 E5 C5 C5 E5 E5 A4 A4 C5 C5 | B4 B4 G#4 G#4 E4 E4 G#4 G#4 B4 B4 E5 E5 G#5 G#5 B5 B5 | A5 A5 E5 E5 C5 C5 A4 A4 A4 A4 . . . . . .", + drums: + "k . h . s . h . k . h . s . h h | k . h . s . h . k . h . s . h h | k . h . s . h . k . h . s . h h | k . h . s . h . k . h . s . h h | " + + "k . h . s . h . k . h . s . h h | k . h . s . h . k . h . s . h h | k . h . s . h . k . h . s . h h | k . h . s . h . s s s s s s s s", + low: + "A3 A3 C4 C4 E4 E4 A4 A4 G#4 G#4 E4 E4 C4 C4 A3 A3 | B3 B3 C4 C4 D4 D4 E4 E4 F4 F4 E4 E4 C4 C4 B3 B3 | G#3 G#3 B3 B3 E4 E4 G#4 G#4 B4 B4 G#4 G#4 E4 E4 B3 B3 | A3 A3 C4 C4 A3 A3 E3 E3 A3 A3 . . . . . . | " + + "D4 D4 F4 F4 A4 A4 F4 F4 D4 D4 F4 F4 A3 A3 D4 D4 | C4 C4 E4 E4 A4 A4 E4 E4 C4 C4 E4 E4 A3 A3 C4 C4 | B3 B3 G#3 G#3 E3 E3 G#3 G#3 B3 B3 E4 E4 G#4 G#4 B4 B4 | A4 A4 E4 E4 C4 C4 A3 A3 A3 A3 . . . . . .", + echo: + ". . . . A4 A4 C5 C5 E5 E5 A5 A5 G#5 G#5 E5 E5 | C5 C5 A4 A4 B4 B4 C5 C5 D5 D5 E5 E5 F5 F5 E5 E5 | C5 C5 B4 B4 G#4 G#4 B4 B4 E5 E5 G#5 G#5 B5 B5 G#5 G#5 | E5 E5 B4 B4 A4 A4 C5 C5 A4 A4 E4 E4 A4 A4 . . | " + + ". . . . D5 D5 F5 F5 A5 A5 F5 F5 D5 D5 F5 F5 | A4 A4 D5 D5 C5 C5 E5 E5 A5 A5 E5 E5 C5 C5 E5 E5 | A4 A4 C5 C5 B4 B4 G#4 G#4 E4 E4 G#4 G#4 B4 B4 E5 E5 | G#5 G#5 B5 B5 A5 A5 E5 E5 C5 C5 A4 A4 A4 A4 . .", + }, + B: { + bass: + "C3 . . . G2 . . . C3 . . . G2 . . . | G2 . . . D3 . . . G2 . . . D3 . . . | D2 . . . A2 . . . D2 . . . A2 . . . | E2 . . . B2 . . . E2 . . . B2 . . .", + lead: + "E5 E5 G5 G5 C6 C6 G5 G5 E5 E5 C5 C5 E5 E5 G5 G5 | D5 D5 G5 G5 B5 B5 G5 G5 D5 D5 B4 B4 G4 G4 B4 B4 | D5 D5 F5 F5 A5 A5 F5 F5 D5 D5 F5 F5 A4 A4 D5 D5 | G#4 G#4 B4 B4 E5 E5 G#5 G#5 B5 B5 G#5 G#5 E5 E5 B4 B4", + drums: + "k . h . s . h . k . h . s . h h | k . h . s . h . k . h . s . h h | k . h . s . h . k . h . s . h h | k . h . s . h . s s s s s s s s", + low: + "E4 E4 G4 G4 C5 C5 G4 G4 E4 E4 C4 C4 E4 E4 G4 G4 | D4 D4 G4 G4 B4 B4 G4 G4 D4 D4 B3 B3 G3 G3 B3 B3 | D4 D4 F4 F4 A4 A4 F4 F4 D4 D4 F4 F4 A3 A3 D4 D4 | G#3 G#3 B3 B3 E4 E4 G#4 G#4 B4 B4 G#4 G#4 E4 E4 B3 B3", + echo: + ". . . . E5 E5 G5 G5 C6 C6 G5 G5 E5 E5 C5 C5 | E5 E5 G5 G5 D5 D5 G5 G5 B5 B5 G5 G5 D5 D5 B4 B4 | G4 G4 B4 B4 D5 D5 F5 F5 A5 A5 F5 F5 D5 D5 F5 F5 | A4 A4 D5 D5 G#4 G#4 B4 B4 E5 E5 G#5 G#5 B5 B5 G#5 G#5", + }, + }, + order: ["A","B","A"], + }, + // Solea Sunrise: A solea over the twelve-beat flamenco compas, accented on three, six, eight, ten and + // twelve: a guitar rolling up and down each chord of the Andalusian cadence, hand claps landing on the + // accents and a picado lead running down every chord. Listen for the claps skipping the beats that are + // not accented, the G-sharp that turns the E chord into a cliff, and the bridge that races through D + // minor. + snakeSolea: { + bpm: 160, + rush: 8, + bar: 24, + voices: { + bass: { wave: "triangle", gain: 0.88, decay: 0.07, sustain: 0.4 }, + lead: { wave: "pulse", duty: 0.25, gain: 0.32, decay: 0.07, sustain: 0.6, vibrato: { rate: 6, depth: 0.012, delay: 0.2 } }, + guitar: { wave: "pulse", duty: 0.125, gain: 0.22, from: 0.1, decay: 0.05, sustain: 0.2 }, + drums: { kit: true, gain: 0.56, from: 0.1 }, + low: { wave: "triangle", gain: 0.3, from: 0.5, decay: 0.1, sustain: 0.8 }, + echo: { wave: "pulse", duty: 0.125, gain: 0.1, from: 0.6, decay: 0.05, sustain: 0.3 }, + }, + patterns: { + A: { + bass: + "A2 . . . E3 . . . . . A2 . . . E3 . . . A2 . . . E3 . | G2 . . . D3 . . . . . G2 . . . D3 . . . G2 . . . D3 . | F2 . . . C3 . . . . . F2 . . . C3 . . . F2 . . . C3 . | E2 . . . B2 . . . . . E2 . . . B2 . . . E2 . . . B2 . | " + + "A2 . . . E3 . . . . . A2 . . . E3 . . . A2 . . . E3 . | G2 . . . D3 . . . . . G2 . . . D3 . . . G2 . . . D3 . | F2 . . . C3 . . . . . F2 . . . C3 . . . F2 . . . C3 . | E2 . . . B2 . . . . . E2 . . . B2 . . . E2 . . . B2 .", + guitar: + "A3 C4 E4 A4 E4 C4 A3 C4 E4 A4 E4 C4 A3 C4 E4 A4 E4 C4 A3 C4 E4 A4 E4 C4 | G3 B3 D4 G4 D4 B3 G3 B3 D4 G4 D4 B3 G3 B3 D4 G4 D4 B3 G3 B3 D4 G4 D4 B3 | F3 A3 C4 F4 C4 A3 F3 A3 C4 F4 C4 A3 F3 A3 C4 F4 C4 A3 F3 A3 C4 F4 C4 A3 | E3 G#3 B3 E4 B3 G#3 E3 G#3 B3 E4 B3 G#3 E3 G#3 B3 E4 B3 G#3 E3 G#3 B3 E4 B3 G#3 | " + + "A3 C4 E4 A4 E4 C4 A3 C4 E4 A4 E4 C4 A3 C4 E4 A4 E4 C4 A3 C4 E4 A4 E4 C4 | G3 B3 D4 G4 D4 B3 G3 B3 D4 G4 D4 B3 G3 B3 D4 G4 D4 B3 G3 B3 D4 G4 D4 B3 | F3 A3 C4 F4 C4 A3 F3 A3 C4 F4 C4 A3 F3 A3 C4 F4 C4 A3 F3 A3 C4 F4 C4 A3 | E3 G#3 B3 E4 B3 G#3 E3 G#3 B3 E4 B3 G#3 E3 G#3 B3 E4 B3 G#3 E3 G#3 B3 E4 B3 G#3", + lead: + "A5 - G5 - E5 - C5 - E5 - A5 - G5 - E5 - C5 - E5 - A4 - - - | G5 - F5 - D5 - B4 - D5 - G5 - F5 - D5 - B4 - D5 - G4 - - - | F5 - E5 - C5 - A4 - C5 - F5 - E5 - C5 - A4 - C5 - F4 - - - | E5 - F5 - E5 - D5 - B4 - G#4 - B4 - E5 - G#5 - B5 - - - . . | " + + "E5 - A5 - C6 - B5 - A5 - G5 - E5 - C5 - A4 - - - - - - - | D5 - G5 - B5 - A5 - G5 - F5 - D5 - B4 - G4 - - - - - - - | C5 - F5 - A5 - G5 - F5 - E5 - C5 - A4 - F4 - - - - - - - | B4 - E5 - G#5 - F5 - E5 - D5 - B4 - G#4 - E4 - - - - - - -", + drums: + "kh . . . s . . . . . s . . . s . . . s . . . s . | kh . . . s . . . . . s . . . s . . . s . . . s . | kh . . . s . . . . . s . . . s . . . s . . . s . | kh . . . s . . . . . s . . . s . . . s . . . s . | " + + "kh . . . s . . . . . s . . . s . . . s . . . s . | kh . . . s . . . . . s . . . s . . . s . . . s . | kh . . . s . . . . . s . . . s . . . s . . . s . | kh . . . s . s . s . s . k . s . s . s . s . s .", + low: + "A4 - G4 - E4 - C4 - E4 - A4 - G4 - E4 - C4 - E4 - A3 - - - | G4 - F4 - D4 - B3 - D4 - G4 - F4 - D4 - B3 - D4 - G3 - - - | F4 - E4 - C4 - A3 - C4 - F4 - E4 - C4 - A3 - C4 - F3 - - - | E4 - F4 - E4 - D4 - B3 - G#3 - B3 - E4 - G#4 - B4 - - - . . | " + + "E4 - A4 - C5 - B4 - A4 - G4 - E4 - C4 - A3 - - - - - - - | D4 - G4 - B4 - A4 - G4 - F4 - D4 - B3 - G3 - - - - - - - | C4 - F4 - A4 - G4 - F4 - E4 - C4 - A3 - F3 - - - - - - - | B3 - E4 - G#4 - F4 - E4 - D4 - B3 - G#3 - E3 - - - - - - -", + echo: + ". . . . A5 - G5 - E5 - C5 - E5 - A5 - | G5 - E5 - C5 - E5 - A4 - - - G5 - F5 - | D5 - B4 - D5 - G5 - F5 - D5 - B4 - D5 - | G4 - - - F5 - E5 - C5 - A4 - C5 - F5 - | " + + "E5 - C5 - A4 - C5 - F4 - - - E5 - F5 - | E5 - D5 - B4 - G#4 - B4 - E5 - G#5 - B5 - | - - . . E5 - A5 - C6 - B5 - A5 - G5 - | E5 - C5 - A4 - - - - - - - D5 - G5 - | " + + "B5 - A5 - G5 - F5 - D5 - B4 - G4 - - - | - - - - C5 - F5 - A5 - G5 - F5 - E5 - | C5 - A4 - F4 - - - - - - - B4 - E5 - | G#5 - F5 - E5 - D5 - B4 - G#4 - E4 - - -", + }, + B: { + bass: + "D2 . . . A2 . . . . . D2 . . . A2 . . . D2 . . . A2 . | E2 . . . B2 . . . . . E2 . . . B2 . . . E2 . . . B2 . | A2 . . . E3 . . . . . A2 . . . E3 . . . A2 . . . E3 . | E2 . . . B2 . . . . . E2 . . . B2 . . . E2 . . . B2 .", + guitar: + "D3 F3 A3 D4 A3 F3 D3 F3 A3 D4 A3 F3 D3 F3 A3 D4 A3 F3 D3 F3 A3 D4 A3 F3 | E3 G#3 B3 E4 B3 G#3 E3 G#3 B3 E4 B3 G#3 E3 G#3 B3 E4 B3 G#3 E3 G#3 B3 E4 B3 G#3 | A3 C4 E4 A4 E4 C4 A3 C4 E4 A4 E4 C4 A3 C4 E4 A4 E4 C4 A3 C4 E4 A4 E4 C4 | E3 G#3 B3 E4 B3 G#3 E3 G#3 B3 E4 B3 G#3 E3 G#3 B3 E4 B3 G#3 E3 G#3 B3 E4 B3 G#3", + lead: + "F5 - - A5 - - F5 - D5 - - F5 - - A4 - - - D5 - - - - - | G#5 - - B5 - - G#5 - E5 - - G#5 - - B4 - - - E5 - - - - - | C5 - - E5 - - A5 - E5 - - C5 - - A4 - - - A4 - - - - - | G#5 - - B5 - - G#5 - E5 - - G#5 - - B4 - - - E5 - - - - -", + drums: + "kh . . . s . . . . . s . . . s . . . s . . . s . | kh . . . s . . . . . s . . . s . . . s . . . s . | kh . . . s . . . . . s . . . s . . . s . . . s . | kh . . . s . s . s . s . k . s . s . s . s . s .", + low: + "F4 - - A4 - - F4 - D4 - - F4 - - A3 - - - D4 - - - - - | G#4 - - B4 - - G#4 - E4 - - G#4 - - B3 - - - E4 - - - - - | C4 - - E4 - - A4 - E4 - - C4 - - A3 - - - A3 - - - - - | G#4 - - B4 - - G#4 - E4 - - G#4 - - B3 - - - E4 - - - - -", + echo: + ". . . . F5 - - A5 - - F5 - D5 - - F5 | - - A4 - - - D5 - - - - - G#5 - - B5 | - - G#5 - E5 - - G#5 - - B4 - - - E5 - | - - - - C5 - - E5 - - A5 - E5 - - C5 | " + + "- - A4 - - - A4 - - - - - G#5 - - B5 | - - G#5 - E5 - - G#5 - - B4 - - - E5 -", + }, + }, + order: ["A","B","A"], + }, + // Raga Lantern: A raga in the dark todi mode over jhaptal, ten beats to the bar counted + // two-three-two-three: a tanpura drone, a tabla keeping the cycle and a sitar that climbs the flat + // second and sharp fourth and falls back. Listen for the sitar reaching B-flat before it falls, the + // silences after the sam on beat one, and the bridge that runs the whole climb at double speed. + snakeLantern: { + bpm: 120, + rush: 10, + bar: 20, + voices: { + bass: { wave: "sine", gain: 0.5, decay: 0.4, sustain: 0.9 }, + tanpura: { wave: "triangle", gain: 0.3, decay: 0.4, sustain: 0.7 }, + sitar: { wave: "pulse", duty: 0.125, gain: 0.34, decay: 0.12, sustain: 0.35, vibrato: { rate: 6, depth: 0.022, delay: 0.1 } }, + drums: { kit: true, gain: 0.52, from: 0.1 }, + low: { wave: "triangle", gain: 0.28, from: 0.5, decay: 0.1, sustain: 0.8 }, + echo: { wave: "pulse", duty: 0.125, gain: 0.12, from: 0.55, decay: 0.08, sustain: 0.2 }, + }, + patterns: { + A: { + tanpura: + "D3 . . . . A3 . . . . D4 . . . . D3 . . . . | D3 . . . . A3 . . . . D4 . . . . D3 . . . . | D3 . . . . A3 . . . . D4 . . . . D3 . . . . | D3 . . . . A3 . . . . D4 . . . . D3 . . . .", + bass: + "D2 - - - - - - - - - - - - - - - - - - - | D2 - - - - - - - - - - - - - - - - - - - | D2 - - - - - - - - - - - - - - - - - - - | D2 - - - - - - - - - - - - - - - - - - -", + sitar: + "D5 - Eb5 - F5 - G#5 - A5 - - - Bb5 - A5 - G#5 - F5 - | Eb5 - D5 - C#5 - D5 - - - F5 - - - Eb5 - D5 - - - | A5 - G#5 - F5 - Eb5 - F5 - G#5 - A5 - - - F5 - D5 - | D5 - - - - - A4 - - - D5 - - - D5 - - - - -", + drums: + "ks . k . ks . k . k . h . h . ks . k . k . | ks . k . ks . k . k . h . h . ks . k . k . | ks . k . ks . k . k . h . h . ks . k . k . | ks . k . ks . k . k . h . h . ks . k . k .", + low: + "D4 - D#4 - F4 - G#4 - A4 - - - A#4 - A4 - G#4 - F4 - | D#4 - D4 - C#4 - D4 - - - F4 - - - D#4 - D4 - - - | A4 - G#4 - F4 - D#4 - F4 - G#4 - A4 - - - F4 - D4 - | D4 - - - - - A3 - - - D4 - - - D4 - - - - -", + echo: + ". . . . D5 - Eb5 - F5 - G#5 - A5 - - - | Bb5 - A5 - G#5 - F5 - Eb5 - D5 - C#5 - D5 - | - - F5 - - - Eb5 - D5 - - - A5 - G#5 - | F5 - Eb5 - F5 - G#5 - A5 - - - F5 - D5 - | " + + "D5 - - - - - A4 - - - D5 - - - D5 -", + }, + B: { + tanpura: + "D3 . . . . A3 . . . . D4 . . . . D3 . . . . | D3 . . . . A3 . . . . D4 . . . . D3 . . . . | D3 . . . . A3 . . . . D4 . . . . D3 . . . . | D3 . . . . A3 . . . . D4 . . . . D3 . . . .", + bass: + "D2 - - - - - - - - - - - - - - - - - - - | D2 - - - - - - - - - - - - - - - - - - - | D2 - - - - - - - - - - - - - - - - - - - | D2 - - - - - - - - - - - - - - - - - - -", + sitar: + "D5 Eb5 F5 G#5 A5 Bb5 A5 G#5 F5 Eb5 D5 Eb5 F5 G#5 A5 - F5 - D5 - | G#5 A5 Bb5 A5 G#5 F5 Eb5 D5 C#5 D5 Eb5 D5 C#5 - D5 - D5 - - - | D5 Eb5 F5 G#5 A5 Bb5 A5 G#5 F5 Eb5 D5 Eb5 F5 G#5 A5 - F5 - D5 - | D5 - - - - - A4 - - - D5 - - - D5 - - - - -", + drums: + "ks . k . ks . k . k . h . h . ks . k . k . | ks . k . ks . k . k . h . h . ks . k . k . | ks . k . ks . k . k . h . h . ks . k . k . | ks . k . ks . k . k . h . h . ks . k . k .", + low: + "D4 D#4 F4 G#4 A4 A#4 A4 G#4 F4 D#4 D4 D#4 F4 G#4 A4 - F4 - D4 - | G#4 A4 A#4 A4 G#4 F4 D#4 D4 C#4 D4 D#4 D4 C#4 - D4 - D4 - - - | D4 D#4 F4 G#4 A4 A#4 A4 G#4 F4 D#4 D4 D#4 F4 G#4 A4 - F4 - D4 - | D4 - - - - - A3 - - - D4 - - - D4 - - - - -", + echo: + ". . . . D5 Eb5 F5 G#5 A5 Bb5 A5 G#5 F5 Eb5 D5 Eb5 | F5 G#5 A5 - F5 - D5 - G#5 A5 Bb5 A5 G#5 F5 Eb5 D5 | C#5 D5 Eb5 D5 C#5 - D5 - D5 - - - D5 Eb5 F5 G#5 | A5 Bb5 A5 G#5 F5 Eb5 D5 Eb5 F5 G#5 A5 - F5 - D5 - | " + + "D5 - - - - - A4 - - - D5 - - - D5 -", + }, + }, + order: ["A","A","B","A"], + }, +}; diff --git a/src/web-console/public/activities/snake-sfx.js b/src/web-console/public/activities/snake-sfx.js index d19126e..3d0dedf 100644 --- a/src/web-console/public/activities/snake-sfx.js +++ b/src/web-console/public/activities/snake-sfx.js @@ -1,11 +1,15 @@ -// Plan2Code Web Console - snake: its own sound effects, merged into tones.js beside the shared kit; defines only. +// Plan2Code Web Console - snake: its own sound effects and music, merged into tones.js beside the shared kit; defines only. // // `tones` are one-shot sounds played with tone(name, level, pitch); `hums` are // held sounds kept going with hum(id, name, level, pitch). Both take the shapes // tones.js documents, as plain objects (tones.js freezes them). A name may be -// defined only once across tones.js and every game's file. No imports. +// defined only once across tones.js and every game's file. The music is in +// snake-music.js, merged in below as `music`: that file is the only import. + +import { SNAKE_MUSIC } from "./snake-music.js"; export default { + music: SNAKE_MUSIC, tones: { // A crunchy bite laid over `eat` while a combo runs (pitched up a step // per combo), and on a caught runaway. diff --git a/src/web-console/public/activities/snake.js b/src/web-console/public/activities/snake.js index dab1535..3bb6986 100644 --- a/src/web-console/public/activities/snake.js +++ b/src/web-console/public/activities/snake.js @@ -234,6 +234,31 @@ export const multiplier = (round) => (active(round, "disco") ? 3 : 1); // Whether the board is iced over. export const icy = (round) => round.level === ICE_LEVEL; +// The music: ten tracks (snake-music.js), one for each level of a round. A +// round deals them in a fresh order, so a run hears a different track at every +// level and none twice (nine levels, ten tracks), and a round never opens on +// the track the last one opened on. +export const MUSIC_TRACKS = Object.freeze(["snakeBazaar", "snakeJungle", "snakePirate", "snakeClockwork", "snakeTango", "snakeRaga", "snakeSamai", "snakeBouzouki", "snakeSolea", "snakeLantern"]); + +// Every track in a new order, shuffled with the given random, the first never `last`. +export function dealMusic(random = Math.random, last = null) { + const deck = [...MUSIC_TRACKS]; + for (let i = deck.length - 1; i > 0; i--) { + const j = Math.floor(random() * (i + 1)); + [deck[i], deck[j]] = [deck[j], deck[i]]; + } + if (deck[0] === last) [deck[0], deck[1]] = [deck[1], deck[0]]; + return deck; +} + +// The deal's track for a level: the first for level 1, the second for level 2. +export const trackFor = (deck, level) => deck[(Math.max(1, level) - 1) % deck.length]; + +// How hot play is for the music, 0 to 1: the snake's speed against the +// opening pace (one to two times) as 0.3 to 1, so the lead and the drums are +// in from the first step and Slow-mo, which opens every level, thins it out. +export const heat = (round) => Math.min(1, Math.max(0.3, 0.3 + 0.7 * (STEP_MS / pace(round) - 1))); + // The cells a food covers: one, or four for a boss. const foodCells = (f) => (!f ? [] : f.boss ? [f, { x: f.x + 1, y: f.y }, { x: f.x, y: f.y + 1 }, { x: f.x + 1, y: f.y + 1 }] : [f]); @@ -1506,10 +1531,13 @@ const scaleStep = (n) => SCALE[Math.max(0, Math.min(SCALE.length - 1, n))]; // the sound's pitch, never the game. const wobble = (spread = 0.06) => 1 - spread / 2 + Math.random() * spread; -function create({ canvas, tone = () => {}, hum = () => {}, onScore = () => {}, best = () => 0, memo = null }) { +function create({ canvas, tone = () => {}, hum = () => {}, music = () => {}, onScore = () => {}, best = () => 0, memo = null }) { const ctx = canvas.getContext("2d"); let colors = null; let round = newRound(); + // The round's deal of tracks, and the one it opened on (so the next round opens on another). + let deck = []; + let opener = null; let state = "ready"; let cell = MIN_CELL; let elapsed = 0; @@ -1922,6 +1950,8 @@ function create({ canvas, tone = () => {}, hum = () => {}, onScore = () => {}, b const start = () => { colors = null; round = newRound(); + deck = dealMusic(Math.random, opener); + opener = deck[0]; elapsed = 0; state = "running"; resetFx(); @@ -1999,6 +2029,7 @@ function create({ canvas, tone = () => {}, hum = () => {}, onScore = () => {}, b if (state === "running") { cues(ms); hums(); + if (deck.length) music(trackFor(deck, round.level), heat(round)); } paint(); }, diff --git a/src/web-console/public/activities/trails-music.js b/src/web-console/public/activities/trails-music.js new file mode 100644 index 0000000..71eaf50 --- /dev/null +++ b/src/web-console/public/activities/trails-music.js @@ -0,0 +1,611 @@ +// Plan2Code Web Console - trails: its music tracks, merged into trails-sfx.js beside the sounds; defines only. +// +// Fourteen tracks, one dealt to each arena of a round (MUSIC_TRACKS and dealMusic in +// trails.js), picked on the pages in prototypes/music/light-trails. Most are dark, +// cinematic grid electro in minor keys at 96 to 120 bpm: a driving sawtooth bass (in +// threes against the beat, or a walking eighth-note ostinato), a sixteenth sequence +// ticking over a held note, sawtooth brass and a long pulse lead; the last three +// lean cyberpunk and synthwave. Each is the shape music.js documents, +// { bpm, rush, voices, patterns, order }, and builds with the heat: the bass, drums +// and sequence while a heat lines up, then the brass and lead once the riders go. +// A name may be defined only once across tones.js and every game's file. No imports. + +export const TRAILS_MUSIC = { + // Grid electro: A TRON-style D minor electro at 120: a sequenced sawtooth bass in groups of three + // against the beat, a cold sixteenth sequence that walks its top note, dotted brass stabs, and a + // heroic lead; the chorus rises through B-flat and C to a bright A major. + trailsGridElectro: { + bpm: 120, + rush: 10, + voices: { + bass: { wave: "sawtooth", gain: 0.42, decay: 0.05, sustain: 0.3 }, + drums: { kit: true, gain: 0.8, from: 0.1 }, + seq: { wave: "pulse", duty: 0.125, gain: 0.2, decay: 0.03, sustain: 0.25, from: 0.2 }, + brass: { wave: "sawtooth", gain: 0.13, decay: 0.1, sustain: 0.7, from: 0.35 }, + lead: { wave: "pulse", duty: 0.25, gain: 0.34, decay: 0.12, sustain: 0.8, vibrato: { rate: 5.5, depth: 0.01, delay: 0.2 }, from: 0.5 }, + }, + patterns: { + A: { + bass: "D2 D2 D3 D2 D2 D3 D2 D2 D3 D2 D2 D3 D2 D3 D2 D3 | D2 D2 D3 D2 D2 D3 D2 D2 D3 D2 D2 D3 D2 D3 D2 D3 | Bb1 Bb1 Bb2 Bb1 Bb1 Bb2 Bb1 Bb1 Bb2 Bb1 Bb1 Bb2 Bb1 Bb2 Bb1 Bb2 | C2 C2 C3 C2 C2 C3 C2 C2 A1 A1 A2 A1 A1 A2 C#2 E2", + drums: "k . h . s . h . k . h . s . h . | k . h . s . h . k . h . s . h k | k . h . s . h . k . h . s . h . | k . h . s . h k k . s . s s s s", + seq: "D5 A4 F5 A4 D5 A4 F5 A4 D5 A4 F5 A4 E5 A4 F5 A4 | D5 A4 F5 A4 D5 A4 F5 A4 D5 A4 G5 A4 F5 A4 E5 A4 | D5 Bb4 F5 Bb4 D5 Bb4 F5 Bb4 D5 Bb4 F5 Bb4 G5 Bb4 F5 Bb4 | E5 C5 G5 C5 E5 C5 G5 C5 E5 C#5 A5 C#5 E5 C#5 G5 C#5", + }, + B: { + bass: "D2 D2 D3 D2 D2 D3 D2 D2 D3 D2 D2 D3 D2 D3 D2 D3 | D2 D2 D3 D2 D2 D3 D2 D2 D3 D2 D2 D3 D2 D3 D2 D3 | Bb1 Bb1 Bb2 Bb1 Bb1 Bb2 Bb1 Bb1 Bb2 Bb1 Bb1 Bb2 Bb1 Bb2 Bb1 Bb2 | C2 C2 C3 C2 C2 C3 C2 C2 A1 A1 A2 A1 A1 A2 C#2 E2", + drums: "kh h h h sh h h h kh h kh h sh h h h | kh h h h sh h h h kh h kh h sh h h h | kh h h h sh h h h kh h kh h sh h h h | kh h h h sh h h h s . s s s s s s", + seq: "D5 A4 F5 A4 D5 A4 F5 A4 D5 A4 F5 A4 E5 A4 F5 A4 | D5 A4 F5 A4 D5 A4 F5 A4 D5 A4 G5 A4 F5 A4 E5 A4 | D5 Bb4 F5 Bb4 D5 Bb4 F5 Bb4 D5 Bb4 F5 Bb4 G5 Bb4 F5 Bb4 | E5 C5 G5 C5 E5 C5 G5 C5 E5 C#5 A5 C#5 E5 C#5 G5 C#5", + brass: "D4^037 - - . . . D4^037 - - . . . D4^037 - - . | D4^037 - - . . . D4^037 - - . . . D4^037 - - . | Bb3^047 - - . . . Bb3^047 - - . . . Bb3^047 - - . | C4^047 - - . . . C4^047 - A3^047 - - . . . A3^047 -", + lead: "D6 - - - - - - - C6 - A5 - - - F5 - | G5 - - - A5 - - - F5 - - - E5 - D5 - | F5 - - - - - - - D6 - - - C6 - Bb5 - | C6 - - - - - - - C#6 - - - E6 - - -", + }, + C: { + bass: "Bb1 Bb1 Bb2 Bb1 Bb1 Bb2 Bb1 Bb1 Bb2 Bb1 Bb1 Bb2 Bb1 Bb2 Bb1 Bb2 | C2 C2 C3 C2 C2 C3 C2 C2 C3 C2 C2 C3 C2 C3 C2 C3 | A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A2 A1 A2 | D2 D2 D3 D2 D2 D3 D2 D2 D3 D2 D2 D3 C2 C3 A1 A2", + drums: "k . h k s . h k k . h k s . h k | k . h k s . h k k . h k s . h k | k . h k s . h k k . h k s . h k | k . h k s . h k s s s s s s s s", + seq: "F5 D5 Bb4 D5 F5 D5 Bb4 D5 F5 D5 Bb4 D5 F5 D5 Bb4 D5 | G5 E5 C5 E5 G5 E5 C5 E5 G5 E5 C5 E5 G5 E5 C5 E5 | E5 C#5 A4 C#5 E5 C#5 A4 C#5 E5 C#5 A4 C#5 E5 C#5 A4 C#5 | F5 D5 A4 D5 F5 D5 A4 D5 F5 D5 A4 D5 A5 F5 D5 A4", + brass: "Bb3^047 - - - - - - - - - - - - - - - | C4^047 - - - - - - - - - - - - - - - | A3^047 - - - - - - - - - - - - - - - | D4^037 - - - - - - - - - - - - - - -", + lead: "D6 - - - F6 - - - D6 - - - Bb5 - C6 - | E6 - - - G6 - - - E6 - - - C6 - D6 - | C#6 - - - E6 - - - A5 - - - C#6 - E6 - | D6 - - - - - - - - - - - . . . .", + }, + D: { + bass: "D2 - - - - - - - - - - - - - - - | D2 - - - - - - - - - - - - - - - | Bb1 - - - - - - - - - - - - - - - | A1 - - - - - - - A1 - - - A1 - A1 -", + drums: ". . h . . . h . . . h . . . h . | . . h . . . h . . . h . . . h . | . . h . . . h . . . h . . . h . | s . s . s . s . s s s s s s s s", + seq: "D5 A4 F5 A4 D5 A4 F5 A4 D5 A4 F5 A4 E5 A4 F5 A4 | D5 A4 F5 A4 D5 A4 F5 A4 D5 A4 G5 A4 F5 A4 E5 A4 | D5 Bb4 F5 Bb4 D5 Bb4 F5 Bb4 D5 Bb4 F5 Bb4 G5 Bb4 F5 Bb4 | E5 C#5 A5 C#5 E5 C#5 A5 C#5 E5 C#5 A5 C#5 G5 E5 C#5 A4", + lead: "A5 - - - - - - - - - - - - - - - | G5 - - - - - - - F5 - - - - - - - | F5 - - - - - - - - - - - - - - - | E5 - - - - - - - C#5 - - - - - - -", + }, + }, + order: ["A", "B", "C", "D", "B", "C"], + }, + // Recognizer: Something huge patrolling overhead at 104: a heavy eighth-note ostinato that walks + // down to G at the end of each bar, big half-time snares and slow brass swells; the chorus pounds + // up through A-flat and B-flat to a high G, and the last section slips onto a menacing D-flat. + trailsRecognizer: { + bpm: 104, + rush: 16, + voices: { + bass: { wave: "sawtooth", gain: 0.44, decay: 0.06, sustain: 0.4 }, + drums: { kit: true, gain: 0.82, from: 0.1 }, + seq: { wave: "pulse", duty: 0.125, gain: 0.18, decay: 0.03, sustain: 0.25, from: 0.2 }, + brass: { wave: "sawtooth", gain: 0.14, decay: 0.2, sustain: 0.8, from: 0.35 }, + lead: { wave: "pulse", duty: 0.25, gain: 0.34, decay: 0.12, sustain: 0.8, vibrato: { rate: 5, depth: 0.012, delay: 0.2 }, from: 0.5 }, + }, + patterns: { + A: { + bass: "C2 - C2 - C3 - C2 - C2 - C2 - Bb1 - G1 - | Ab1 - Ab1 - Ab2 - Ab1 - Ab1 - Ab1 - G1 - F1 - | F1 - F1 - F2 - F1 - F1 - F1 - Ab1 - Bb1 - | G1 - G1 - G2 - G1 - G1 - G1 - B1 - D2 -", + drums: "k . . . . . . . s . . . . . . . | k . . . . . . . s . . . . . . . | k . . . . . . . s . . . . . . . | k . . . . . . . s . s . s s s s", + seq: "C5 G4 Eb5 G4 C5 G4 Eb5 G4 C5 G4 Eb5 G4 D5 G4 Eb5 G4 | C5 Ab4 Eb5 Ab4 C5 Ab4 Eb5 Ab4 C5 Ab4 Eb5 Ab4 F5 Ab4 Eb5 Ab4 | C5 F4 Ab4 F4 C5 F4 Ab4 F4 C5 F4 Ab4 F4 Bb4 F4 Ab4 F4 | B4 G4 D5 G4 B4 G4 D5 G4 B4 G4 D5 G4 F5 G4 D5 B4", + }, + B: { + bass: "C2 - C2 - C3 - C2 - C2 - C2 - Bb1 - G1 - | Ab1 - Ab1 - Ab2 - Ab1 - Ab1 - Ab1 - G1 - F1 - | F1 - F1 - F2 - F1 - F1 - F1 - Ab1 - Bb1 - | G1 - G1 - G2 - G1 - G1 - G1 - B1 - D2 -", + drums: "k . h . h . h . s . h . h . h k | k . h . h . h . s . h . h . h k | k . h . h . h . s . h . h . h k | k . h . h . h . s . s s s s s s", + seq: "C5 G4 Eb5 G4 C5 G4 Eb5 G4 C5 G4 Eb5 G4 D5 G4 Eb5 G4 | C5 Ab4 Eb5 Ab4 C5 Ab4 Eb5 Ab4 C5 Ab4 Eb5 Ab4 F5 Ab4 Eb5 Ab4 | C5 F4 Ab4 F4 C5 F4 Ab4 F4 C5 F4 Ab4 F4 Bb4 F4 Ab4 F4 | B4 G4 D5 G4 B4 G4 D5 G4 B4 G4 D5 G4 F5 G4 D5 B4", + brass: "C4^037 - - - - - - - - - - - C4^037 - - - | Ab3^047 - - - - - - - - - - - Ab3^047 - - - | F3^037 - - - - - - - - - - - F3^037 - - - | G3^047 - - - - - - - G3^047a - - - G3^047a - - -", + lead: "G5 - - - - - - - - - - - Ab5 - G5 - | Eb5 - - - - - - - - - - - F5 - Eb5 - | C5 - - - - - - - Eb5 - - - F5 - - - | D5 - - - - - - - B4 - - - - - - -", + }, + C: { + bass: "Ab1 Ab1 Ab2 Ab1 Ab1 Ab1 Ab2 Ab1 Ab1 Ab1 Ab2 Ab1 Ab1 Ab2 Ab1 Ab2 | Bb1 Bb1 Bb2 Bb1 Bb1 Bb1 Bb2 Bb1 Bb1 Bb1 Bb2 Bb1 Bb1 Bb2 Bb1 Bb2 | C2 C2 C3 C2 C2 C2 C3 C2 C2 C2 C3 C2 C2 C3 C2 C3 | G1 G1 G2 G1 G1 G1 G2 G1 G1 G1 G2 G1 B1 B1 D2 D2", + drums: "k . h k s . h . k . h k s . h k | k . h k s . h . k . h k s . h k | k . h k s . h . k . h k s . h k | k . h k s . h k s s s s ks s ks s", + seq: "Eb5 C5 Ab4 C5 Eb5 C5 Ab4 C5 Eb5 C5 Ab4 C5 Eb5 C5 Ab4 C5 | F5 D5 Bb4 D5 F5 D5 Bb4 D5 F5 D5 Bb4 D5 F5 D5 Bb4 D5 | G5 Eb5 C5 Eb5 G5 Eb5 C5 Eb5 G5 Eb5 C5 Eb5 G5 Eb5 C5 Eb5 | G5 D5 B4 D5 G5 D5 B4 D5 G5 D5 B4 D5 F5 D5 B4 G4", + brass: "Ab3^047 - - - - - - - - - - - - - - - | Bb3^047 - - - - - - - - - - - - - - - | C4^037 - - - - - - - - - - - - - - - | G3^047 - - - - - - - - - - - - - - -", + lead: "C6 - - - - - - - Eb6 - - - C6 - Ab5 - | D6 - - - - - - - F6 - - - D6 - Bb5 - | Eb6 - - - - - - - G6 - - - F6 - Eb6 - | D6 - - - - - - - B5 - - - G5 - - -", + }, + D: { + bass: "C2 - C2 - C3 - C2 - C2 - C2 - Bb1 - G1 - | Db2 - Db2 - Db3 - Db2 - Db2 - Db2 - C2 - Bb1 - | C2 - C2 - C3 - C2 - C2 - C2 - Bb1 - G1 - | G1 - G1 - G2 - G1 - G1 - G1 - B1 - D2 -", + drums: "k . h . h . h . s . h . h . h k | k . h . h . h . s . h . h . h k | k . h . h . h . s . h . h . h k | k . h . h . h . s . s s s s s s", + seq: "C5 G4 Eb5 G4 C5 G4 Eb5 G4 C5 G4 Eb5 G4 D5 G4 Eb5 G4 | Db5 Ab4 F5 Ab4 Db5 Ab4 F5 Ab4 Db5 Ab4 F5 Ab4 Eb5 Ab4 F5 Ab4 | C5 G4 Eb5 G4 C5 G4 Eb5 G4 C5 G4 Eb5 G4 D5 G4 Eb5 G4 | B4 G4 D5 G4 B4 G4 D5 G4 B4 G4 D5 G4 F5 G4 D5 B4", + brass: "C4^037 - - - - - - - - - - - - - - - | Db4^047 - - - - - - - - - - - - - - - | C4^037 - - - - - - - - - - - - - - - | G3^047 - - - - - - - - - - - - - - -", + lead: "C6 - - - - - - - - - - - - - - - | Db6 - - - - - - - - - - - C6 - - - | Eb6 - - - - - - - - - - - D6 - C6 - | B5 - - - - - - - D6 - - - G6 - - -", + }, + }, + order: ["A", "B", "C", "D", "C"], + }, + // Mainframe: A minor at 112: a sawtooth bass in threes against the beat, a sequence that ticks + // over a low A pedal and reaches up to G, dotted brass and a lead that leaps a fourth and + // settles; the chorus climbs F, G, A minor to a harmonic-minor E7, and the break slides onto a + // dark B-flat. + trailsMainframe: { + bpm: 112, + rush: 12, + voices: { + bass: { wave: "sawtooth", gain: 0.42, decay: 0.05, sustain: 0.3 }, + drums: { kit: true, gain: 0.8, from: 0.1 }, + seq: { wave: "pulse", duty: 0.125, gain: 0.2, decay: 0.03, sustain: 0.25, from: 0.2 }, + brass: { wave: "sawtooth", gain: 0.13, decay: 0.12, sustain: 0.75, from: 0.35 }, + lead: { wave: "pulse", duty: 0.25, gain: 0.34, decay: 0.12, sustain: 0.8, vibrato: { rate: 5.5, depth: 0.01, delay: 0.2 }, from: 0.5 }, + }, + patterns: { + A: { + bass: "A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A2 A1 A2 | A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A2 A1 A2 | F1 F1 F2 F1 F1 F2 F1 F1 F2 F1 F1 F2 F1 F2 F1 F2 | E1 E1 E2 E1 E1 E2 E1 E1 E2 E1 E1 E2 G#1 B1 D2 E2", + drums: "k . h . s . h . k . h . s . h . | k . h . s . h . k . h . s . h k | k . h . s . h . k . h . s . h . | k . h . s . h k k . s . s s s s", + seq: "C5 A4 E5 A4 C5 A4 E5 A4 C5 A4 E5 A4 F5 A4 E5 A4 | C5 A4 E5 A4 C5 A4 E5 A4 C5 A4 G5 A4 F5 A4 E5 A4 | C5 A4 F5 A4 C5 A4 F5 A4 C5 A4 F5 A4 G5 A4 F5 A4 | B4 G#4 E5 G#4 B4 G#4 E5 G#4 B4 G#4 E5 G#4 F5 E5 D5 B4", + }, + B: { + bass: "A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A2 A1 A2 | A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A2 A1 A2 | F1 F1 F2 F1 F1 F2 F1 F1 F2 F1 F1 F2 F1 F2 F1 F2 | E1 E1 E2 E1 E1 E2 E1 E1 E2 E1 E1 E2 G#1 B1 D2 E2", + drums: "kh h h h sh h h h kh h kh h sh h h h | kh h h h sh h h h kh h kh h sh h h h | kh h h h sh h h h kh h kh h sh h h h | kh h h h sh h h h s . s s s s s s", + seq: "C5 A4 E5 A4 C5 A4 E5 A4 C5 A4 E5 A4 F5 A4 E5 A4 | C5 A4 E5 A4 C5 A4 E5 A4 C5 A4 G5 A4 F5 A4 E5 A4 | C5 A4 F5 A4 C5 A4 F5 A4 C5 A4 F5 A4 G5 A4 F5 A4 | B4 G#4 E5 G#4 B4 G#4 E5 G#4 B4 G#4 E5 G#4 F5 E5 D5 B4", + brass: "A3^037 - - . . . A3^037 - - . . . A3^037 - - . | A3^037 - - . . . A3^037 - - . . . A3^037 - - . | F3^047 - - . . . F3^047 - - . . . F3^047 - - . | E3^047 - - . . . E3^047 - - . E3^047 - E3^047 - - .", + lead: "E5 - - - - - - - A5 - - - - - G5 - | E5 - - - - - - - C5 - - - D5 - E5 - | F5 - - - - - - - A5 - - - C6 - - - | B5 - - - - - - - G#5 - - - E5 - - -", + }, + C: { + bass: "F1 F1 F2 F1 F1 F2 F1 F1 F2 F1 F1 F2 F1 F2 F1 F2 | G1 G1 G2 G1 G1 G2 G1 G1 G2 G1 G1 G2 G1 G2 G1 G2 | A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A2 A1 A2 | E1 E1 E2 E1 E1 E2 E1 E1 E2 E1 E1 E2 G#1 B1 D2 E2", + drums: "k . h k s . h k k . h k s . h k | k . h k s . h k k . h k s . h k | k . h k s . h k k . h k s . h k | k . h k s . h k s s s s ks s ks s", + seq: "C5 A4 F5 A4 C5 A4 F5 A4 C5 A4 F5 A4 A5 A4 F5 A4 | D5 B4 G5 B4 D5 B4 G5 B4 D5 B4 G5 B4 B5 B4 G5 B4 | E5 C5 A5 C5 E5 C5 A5 C5 E5 C5 A5 C5 C6 C5 A5 C5 | E5 B4 G#5 B4 E5 B4 G#5 B4 E5 B4 G#5 B4 B5 G#5 E5 B4", + brass: "F3^047 - - - - - - - - - - - - - - - | G3^047 - - - - - - - - - - - - - - - | A3^037 - - - - - - - - - - - - - - - | E3^047 - - - - - - - E3^047a - - - - - - -", + lead: "A5 - - - - - - - C6 - - - F6 - - - | D6 - - - - - - - B5 - - - G5 - - - | C6 - - - - - - - E6 - - - D6 - C6 - | B5 - - - - - - - G#5 - - - E5 - - -", + }, + D: { + bass: "A1 - - - - - - - A2 - - - - - - - | Bb1 - - - - - - - Bb2 - - - - - - - | A1 - - - - - - - A2 - - - - - - - | E1 - - - E2 - - - E1 - E1 - E2 E2 E2 E2", + drums: "k . . . . . . . s . . . . . . . | k . . . . . . . s . . . . . . . | k . . . . . . . s . . . . . . . | k . . . . . . . s . s . s s s s", + seq: "C5 A4 E5 A4 C5 A4 E5 A4 C5 A4 E5 A4 F5 A4 E5 A4 | D5 Bb4 F5 Bb4 D5 Bb4 F5 Bb4 D5 Bb4 F5 Bb4 G5 Bb4 F5 Bb4 | C5 A4 E5 A4 C5 A4 E5 A4 C5 A4 E5 A4 F5 A4 E5 A4 | B4 G#4 E5 G#4 B4 G#4 E5 G#4 B4 G#4 E5 G#4 F5 E5 D5 B4", + brass: "A3^037 - - - - - - - - - - - - - - - | Bb3^047 - - - - - - - - - - - - - - - | A3^037 - - - - - - - - - - - - - - - | E3^047 - - - - - - - - - - - - - - -", + lead: "A5 - - - - - - - - - - - - - - - | Bb5 - - - - - - - - - - - A5 - - - | C6 - - - - - - - - - - - B5 - A5 - | G#5 - - - - - - - B5 - - - E6 - - -", + }, + }, + order: ["A", "B", "C", "B", "D", "C"], + }, + // Black ICE: Cold F minor at 108: an eighth-note ostinato that dips to the seventh and fifth in + // every bar, half-time snares, swelling brass and a lead that falls in slow steps; the chorus + // switches to the three-against-four bass over D-flat and E-flat, and the last section slips onto + // a Neapolitan G-flat. + trailsBlackIce: { + bpm: 108, + rush: 16, + voices: { + bass: { wave: "sawtooth", gain: 0.44, decay: 0.06, sustain: 0.4 }, + drums: { kit: true, gain: 0.82, from: 0.1 }, + seq: { wave: "pulse", duty: 0.125, gain: 0.18, decay: 0.03, sustain: 0.25, from: 0.2 }, + brass: { wave: "sawtooth", gain: 0.14, decay: 0.2, sustain: 0.8, from: 0.35 }, + lead: { wave: "pulse", duty: 0.25, gain: 0.34, decay: 0.12, sustain: 0.8, vibrato: { rate: 5, depth: 0.012, delay: 0.2 }, from: 0.5 }, + }, + patterns: { + A: { + bass: "F1 - F1 - F2 - F1 - Eb2 - F1 - C2 - F1 - | Db2 - Db2 - Db3 - Db2 - C3 - Db2 - Ab1 - Db2 - | Bb1 - Bb1 - Bb2 - Bb1 - Ab2 - Bb1 - F1 - Bb1 - | C2 - C2 - C3 - C2 - Bb2 - C2 - E2 - G2 -", + drums: "k . . . . . h . s . . . . . h . | k . . . . . h . s . . . . . h k | k . . . . . h . s . . . . . h . | k . . . . . h . s . s . s s s s", + seq: "Ab4 F4 C5 F4 Ab4 F4 C5 F4 Ab4 F4 C5 F4 Db5 F4 C5 F4 | Ab4 F4 Db5 F4 Ab4 F4 Db5 F4 Ab4 F4 Db5 F4 Eb5 F4 Db5 F4 | Bb4 F4 Db5 F4 Bb4 F4 Db5 F4 Bb4 F4 Db5 F4 Eb5 F4 Db5 F4 | Bb4 E4 C5 E4 G4 E4 C5 E4 Bb4 E4 C5 E4 Db5 C5 Bb4 G4", + }, + B: { + bass: "F1 - F1 - F2 - F1 - Eb2 - F1 - C2 - F1 - | Db2 - Db2 - Db3 - Db2 - C3 - Db2 - Ab1 - Db2 - | Bb1 - Bb1 - Bb2 - Bb1 - Ab2 - Bb1 - F1 - Bb1 - | C2 - C2 - C3 - C2 - Bb2 - C2 - E2 - G2 -", + drums: "k . h . h . h . s . h . h . h k | k . h . h . h . s . h . h . h k | k . h . h . h . s . h . h . h k | k . h . h . h . s . s s s s s s", + seq: "Ab4 F4 C5 F4 Ab4 F4 C5 F4 Ab4 F4 C5 F4 Db5 F4 C5 F4 | Ab4 F4 Db5 F4 Ab4 F4 Db5 F4 Ab4 F4 Db5 F4 Eb5 F4 Db5 F4 | Bb4 F4 Db5 F4 Bb4 F4 Db5 F4 Bb4 F4 Db5 F4 Eb5 F4 Db5 F4 | Bb4 E4 C5 E4 G4 E4 C5 E4 Bb4 E4 C5 E4 Db5 C5 Bb4 G4", + brass: "F3^037 - - - - - - - - - - - F3^037 - - - | Db4^047 - - - - - - - - - - - Db4^047 - - - | Bb3^037 - - - - - - - - - - - Bb3^037 - - - | C4^047 - - - - - - - C4^047a - - - C4^047a - - -", + lead: "C6 - - - - - - - Ab5 - - - G5 - F5 - | F5 - - - - - - - - - - - Eb5 - Db5 - | Db5 - - - - - - - F5 - - - Bb5 - - - | G5 - - - - - - - E5 - - - C5 - - -", + }, + C: { + bass: "Db2 Db2 Db3 Db2 Db2 Db3 Db2 Db2 Db3 Db2 Db2 Db3 Db2 Db3 Db2 Db3 | Eb2 Eb2 Eb3 Eb2 Eb2 Eb3 Eb2 Eb2 Eb3 Eb2 Eb2 Eb3 Eb2 Eb3 Eb2 Eb3 | F1 F1 F2 F1 F1 F2 F1 F1 F2 F1 F1 F2 F1 F2 F1 F2 | C2 C2 C3 C2 C2 C3 C2 C2 C3 C2 C2 C3 E2 G2 Bb2 C3", + drums: "k . h k s . h . k . h k s . h k | k . h k s . h . k . h k s . h k | k . h k s . h . k . h k s . h k | k . h k s . h k s s s s ks s ks s", + seq: "F5 Db5 Ab5 Db5 F5 Db5 Ab5 Db5 F5 Db5 Ab5 Db5 Bb5 Db5 Ab5 Db5 | G5 Eb5 Bb5 Eb5 G5 Eb5 Bb5 Eb5 G5 Eb5 Bb5 Eb5 C6 Eb5 Bb5 Eb5 | Ab5 F5 C6 F5 Ab5 F5 C6 F5 Ab5 F5 C6 F5 Db6 F5 C6 F5 | G5 E5 C6 E5 G5 E5 C6 E5 G5 E5 Bb5 E5 C6 Bb5 G5 E5", + brass: "Db4^047 - - - - - - - - - - - - - - - | Eb4^047 - - - - - - - - - - - - - - - | F3^037 - - - - - - - - - - - - - - - | C4^047 - - - - - - - - - - - - - - -", + lead: "Ab5 - - - - - - - F5 - - - Db6 - - - | Bb5 - - - - - - - G5 - - - Eb6 - - - | C6 - - - - - - - Ab5 - - - F6 - Eb6 - | E6 - - - - - - - C6 - - - G5 - - -", + }, + D: { + bass: "F1 - F1 - F2 - F1 - Eb2 - F1 - C2 - F1 - | Gb1 - Gb1 - Gb2 - Gb1 - F2 - Gb1 - Db2 - Gb1 - | F1 - F1 - F2 - F1 - Eb2 - F1 - C2 - F1 - | C2 - C2 - C3 - C2 - Bb2 - C2 - E2 - G2 -", + drums: "k . h . h . h . s . h . h . h k | k . h . h . h . s . h . h . h k | k . h . h . h . s . h . h . h k | k . h . h . h . s . s s s s s s", + seq: "Ab4 F4 C5 F4 Ab4 F4 C5 F4 Ab4 F4 C5 F4 Db5 F4 C5 F4 | Bb4 Gb4 Db5 Gb4 Bb4 Gb4 Db5 Gb4 Bb4 Gb4 Db5 Gb4 Eb5 Gb4 Db5 Gb4 | Ab4 F4 C5 F4 Ab4 F4 C5 F4 Ab4 F4 C5 F4 Db5 F4 C5 F4 | Bb4 E4 C5 E4 G4 E4 C5 E4 Bb4 E4 C5 E4 Db5 C5 Bb4 G4", + brass: "F3^037 - - - - - - - - - - - - - - - | Gb3^047 - - - - - - - - - - - - - - - | F3^037 - - - - - - - - - - - - - - - | C4^047 - - - - - - - - - - - - - - -", + lead: "F5 - - - - - - - - - - - - - - - | Gb5 - - - - - - - - - - - F5 - - - | Ab5 - - - - - - - - - - - G5 - F5 - | E5 - - - - - - - G5 - - - C6 - - -", + }, + }, + order: ["A", "B", "C", "D", "C"], + }, + // Sentinel: E minor at 100, slow and enormous: a deep three-against-four bass under half-time + // drums, a sequence ringing over a high E pedal, and a lead that rises B, E, G like a call; the + // chorus leaps a sixth over C and D, and the bridge leans on a Phrygian F before the last chorus. + trailsSentinel: { + bpm: 100, + rush: 16, + voices: { + bass: { wave: "sawtooth", gain: 0.44, decay: 0.05, sustain: 0.32 }, + drums: { kit: true, gain: 0.82, from: 0.1 }, + seq: { wave: "pulse", duty: 0.125, gain: 0.18, decay: 0.03, sustain: 0.25, from: 0.2 }, + brass: { wave: "sawtooth", gain: 0.14, decay: 0.2, sustain: 0.8, from: 0.35 }, + lead: { wave: "pulse", duty: 0.25, gain: 0.34, decay: 0.12, sustain: 0.8, vibrato: { rate: 5, depth: 0.012, delay: 0.2 }, from: 0.5 }, + }, + patterns: { + A: { + bass: "E1 E1 E2 E1 E1 E2 E1 E1 E2 E1 E1 E2 E1 E2 E1 E2 | C2 C2 C3 C2 C2 C3 C2 C2 C3 C2 C2 C3 C2 C3 C2 C3 | A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A2 A1 A2 | B1 B1 B2 B1 B1 B2 B1 B1 B2 B1 B1 B2 D#2 F#2 A2 B2", + drums: "k . . . . . . k s . . . . . . . | k . . . . . . k s . . . . . . . | k . . . . . . k s . . . . . . . | k . . . . . . k s . s . s s s s", + seq: "G5 E5 B5 E5 G5 E5 B5 E5 G5 E5 B5 E5 A5 E5 B5 E5 | G5 E5 C6 E5 G5 E5 C6 E5 G5 E5 C6 E5 D6 E5 C6 E5 | A5 E5 C6 E5 A5 E5 C6 E5 A5 E5 C6 E5 B5 E5 C6 E5 | F#5 D#5 B5 D#5 F#5 D#5 B5 D#5 F#5 D#5 A5 D#5 B5 A5 F#5 D#5", + }, + B: { + bass: "E1 E1 E2 E1 E1 E2 E1 E1 E2 E1 E1 E2 E1 E2 E1 E2 | C2 C2 C3 C2 C2 C3 C2 C2 C3 C2 C2 C3 C2 C3 C2 C3 | A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A2 A1 A2 | B1 B1 B2 B1 B1 B2 B1 B1 B2 B1 B1 B2 D#2 F#2 A2 B2", + drums: "k . h . h . h k s . h . h . h . | k . h . h . h k s . h . h . h . | k . h . h . h k s . h . h . h . | k . h . h . h k s . s s s s s s", + seq: "G5 E5 B5 E5 G5 E5 B5 E5 G5 E5 B5 E5 A5 E5 B5 E5 | G5 E5 C6 E5 G5 E5 C6 E5 G5 E5 C6 E5 D6 E5 C6 E5 | A5 E5 C6 E5 A5 E5 C6 E5 A5 E5 C6 E5 B5 E5 C6 E5 | F#5 D#5 B5 D#5 F#5 D#5 B5 D#5 F#5 D#5 A5 D#5 B5 A5 F#5 D#5", + brass: "E4^037 - - - - - - - - - - - E4^037 - - - | C4^047 - - - - - - - - - - - C4^047 - - - | A3^037 - - - - - - - - - - - A3^037 - - - | B3^047 - - - - - - - B3^047a - - - B3^047a - - -", + lead: "B4 - - - E5 - - - G5 - - - - - F#5 - | E5 - - - - - - - - - - - D5 - C5 - | A4 - - - C5 - - - E5 - - - A5 - - - | F#5 - - - - - - - D#5 - - - B4 - - -", + }, + C: { + bass: "C2 C2 C3 C2 C2 C3 C2 C2 C3 C2 C2 C3 C2 C3 C2 C3 | D2 D2 D3 D2 D2 D3 D2 D2 D3 D2 D2 D3 D2 D3 D2 D3 | E1 E1 E2 E1 E1 E2 E1 E1 E2 E1 E1 E2 E1 E2 E1 E2 | E1 E1 E2 E1 E1 E2 E1 E1 B1 B1 B2 B1 D#2 F#2 A2 B2", + drums: "k . h k s . h . k . h k s . h k | k . h k s . h . k . h k s . h k | k . h k s . h . k . h k s . h k | k . h k s . h k s s s s ks s ks s", + seq: "E5 C5 G5 C5 E5 C5 G5 C5 E5 C5 G5 C5 A5 C5 G5 C5 | F#5 D5 A5 D5 F#5 D5 A5 D5 F#5 D5 A5 D5 B5 D5 A5 D5 | G5 E5 B5 E5 G5 E5 B5 E5 G5 E5 B5 E5 C6 E5 B5 E5 | G5 E5 B5 E5 G5 E5 B5 E5 F#5 D#5 B5 D#5 A5 F#5 D#5 B4", + brass: "C4^047 - - - - - - - - - - - - - - - | D4^047 - - - - - - - - - - - - - - - | E4^037 - - - - - - - - - - - - - - - | E4^037 - - - - - - - B3^047 - - - - - - -", + lead: "G5 - - - - - - - E6 - - - - - D6 - | A5 - - - - - - - F#6 - - - - - E6 - | E6 - - - - - - - B5 - - - G5 - - - | F#5 - - - - - - - D#6 - - - B5 - - -", + }, + D: { + bass: "E1 - - - - - - - E2 - - - - - - - | F1 - - - - - - - F2 - - - - - - - | E1 - - - - - - - E2 - - - - - - - | B1 - - - B2 - - - B1 - B1 - B2 B2 B2 B2", + drums: "k . . . . . . k s . . . . . . . | k . . . . . . k s . . . . . . . | k . . . . . . k s . . . . . . . | k . . . . . . k s . s . s s s s", + seq: "G5 E5 B5 E5 G5 E5 B5 E5 G5 E5 B5 E5 A5 E5 B5 E5 | A5 F5 C6 F5 A5 F5 C6 F5 A5 F5 C6 F5 D6 F5 C6 F5 | G5 E5 B5 E5 G5 E5 B5 E5 G5 E5 B5 E5 A5 E5 B5 E5 | F#5 D#5 B5 D#5 F#5 D#5 B5 D#5 F#5 D#5 A5 D#5 B5 A5 F#5 D#5", + brass: "E4^037 - - - - - - - - - - - - - - - | F4^047 - - - - - - - - - - - - - - - | E4^037 - - - - - - - - - - - - - - - | B3^047 - - - - - - - - - - - - - - -", + lead: "B5 - - - - - - - - - - - - - - - | C6 - - - - - - - - - - - B5 - - - | B5 - - - - - - - G5 - - - E5 - - - | D#5 - - - - - - - F#5 - - - B5 - - -", + }, + }, + order: ["A", "B", "C", "D", "C"], + }, + // Throne of the grid: G minor at 116, stately and grim: a three-against-four bass, a marching + // brass figure that hits twice and pauses, and a lead that climbs G, B-flat, then falls; the + // chorus moves to C minor and E-flat and hangs on D7, and a half-time bridge rises a step a bar + // from A-flat to D. + trailsThrone: { + bpm: 116, + rush: 12, + voices: { + bass: { wave: "sawtooth", gain: 0.42, decay: 0.05, sustain: 0.3 }, + drums: { kit: true, gain: 0.8, from: 0.1 }, + seq: { wave: "pulse", duty: 0.125, gain: 0.2, decay: 0.03, sustain: 0.25, from: 0.2 }, + brass: { wave: "sawtooth", gain: 0.13, decay: 0.1, sustain: 0.7, from: 0.35 }, + lead: { wave: "pulse", duty: 0.25, gain: 0.34, decay: 0.12, sustain: 0.8, vibrato: { rate: 5.5, depth: 0.01, delay: 0.2 }, from: 0.5 }, + }, + patterns: { + A: { + bass: "G1 G1 G2 G1 G1 G2 G1 G1 G2 G1 G1 G2 G1 G2 G1 G2 | Eb2 Eb2 Eb3 Eb2 Eb2 Eb3 Eb2 Eb2 Eb3 Eb2 Eb2 Eb3 Eb2 Eb3 Eb2 Eb3 | C2 C2 C3 C2 C2 C3 C2 C2 C3 C2 C2 C3 C2 C3 C2 C3 | D2 D2 D3 D2 D2 D3 D2 D2 D3 D2 D2 D3 F#2 A2 C3 D3", + drums: "k . h . s . h . k . h . s . h . | k . h . s . h . k . h . s . h k | k . h . s . h . k . h . s . h . | k . h . s . h k k . s . s s s s", + seq: "Bb4 G4 D5 G4 Bb4 G4 D5 G4 Bb4 G4 D5 G4 C5 G4 D5 G4 | Bb4 G4 Eb5 G4 Bb4 G4 Eb5 G4 Bb4 G4 Eb5 G4 F5 G4 Eb5 G4 | C5 G4 Eb5 G4 C5 G4 Eb5 G4 C5 G4 Eb5 G4 F5 G4 Eb5 G4 | A4 F#4 D5 F#4 A4 F#4 D5 F#4 A4 F#4 C5 F#4 D5 C5 A4 F#4", + }, + B: { + bass: "G1 G1 G2 G1 G1 G2 G1 G1 G2 G1 G1 G2 G1 G2 G1 G2 | Eb2 Eb2 Eb3 Eb2 Eb2 Eb3 Eb2 Eb2 Eb3 Eb2 Eb2 Eb3 Eb2 Eb3 Eb2 Eb3 | C2 C2 C3 C2 C2 C3 C2 C2 C3 C2 C2 C3 C2 C3 C2 C3 | D2 D2 D3 D2 D2 D3 D2 D2 D3 D2 D2 D3 F#2 A2 C3 D3", + drums: "kh h h h sh h h h kh h kh h sh h h h | kh h h h sh h h h kh h kh h sh h h h | kh h h h sh h h h kh h kh h sh h h h | kh h h h sh h h h s . s s s s s s", + seq: "Bb4 G4 D5 G4 Bb4 G4 D5 G4 Bb4 G4 D5 G4 C5 G4 D5 G4 | Bb4 G4 Eb5 G4 Bb4 G4 Eb5 G4 Bb4 G4 Eb5 G4 F5 G4 Eb5 G4 | C5 G4 Eb5 G4 C5 G4 Eb5 G4 C5 G4 Eb5 G4 F5 G4 Eb5 G4 | A4 F#4 D5 F#4 A4 F#4 D5 F#4 A4 F#4 C5 F#4 D5 C5 A4 F#4", + brass: "G3^037 - . G3^037 G3^037 - . . G3^037 - . G3^037 G3^037 - . . | Eb3^047 - . Eb3^047 Eb3^047 - . . Eb3^047 - . Eb3^047 Eb3^047 - . . | C4^037 - . C4^037 C4^037 - . . C4^037 - . C4^037 C4^037 - . . | D4^047 - . D4^047 D4^047 - . . D4^047 - . D4^047 D4^047 - . .", + lead: "D5 - - - G5 - - - Bb5 - - - - - A5 - | G5 - - - - - - - Eb5 - - - F5 - G5 - | Eb5 - - - - - - - G5 - - - C6 - - - | A5 - - - - - - - F#5 - - - D5 - - -", + }, + C: { + bass: "C2 C2 C3 C2 C2 C3 C2 C2 C3 C2 C2 C3 C2 C3 C2 C3 | Eb2 Eb2 Eb3 Eb2 Eb2 Eb3 Eb2 Eb2 Eb3 Eb2 Eb2 Eb3 Eb2 Eb3 Eb2 Eb3 | D2 D2 D3 D2 D2 D3 D2 D2 D3 D2 D2 D3 D2 D3 D2 D3 | D2 D2 D3 D2 D2 D3 D2 D2 D3 D2 D2 D3 F#2 A2 C3 D3", + drums: "k . h k s . h k k . h k s . h k | k . h k s . h k k . h k s . h k | k . h k s . h k k . h k s . h k | k . h k s . h k s s s s ks s ks s", + seq: "Eb5 C5 G5 C5 Eb5 C5 G5 C5 Eb5 C5 G5 C5 Ab5 C5 G5 C5 | G5 Eb5 Bb5 Eb5 G5 Eb5 Bb5 Eb5 G5 Eb5 Bb5 Eb5 C6 Eb5 Bb5 Eb5 | F#5 D5 A5 D5 F#5 D5 A5 D5 F#5 D5 A5 D5 Bb5 D5 A5 D5 | F#5 D5 A5 D5 F#5 D5 C6 D5 F#5 D5 A5 D5 C6 A5 F#5 D5", + brass: "C4^037 - - - - - - - - - - - - - - - | Eb4^047 - - - - - - - - - - - - - - - | D4^047 - - - - - - - - - - - - - - - | D4^047a - - - - - - - - - - - - - - -", + lead: "G5 - - - - - - - C6 - - - Eb6 - - - | Bb5 - - - - - - - Eb6 - - - D6 - C6 - | A5 - - - - - - - D6 - - - F#6 - - - | D6 - - - - - - - - - - - . . . .", + }, + D: { + bass: "Ab1 - - - - - - - Ab2 - - - - - - - | Bb1 - - - - - - - Bb2 - - - - - - - | C2 - - - - - - - C3 - - - - - - - | D2 - - - D3 - - - D2 - D2 - D3 D3 D3 D3", + drums: "k . . . . . . . s . . . . . . . | k . . . . . . . s . . . . . . . | k . . . . . . . s . . . . . . . | k . . . s . . . s . s . s s s s", + seq: "C5 Ab4 Eb5 Ab4 C5 Ab4 Eb5 Ab4 C5 Ab4 Eb5 Ab4 F5 Ab4 Eb5 Ab4 | D5 Bb4 F5 Bb4 D5 Bb4 F5 Bb4 D5 Bb4 F5 Bb4 G5 Bb4 F5 Bb4 | Eb5 C5 G5 C5 Eb5 C5 G5 C5 Eb5 C5 G5 C5 Ab5 C5 G5 C5 | F#5 D5 A5 D5 F#5 D5 A5 D5 F#5 D5 A5 D5 C6 A5 F#5 D5", + brass: "Ab3^047 - - - - - - - - - - - - - - - | Bb3^047 - - - - - - - - - - - - - - - | C4^037 - - - - - - - - - - - - - - - | D4^047 - - - - - - - - - - - - - - -", + lead: "Eb5 - - - - - - - C5 - - - Ab5 - - - | F5 - - - - - - - D5 - - - Bb5 - - - | G5 - - - - - - - Eb5 - - - C6 - - - | A5 - - - - - - - D6 - - - F#6 - - -", + }, + }, + order: ["A", "B", "C", "B", "D", "C"], + }, + // Siege: B minor at 104: a heavy eighth-note ostinato with a sixteenth pickup in the middle of + // each bar, double-hit snares and slow brass swells, and a lead that drops a fourth and climbs + // back; the chorus lifts through G, A and B minor to a high F#, and the last section turns on a + // Neapolitan C major. + trailsSiege: { + bpm: 104, + rush: 16, + voices: { + bass: { wave: "sawtooth", gain: 0.44, decay: 0.06, sustain: 0.4 }, + drums: { kit: true, gain: 0.82, from: 0.1 }, + seq: { wave: "pulse", duty: 0.125, gain: 0.18, decay: 0.03, sustain: 0.25, from: 0.2 }, + brass: { wave: "sawtooth", gain: 0.14, decay: 0.2, sustain: 0.8, from: 0.35 }, + lead: { wave: "pulse", duty: 0.25, gain: 0.34, decay: 0.12, sustain: 0.8, vibrato: { rate: 5, depth: 0.012, delay: 0.2 }, from: 0.5 }, + }, + patterns: { + A: { + bass: "B1 - B1 - B2 - B1 B1 B1 - B1 - A1 - F#1 - | G1 - G1 - G2 - G1 G1 G1 - G1 - F#1 - E1 - | E1 - E1 - E2 - E1 E1 E1 - E1 - G1 - A1 - | F#1 - F#1 - F#2 - F#1 F#1 F#1 - F#1 - A#1 - C#2 -", + drums: "k . . . . . . . s . . s . . . . | k . . . . . . . s . . s . . . . | k . . . . . . . s . . s . . . . | k . . . . . . . s . s . s s s s", + seq: "D5 B4 F#5 B4 D5 B4 F#5 B4 D5 B4 F#5 B4 G5 B4 F#5 B4 | D5 B4 G5 B4 D5 B4 G5 B4 D5 B4 G5 B4 A5 B4 G5 B4 | E5 B4 G5 B4 E5 B4 G5 B4 E5 B4 G5 B4 A5 B4 G5 B4 | C#5 A#4 F#5 A#4 C#5 A#4 F#5 A#4 C#5 A#4 E5 A#4 F#5 E5 C#5 A#4", + }, + B: { + bass: "B1 - B1 - B2 - B1 B1 B1 - B1 - A1 - F#1 - | G1 - G1 - G2 - G1 G1 G1 - G1 - F#1 - E1 - | E1 - E1 - E2 - E1 E1 E1 - E1 - G1 - A1 - | F#1 - F#1 - F#2 - F#1 F#1 F#1 - F#1 - A#1 - C#2 -", + drums: "k . h . h . h . s . h s h . h k | k . h . h . h . s . h s h . h k | k . h . h . h . s . h s h . h k | k . h . h . h . s . s s s s s s", + seq: "D5 B4 F#5 B4 D5 B4 F#5 B4 D5 B4 F#5 B4 G5 B4 F#5 B4 | D5 B4 G5 B4 D5 B4 G5 B4 D5 B4 G5 B4 A5 B4 G5 B4 | E5 B4 G5 B4 E5 B4 G5 B4 E5 B4 G5 B4 A5 B4 G5 B4 | C#5 A#4 F#5 A#4 C#5 A#4 F#5 A#4 C#5 A#4 E5 A#4 F#5 E5 C#5 A#4", + brass: "B3^037 - - - - - - - - - - - B3^037 - - - | G3^047 - - - - - - - - - - - G3^047 - - - | E3^037 - - - - - - - - - - - E3^037 - - - | F#3^047 - - - - - - - F#3^047a - - - F#3^047a - - -", + lead: "B5 - - - - - - - F#5 - - - - - - - | G5 - - - - - - - D5 - - - E5 - F#5 - | G5 - - - - - - - B5 - - - E6 - - - | C#6 - - - - - - - A#5 - - - F#5 - - -", + }, + C: { + bass: "G1 G1 G2 G1 G1 G2 G1 G1 G2 G1 G1 G2 G1 G2 G1 G2 | A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A2 A1 A2 | B1 B1 B2 B1 B1 B2 B1 B1 B2 B1 B1 B2 B1 B2 B1 B2 | F#1 F#1 F#2 F#1 F#1 F#2 F#1 F#1 F#2 F#1 F#1 F#2 A#1 C#2 E2 F#2", + drums: "k . h k s . h . k . h k s . h k | k . h k s . h . k . h k s . h k | k . h k s . h . k . h k s . h k | k . h k s . h k s s s s ks s ks s", + seq: "D5 B4 G5 B4 D5 B4 G5 B4 D5 B4 G5 B4 A5 B4 G5 B4 | E5 C#5 A5 C#5 E5 C#5 A5 C#5 E5 C#5 A5 C#5 B5 C#5 A5 C#5 | F#5 D5 B5 D5 F#5 D5 B5 D5 F#5 D5 B5 D5 C#6 D5 B5 D5 | F#5 C#5 A#5 C#5 F#5 C#5 A#5 C#5 F#5 C#5 A#5 C#5 E6 C#6 A#5 F#5", + brass: "G3^047 - - - - - - - - - - - - - - - | A3^047 - - - - - - - - - - - - - - - | B3^037 - - - - - - - - - - - - - - - | F#3^047 - - - - - - - - - - - - - - -", + lead: "D6 - - - - - - - B5 - - - G5 - - - | E6 - - - - - - - C#6 - - - A5 - - - | F#6 - - - - - - - D6 - - - B5 - - - | A#5 - - - - - - - C#6 - - - F#6 - - -", + }, + D: { + bass: "B1 - B1 - B2 - B1 B1 B1 - B1 - A1 - F#1 - | C2 - C2 - C3 - C2 C2 C2 - C2 - B1 - A1 - | B1 - B1 - B2 - B1 B1 B1 - B1 - A1 - F#1 - | F#1 - F#1 - F#2 - F#1 F#1 F#1 - F#1 - A#1 - C#2 -", + drums: "k . h . h . h . s . h s h . h k | k . h . h . h . s . h s h . h k | k . h . h . h . s . h s h . h k | k . h . h . h . s . s s s s s s", + seq: "D5 B4 F#5 B4 D5 B4 F#5 B4 D5 B4 F#5 B4 G5 B4 F#5 B4 | E5 C5 G5 C5 E5 C5 G5 C5 E5 C5 G5 C5 A5 C5 G5 C5 | D5 B4 F#5 B4 D5 B4 F#5 B4 D5 B4 F#5 B4 G5 B4 F#5 B4 | C#5 A#4 F#5 A#4 C#5 A#4 F#5 A#4 C#5 A#4 E5 A#4 F#5 E5 C#5 A#4", + brass: "B3^037 - - - - - - - - - - - - - - - | C4^047 - - - - - - - - - - - - - - - | B3^037 - - - - - - - - - - - - - - - | F#3^047 - - - - - - - - - - - - - - -", + lead: "B5 - - - - - - - - - - - - - - - | C6 - - - - - - - - - - - B5 - - - | D6 - - - - - - - - - - - C#6 - B5 - | A#5 - - - - - - - C#6 - - - F#6 - - -", + }, + }, + order: ["A", "B", "C", "D", "C"], + }, + // Iron gate: E minor at 104 behind a slow-opening gate: an eighth-note ostinato that dips to the + // seventh and the fifth, half-time snares, a low sequence and swelling brass under a lead that + // steps down from B; the chorus switches to the three-against-four bass over C, D and E minor, + // and the last section leans on a Phrygian F. + trailsIronGate: { + bpm: 104, + rush: 16, + voices: { + bass: { wave: "sawtooth", gain: 0.44, decay: 0.06, sustain: 0.4 }, + drums: { kit: true, gain: 0.82, from: 0.1 }, + seq: { wave: "pulse", duty: 0.125, gain: 0.18, decay: 0.03, sustain: 0.25, from: 0.2 }, + brass: { wave: "sawtooth", gain: 0.14, decay: 0.2, sustain: 0.8, from: 0.35 }, + lead: { wave: "pulse", duty: 0.25, gain: 0.34, decay: 0.12, sustain: 0.8, vibrato: { rate: 5, depth: 0.012, delay: 0.2 }, from: 0.5 }, + }, + patterns: { + A: { + bass: "E1 - E1 - E2 - E1 - D2 - E1 - B1 - E1 - | C2 - C2 - C3 - C2 - B2 - C2 - G1 - C2 - | A1 - A1 - A2 - A1 - G2 - A1 - E1 - A1 - | B1 - B1 - B2 - B1 - A2 - B1 - D#2 - F#2 -", + drums: "k . . . . . h . s . . . . . h . | k . . . . . h . s . . . . . h k | k . . . . . h . s . . . . . h . | k . . . . . h . s . s . s s s s", + seq: "G4 E4 B4 E4 G4 E4 B4 E4 G4 E4 B4 E4 C5 E4 B4 E4 | G4 E4 C5 E4 G4 E4 C5 E4 G4 E4 C5 E4 D5 E4 C5 E4 | A4 E4 C5 E4 A4 E4 C5 E4 A4 E4 C5 E4 D5 E4 C5 E4 | F#4 D#4 B4 D#4 F#4 D#4 B4 D#4 F#4 D#4 A4 D#4 B4 A4 F#4 D#4", + }, + B: { + bass: "E1 - E1 - E2 - E1 - D2 - E1 - B1 - E1 - | C2 - C2 - C3 - C2 - B2 - C2 - G1 - C2 - | A1 - A1 - A2 - A1 - G2 - A1 - E1 - A1 - | B1 - B1 - B2 - B1 - A2 - B1 - D#2 - F#2 -", + drums: "k . h . h . h . s . h . h . h k | k . h . h . h . s . h . h . h k | k . h . h . h . s . h . h . h k | k . h . h . h . s . s s s s s s", + seq: "G4 E4 B4 E4 G4 E4 B4 E4 G4 E4 B4 E4 C5 E4 B4 E4 | G4 E4 C5 E4 G4 E4 C5 E4 G4 E4 C5 E4 D5 E4 C5 E4 | A4 E4 C5 E4 A4 E4 C5 E4 A4 E4 C5 E4 D5 E4 C5 E4 | F#4 D#4 B4 D#4 F#4 D#4 B4 D#4 F#4 D#4 A4 D#4 B4 A4 F#4 D#4", + brass: "E4^037 - - - - - - - - - - - E4^037 - - - | C4^047 - - - - - - - - - - - C4^047 - - - | A3^037 - - - - - - - - - - - A3^037 - - - | B3^047 - - - - - - - B3^047a - - - B3^047a - - -", + lead: "B5 - - - - - - - G5 - - - F#5 - E5 - | E5 - - - - - - - - - - - D5 - C5 - | C5 - - - - - - - E5 - - - A5 - - - | F#5 - - - - - - - D#5 - - - B4 - - -", + }, + C: { + bass: "C2 C2 C3 C2 C2 C3 C2 C2 C3 C2 C2 C3 C2 C3 C2 C3 | D2 D2 D3 D2 D2 D3 D2 D2 D3 D2 D2 D3 D2 D3 D2 D3 | E1 E1 E2 E1 E1 E2 E1 E1 E2 E1 E1 E2 E1 E2 E1 E2 | B1 B1 B2 B1 B1 B2 B1 B1 B2 B1 B1 B2 D#2 F#2 A2 B2", + drums: "k . h k s . h . k . h k s . h k | k . h k s . h . k . h k s . h k | k . h k s . h . k . h k s . h k | k . h k s . h k s s s s ks s ks s", + seq: "E5 C5 G5 C5 E5 C5 G5 C5 E5 C5 G5 C5 A5 C5 G5 C5 | F#5 D5 A5 D5 F#5 D5 A5 D5 F#5 D5 A5 D5 B5 D5 A5 D5 | G5 E5 B5 E5 G5 E5 B5 E5 G5 E5 B5 E5 C6 E5 B5 E5 | F#5 D#5 B5 D#5 F#5 D#5 B5 D#5 F#5 D#5 A5 D#5 B5 A5 F#5 D#5", + brass: "C4^047 - - - - - - - - - - - - - - - | D4^047 - - - - - - - - - - - - - - - | E4^037 - - - - - - - - - - - - - - - | B3^047 - - - - - - - - - - - - - - -", + lead: "E6 - - - - - - - C6 - - - G5 - - - | F#6 - - - - - - - D6 - - - A5 - - - | E6 - - - - - - - B5 - - - G5 - B5 - | D#6 - - - - - - - F#6 - - - - - - -", + }, + D: { + bass: "E1 - E1 - E2 - E1 - D2 - E1 - B1 - E1 - | F1 - F1 - F2 - F1 - Eb2 - F1 - C2 - F1 - | E1 - E1 - E2 - E1 - D2 - E1 - B1 - E1 - | B1 - B1 - B2 - B1 - A2 - B1 - D#2 - F#2 -", + drums: "k . h . h . h . s . h . h . h k | k . h . h . h . s . h . h . h k | k . h . h . h . s . h . h . h k | k . h . h . h . s . s s s s s s", + seq: "G4 E4 B4 E4 G4 E4 B4 E4 G4 E4 B4 E4 C5 E4 B4 E4 | A4 F4 C5 F4 A4 F4 C5 F4 A4 F4 C5 F4 D5 F4 C5 F4 | G4 E4 B4 E4 G4 E4 B4 E4 G4 E4 B4 E4 C5 E4 B4 E4 | F#4 D#4 B4 D#4 F#4 D#4 B4 D#4 F#4 D#4 A4 D#4 B4 A4 F#4 D#4", + brass: "E4^037 - - - - - - - - - - - - - - - | F4^047 - - - - - - - - - - - - - - - | E4^037 - - - - - - - - - - - - - - - | B3^047 - - - - - - - - - - - - - - -", + lead: "E5 - - - - - - - - - - - - - - - | F5 - - - - - - - - - - - E5 - - - | G5 - - - - - - - - - - - F#5 - E5 - | D#5 - - - - - - - F#5 - - - B5 - - -", + }, + }, + order: ["A", "B", "C", "D", "C"], + }, + // Sky citadel: A minor at 100, vast and slow: a deep three-against-four bass, half-time drums and + // a sequence that rocks against a high note over each chord, under a lead that calls up E, A, C; + // the chorus climbs F and G to high leaps, and the break hangs on D minor and E7. + trailsSkyCitadel: { + bpm: 100, + rush: 16, + voices: { + bass: { wave: "sawtooth", gain: 0.44, decay: 0.06, sustain: 0.4 }, + drums: { kit: true, gain: 0.82, from: 0.1 }, + seq: { wave: "pulse", duty: 0.125, gain: 0.18, decay: 0.03, sustain: 0.25, from: 0.2 }, + brass: { wave: "sawtooth", gain: 0.14, decay: 0.2, sustain: 0.8, from: 0.35 }, + lead: { wave: "pulse", duty: 0.25, gain: 0.34, decay: 0.12, sustain: 0.8, vibrato: { rate: 5, depth: 0.012, delay: 0.2 }, from: 0.5 }, + }, + patterns: { + A: { + bass: "A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A2 A1 A2 | F1 F1 F2 F1 F1 F2 F1 F1 F2 F1 F1 F2 F1 F2 F1 F2 | G1 G1 G2 G1 G1 G2 G1 G1 G2 G1 G1 G2 G1 G2 G1 G2 | E1 E1 E2 E1 E1 E2 E1 E1 E2 E1 E1 E2 G#1 B1 D2 E2", + drums: "k . . . . . . k s . . . . . . . | k . . . . . . k s . . . . . . . | k . . . . . . k s . . . . . . . | k . . . . . . k s . s . s s s s", + seq: "A4 E5 C5 E5 A4 E5 C5 E5 A4 E5 C5 E5 B4 E5 C5 E5 | A4 C5 F4 C5 A4 C5 F4 C5 A4 C5 F4 C5 G4 C5 A4 C5 | B4 D5 G4 D5 B4 D5 G4 D5 B4 D5 G4 D5 A4 D5 B4 D5 | G#4 B4 E4 B4 G#4 B4 E4 B4 G#4 B4 D5 B4 E5 D5 B4 G#4", + }, + B: { + bass: "A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A2 A1 A2 | F1 F1 F2 F1 F1 F2 F1 F1 F2 F1 F1 F2 F1 F2 F1 F2 | G1 G1 G2 G1 G1 G2 G1 G1 G2 G1 G1 G2 G1 G2 G1 G2 | E1 E1 E2 E1 E1 E2 E1 E1 E2 E1 E1 E2 G#1 B1 D2 E2", + drums: "k . h . h . h k s . h . h . h . | k . h . h . h k s . h . h . h . | k . h . h . h k s . h . h . h . | k . h . h . h k s . s s s s s s", + seq: "A4 E5 C5 E5 A4 E5 C5 E5 A4 E5 C5 E5 B4 E5 C5 E5 | A4 C5 F4 C5 A4 C5 F4 C5 A4 C5 F4 C5 G4 C5 A4 C5 | B4 D5 G4 D5 B4 D5 G4 D5 B4 D5 G4 D5 A4 D5 B4 D5 | G#4 B4 E4 B4 G#4 B4 E4 B4 G#4 B4 D5 B4 E5 D5 B4 G#4", + brass: "A3^037 - - - - - - - - - - - A3^037 - - - | F3^047 - - - - - - - - - - - F3^047 - - - | G3^047 - - - - - - - - - - - G3^047 - - - | E3^047 - - - - - - - E3^047a - - - E3^047a - - -", + lead: "E5 - - - A5 - - - C6 - - - - - B5 - | A5 - - - - - - - - - - - G5 - F5 - | D5 - - - G5 - - - B5 - - - D6 - - - | B5 - - - - - - - G#5 - - - E5 - - -", + }, + C: { + bass: "F1 F1 F2 F1 F1 F2 F1 F1 F2 F1 F1 F2 F1 F2 F1 F2 | G1 G1 G2 G1 G1 G2 G1 G1 G2 G1 G1 G2 G1 G2 G1 G2 | A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A2 A1 A2 | E1 E1 E2 E1 E1 E2 E1 E1 E2 E1 E1 E2 G#1 B1 D2 E2", + drums: "k . h k s . h . k . h k s . h k | k . h k s . h . k . h k s . h k | k . h k s . h . k . h k s . h k | k . h k s . h k s s s s ks s ks s", + seq: "C5 A4 F5 A4 C5 A4 F5 A4 C5 A4 F5 A4 G5 A4 F5 A4 | D5 B4 G5 B4 D5 B4 G5 B4 D5 B4 G5 B4 A5 B4 G5 B4 | E5 C5 A5 C5 E5 C5 A5 C5 E5 C5 A5 C5 B5 C5 A5 C5 | E5 B4 G#5 B4 E5 B4 G#5 B4 E5 B4 G#5 B4 B5 G#5 E5 B4", + brass: "F3^047 - - - - - - - - - - - - - - - | G3^047 - - - - - - - - - - - - - - - | A3^037 - - - - - - - - - - - - - - - | E3^047a - - - - - - - - - - - - - - -", + lead: "C6 - - - - - - - F6 - - - - - E6 - | D6 - - - - - - - G6 - - - - - F6 - | E6 - - - - - - - C6 - - - A5 - - - | B5 - - - - - - - G#5 - - - E6 - - -", + }, + D: { + bass: "D2 - - - - - - - D3 - - - - - - - | D2 - - - - - - - C3 - - - - - - - | E1 - - - - - - - E2 - - - - - - - | E1 - - - E2 - - - E1 - E1 - E2 E2 E2 E2", + drums: "k . . . . . . k s . . . . . . . | k . . . . . . k s . . . . . . . | k . . . . . . k s . . . . . . . | k . . . . . . k s . s . s s s s", + seq: "F5 D5 A5 D5 F5 D5 A5 D5 F5 D5 A5 D5 G5 D5 A5 D5 | F5 D5 A5 D5 F5 D5 A5 D5 F5 D5 Bb5 D5 A5 D5 G5 D5 | E5 B4 G#5 B4 E5 B4 G#5 B4 E5 B4 G#5 B4 A5 B4 G#5 B4 | E5 B4 G#5 B4 E5 B4 D6 B4 E5 B4 G#5 B4 D6 B5 G#5 E5", + brass: "D4^037 - - - - - - - - - - - - - - - | D4^037 - - - - - - - - - - - - - - - | E4^047 - - - - - - - - - - - - - - - | E4^047a - - - - - - - - - - - - - - -", + lead: "A5 - - - - - - - - - - - - - - - | F5 - - - - - - - - - - - E5 - D5 - | E5 - - - - - - - - - - - - - - - | G#5 - - - - - - - B5 - - - D6 - - -", + }, + }, + order: ["A", "B", "C", "D", "C"], + }, + // Deep core: G minor at 104, deep under the grid: an eighth-note ostinato that dips to the + // seventh and the fifth, half-time snares, a low sequence and swelling brass under a lead that + // falls from D; the chorus switches to the three-against-four bass over E-flat, F and G minor, + // and the last section turns on a Neapolitan A-flat. + trailsDeepCore: { + bpm: 104, + rush: 16, + voices: { + bass: { wave: "sawtooth", gain: 0.44, decay: 0.06, sustain: 0.4 }, + drums: { kit: true, gain: 0.82, from: 0.1 }, + seq: { wave: "pulse", duty: 0.125, gain: 0.18, decay: 0.03, sustain: 0.25, from: 0.2 }, + brass: { wave: "sawtooth", gain: 0.14, decay: 0.2, sustain: 0.8, from: 0.35 }, + lead: { wave: "pulse", duty: 0.25, gain: 0.34, decay: 0.12, sustain: 0.8, vibrato: { rate: 5, depth: 0.012, delay: 0.2 }, from: 0.5 }, + }, + patterns: { + A: { + bass: "G1 - G1 - G2 - G1 - F2 - G1 - D2 - G1 - | Eb2 - Eb2 - Eb3 - Eb2 - D3 - Eb2 - Bb1 - Eb2 - | C2 - C2 - C3 - C2 - Bb2 - C2 - G1 - C2 - | D2 - D2 - D3 - D2 - C3 - D2 - F#2 - A2 -", + drums: "k . . . . . h . s . . . . . h . | k . . . . . h . s . . . . . h k | k . . . . . h . s . . . . . h . | k . . . . . h . s . s . s s s s", + seq: "Bb4 G4 D5 G4 Bb4 G4 D5 G4 Bb4 G4 D5 G4 Eb5 G4 D5 G4 | Bb4 G4 Eb5 G4 Bb4 G4 Eb5 G4 Bb4 G4 Eb5 G4 F5 G4 Eb5 G4 | C5 G4 Eb5 G4 C5 G4 Eb5 G4 C5 G4 Eb5 G4 F5 G4 Eb5 G4 | A4 F#4 D5 F#4 A4 F#4 D5 F#4 A4 F#4 C5 F#4 D5 C5 A4 F#4", + }, + B: { + bass: "G1 - G1 - G2 - G1 - F2 - G1 - D2 - G1 - | Eb2 - Eb2 - Eb3 - Eb2 - D3 - Eb2 - Bb1 - Eb2 - | C2 - C2 - C3 - C2 - Bb2 - C2 - G1 - C2 - | D2 - D2 - D3 - D2 - C3 - D2 - F#2 - A2 -", + drums: "k . h . h . h . s . h . h . h k | k . h . h . h . s . h . h . h k | k . h . h . h . s . h . h . h k | k . h . h . h . s . s s s s s s", + seq: "Bb4 G4 D5 G4 Bb4 G4 D5 G4 Bb4 G4 D5 G4 Eb5 G4 D5 G4 | Bb4 G4 Eb5 G4 Bb4 G4 Eb5 G4 Bb4 G4 Eb5 G4 F5 G4 Eb5 G4 | C5 G4 Eb5 G4 C5 G4 Eb5 G4 C5 G4 Eb5 G4 F5 G4 Eb5 G4 | A4 F#4 D5 F#4 A4 F#4 D5 F#4 A4 F#4 C5 F#4 D5 C5 A4 F#4", + brass: "G3^037 - - - - - - - - - - - G3^037 - - - | Eb4^047 - - - - - - - - - - - Eb4^047 - - - | C4^037 - - - - - - - - - - - C4^037 - - - | D4^047 - - - - - - - D4^047a - - - D4^047a - - -", + lead: "D6 - - - - - - - Bb5 - - - A5 - G5 - | G5 - - - - - - - - - - - F5 - Eb5 - | Eb5 - - - - - - - G5 - - - C6 - - - | A5 - - - - - - - F#5 - - - D5 - - -", + }, + C: { + bass: "Eb2 Eb2 Eb3 Eb2 Eb2 Eb3 Eb2 Eb2 Eb3 Eb2 Eb2 Eb3 Eb2 Eb3 Eb2 Eb3 | F1 F1 F2 F1 F1 F2 F1 F1 F2 F1 F1 F2 F1 F2 F1 F2 | G1 G1 G2 G1 G1 G2 G1 G1 G2 G1 G1 G2 G1 G2 G1 G2 | D2 D2 D3 D2 D2 D3 D2 D2 D3 D2 D2 D3 F#2 A2 C3 D3", + drums: "k . h k s . h . k . h k s . h k | k . h k s . h . k . h k s . h k | k . h k s . h . k . h k s . h k | k . h k s . h k s s s s ks s ks s", + seq: "G5 Eb5 Bb5 Eb5 G5 Eb5 Bb5 Eb5 G5 Eb5 Bb5 Eb5 C6 Eb5 Bb5 Eb5 | A5 F5 C6 F5 A5 F5 C6 F5 A5 F5 C6 F5 D6 F5 C6 F5 | Bb5 G5 D6 G5 Bb5 G5 D6 G5 Bb5 G5 D6 G5 Eb6 G5 D6 G5 | A5 F#5 D6 F#5 A5 F#5 D6 F#5 A5 F#5 C6 F#5 D6 C6 A5 F#5", + brass: "Eb4^047 - - - - - - - - - - - - - - - | F3^047 - - - - - - - - - - - - - - - | G3^037 - - - - - - - - - - - - - - - | D4^047 - - - - - - - - - - - - - - -", + lead: "Bb5 - - - - - - - G5 - - - Eb6 - - - | C6 - - - - - - - A5 - - - F6 - - - | D6 - - - - - - - Bb5 - - - G6 - F6 - | F#6 - - - - - - - D6 - - - A5 - - -", + }, + D: { + bass: "G1 - G1 - G2 - G1 - F2 - G1 - D2 - G1 - | Ab1 - Ab1 - Ab2 - Ab1 - G2 - Ab1 - Eb2 - Ab1 - | G1 - G1 - G2 - G1 - F2 - G1 - D2 - G1 - | D2 - D2 - D3 - D2 - C3 - D2 - F#2 - A2 -", + drums: "k . h . h . h . s . h . h . h k | k . h . h . h . s . h . h . h k | k . h . h . h . s . h . h . h k | k . h . h . h . s . s s s s s s", + seq: "Bb4 G4 D5 G4 Bb4 G4 D5 G4 Bb4 G4 D5 G4 Eb5 G4 D5 G4 | C5 Ab4 Eb5 Ab4 C5 Ab4 Eb5 Ab4 C5 Ab4 Eb5 Ab4 F5 Ab4 Eb5 Ab4 | Bb4 G4 D5 G4 Bb4 G4 D5 G4 Bb4 G4 D5 G4 Eb5 G4 D5 G4 | A4 F#4 D5 F#4 A4 F#4 D5 F#4 A4 F#4 C5 F#4 D5 C5 A4 F#4", + brass: "G3^037 - - - - - - - - - - - - - - - | Ab3^047 - - - - - - - - - - - - - - - | G3^037 - - - - - - - - - - - - - - - | D4^047 - - - - - - - - - - - - - - -", + lead: "G5 - - - - - - - - - - - - - - - | Ab5 - - - - - - - - - - - G5 - - - | Bb5 - - - - - - - - - - - A5 - G5 - | F#5 - - - - - - - A5 - - - D6 - - -", + }, + }, + order: ["A", "B", "C", "D", "C"], + }, + // Monolith: D minor at 98, a black slab on the horizon: a deep three-against-four bass under + // half-time drums, a sequence that rocks against a high note over D minor, B-flat, C and A, and a + // lead that calls up A, D, F; the chorus climbs G minor, A, B-flat in long high notes, and the + // break hangs on G minor and A7. + trailsMonolith: { + bpm: 98, + rush: 16, + voices: { + bass: { wave: "sawtooth", gain: 0.44, decay: 0.06, sustain: 0.4 }, + drums: { kit: true, gain: 0.82, from: 0.1 }, + seq: { wave: "pulse", duty: 0.125, gain: 0.18, decay: 0.03, sustain: 0.25, from: 0.2 }, + brass: { wave: "sawtooth", gain: 0.14, decay: 0.2, sustain: 0.8, from: 0.35 }, + lead: { wave: "pulse", duty: 0.25, gain: 0.34, decay: 0.12, sustain: 0.8, vibrato: { rate: 5, depth: 0.012, delay: 0.2 }, from: 0.5 }, + }, + patterns: { + A: { + bass: "D2 D2 D3 D2 D2 D3 D2 D2 D3 D2 D2 D3 D2 D3 D2 D3 | Bb1 Bb1 Bb2 Bb1 Bb1 Bb2 Bb1 Bb1 Bb2 Bb1 Bb1 Bb2 Bb1 Bb2 Bb1 Bb2 | C2 C2 C3 C2 C2 C3 C2 C2 C3 C2 C2 C3 C2 C3 C2 C3 | A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A1 A2 C#2 E2 G2 A2", + drums: "k . . . . . . k s . . . . . . . | k . . . . . . k s . . . . . . . | k . . . . . . k s . . . . . . . | k . . . . . . k s . s . s s s s", + seq: "D5 A5 F5 A5 D5 A5 F5 A5 D5 A5 F5 A5 E5 A5 F5 A5 | D5 F5 Bb4 F5 D5 F5 Bb4 F5 D5 F5 Bb4 F5 C5 F5 D5 F5 | E5 G5 C5 G5 E5 G5 C5 G5 E5 G5 C5 G5 D5 G5 E5 G5 | C#5 E5 A4 E5 C#5 E5 A4 E5 C#5 E5 G5 E5 A5 G5 E5 C#5", + }, + B: { + bass: "D2 D2 D3 D2 D2 D3 D2 D2 D3 D2 D2 D3 D2 D3 D2 D3 | Bb1 Bb1 Bb2 Bb1 Bb1 Bb2 Bb1 Bb1 Bb2 Bb1 Bb1 Bb2 Bb1 Bb2 Bb1 Bb2 | C2 C2 C3 C2 C2 C3 C2 C2 C3 C2 C2 C3 C2 C3 C2 C3 | A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A1 A2 C#2 E2 G2 A2", + drums: "k . h . h . h k s . h . h . h . | k . h . h . h k s . h . h . h . | k . h . h . h k s . h . h . h . | k . h . h . h k s . s s s s s s", + seq: "D5 A5 F5 A5 D5 A5 F5 A5 D5 A5 F5 A5 E5 A5 F5 A5 | D5 F5 Bb4 F5 D5 F5 Bb4 F5 D5 F5 Bb4 F5 C5 F5 D5 F5 | E5 G5 C5 G5 E5 G5 C5 G5 E5 G5 C5 G5 D5 G5 E5 G5 | C#5 E5 A4 E5 C#5 E5 A4 E5 C#5 E5 G5 E5 A5 G5 E5 C#5", + brass: "D4^037 - - - - - - - - - - - D4^037 - - - | Bb3^047 - - - - - - - - - - - Bb3^047 - - - | C4^047 - - - - - - - - - - - C4^047 - - - | A3^047 - - - - - - - A3^047a - - - A3^047a - - -", + lead: "A4 - - - D5 - - - F5 - - - - - E5 - | D5 - - - - - - - - - - - C5 - Bb4 - | G4 - - - C5 - - - E5 - - - G5 - - - | E5 - - - - - - - C#5 - - - A4 - - -", + }, + C: { + bass: "G1 G1 G2 G1 G1 G2 G1 G1 G2 G1 G1 G2 G1 G2 G1 G2 | A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A2 A1 A2 | Bb1 Bb1 Bb2 Bb1 Bb1 Bb2 Bb1 Bb1 Bb2 Bb1 Bb1 Bb2 Bb1 Bb2 Bb1 Bb2 | A1 A1 A2 A1 A1 A2 A1 A1 A2 A1 A1 A2 C#2 E2 G2 A2", + drums: "k . h k s . h . k . h k s . h k | k . h k s . h . k . h k s . h k | k . h k s . h . k . h k s . h k | k . h k s . h k s s s s ks s ks s", + seq: "D5 Bb4 G5 Bb4 D5 Bb4 G5 Bb4 D5 Bb4 G5 Bb4 A5 Bb4 G5 Bb4 | E5 C#5 A5 C#5 E5 C#5 A5 C#5 E5 C#5 A5 C#5 B5 C#5 A5 C#5 | F5 D5 Bb5 D5 F5 D5 Bb5 D5 F5 D5 Bb5 D5 C6 D5 Bb5 D5 | E5 C#5 A5 C#5 E5 C#5 G5 C#5 E5 C#5 A5 C#5 G5 E5 C#5 A4", + brass: "G3^037 - - - - - - - - - - - - - - - | A3^047 - - - - - - - - - - - - - - - | Bb3^047 - - - - - - - - - - - - - - - | A3^047a - - - - - - - - - - - - - - -", + lead: "Bb5 - - - - - - - D6 - - - - - C6 - | C#6 - - - - - - - E6 - - - - - D6 - | D6 - - - - - - - F6 - - - - - - - | E6 - - - - - - - C#6 - - - A5 - - -", + }, + D: { + bass: "G1 - - - - - - - G2 - - - - - - - | G1 - - - - - - - F2 - - - - - - - | A1 - - - - - - - A2 - - - - - - - | A1 - - - A2 - - - A1 - A1 - A2 A2 A2 A2", + drums: "k . . . . . . k s . . . . . . . | k . . . . . . k s . . . . . . . | k . . . . . . k s . . . . . . . | k . . . . . . k s . s . s s s s", + seq: "D5 Bb4 G5 Bb4 D5 Bb4 G5 Bb4 D5 Bb4 G5 Bb4 A5 Bb4 G5 Bb4 | D5 Bb4 G5 Bb4 D5 Bb4 G5 Bb4 D5 Bb4 G5 Bb4 F5 Bb4 G5 Bb4 | E5 C#5 A5 C#5 E5 C#5 A5 C#5 E5 C#5 A5 C#5 B5 C#5 A5 C#5 | E5 C#5 A5 C#5 E5 C#5 G5 C#5 E5 C#5 A5 C#5 G5 E5 C#5 A4", + brass: "G3^037 - - - - - - - - - - - - - - - | G3^037 - - - - - - - - - - - - - - - | A3^047 - - - - - - - - - - - - - - - | A3^047a - - - - - - - - - - - - - - -", + lead: "D6 - - - - - - - - - - - - - - - | Bb5 - - - - - - - - - - - A5 - G5 - | A5 - - - - - - - - - - - - - - - | C#6 - - - - - - - E6 - - - - - - -", + }, + }, + order: ["A", "B", "C", "D", "C"], + }, + // Netrunner: D minor at 122, jacked into the net: a pulsing sixteenth sawtooth bass with an + // octave kick on two and four, an arp in threes that slides against the beat, gated chord stabs + // that stutter in and out, and a sawtooth lead; the chorus lifts G minor, B-flat, C to a bright A + // major. + trailsNetrunner: { + bpm: 122, + rush: 10, + voices: { + bass: { wave: "sawtooth", gain: 0.42, decay: 0.05, sustain: 0.3 }, + drums: { kit: true, gain: 0.8, from: 0.1 }, + arp: { wave: "pulse", duty: 0.125, gain: 0.18, decay: 0.03, sustain: 0.25, from: 0.2 }, + stab: { wave: "pulse", duty: 0.25, gain: 0.22, decay: 0.03, sustain: 0.1, from: 0.3 }, + lead: { wave: "sawtooth", gain: 0.19, decay: 0.1, sustain: 0.8, vibrato: { rate: 5.5, depth: 0.01, delay: 0.2 }, from: 0.5 }, + }, + patterns: { + A: { + bass: "D2 D2 D2 D2 D3 D2 D2 D2 D2 D2 D2 D2 D3 D2 C3 D2 | Bb1 Bb1 Bb1 Bb1 Bb2 Bb1 Bb1 Bb1 Bb1 Bb1 Bb1 Bb1 Bb2 Bb1 A1 Bb1 | F1 F1 F1 F1 F2 F1 F1 F1 F1 F1 F1 F1 F2 F1 E1 F1 | C2 C2 C2 C2 C3 C2 C2 C2 C2 C2 C2 C2 C3 C2 E2 G2", + drums: "k . h . s . h . k . h k s . h . | k . h . s . h . k . h k s . h . | k . h . s . h . k . h k s . h . | k . h . s . h k s s s s s s s s", + arp: "D5 F5 A5 D5 F5 A5 D5 F5 A5 D5 F5 A5 D5 F5 A5 C6 | D5 F5 Bb5 D5 F5 Bb5 D5 F5 Bb5 D5 F5 Bb5 D5 F5 Bb5 C6 | C5 F5 A5 C5 F5 A5 C5 F5 A5 C5 F5 A5 C5 F5 A5 C6 | C5 E5 G5 C5 E5 G5 C5 E5 G5 C5 E5 G5 C5 E5 G5 Bb5", + }, + B: { + bass: "D2 D2 D2 D2 D3 D2 D2 D2 D2 D2 D2 D2 D3 D2 C3 D2 | Bb1 Bb1 Bb1 Bb1 Bb2 Bb1 Bb1 Bb1 Bb1 Bb1 Bb1 Bb1 Bb2 Bb1 A1 Bb1 | F1 F1 F1 F1 F2 F1 F1 F1 F1 F1 F1 F1 F2 F1 E1 F1 | C2 C2 C2 C2 C3 C2 C2 C2 C2 C2 C2 C2 C3 C2 E2 G2", + drums: "kh h h h sh h h h kh h kh h sh h h h | kh h h h sh h h h kh h kh h sh h h h | kh h h h sh h h h kh h kh h sh h h h | kh h h h sh h h h s . s s s s s s", + arp: "D5 F5 A5 D5 F5 A5 D5 F5 A5 D5 F5 A5 D5 F5 A5 C6 | D5 F5 Bb5 D5 F5 Bb5 D5 F5 Bb5 D5 F5 Bb5 D5 F5 Bb5 C6 | C5 F5 A5 C5 F5 A5 C5 F5 A5 C5 F5 A5 C5 F5 A5 C6 | C5 E5 G5 C5 E5 G5 C5 E5 G5 C5 E5 G5 C5 E5 G5 Bb5", + stab: "D4^037 D4^037 . D4^037 . D4^037 D4^037 . D4^037 . D4^037 D4^037 . D4^037 . . | Bb3^047 Bb3^047 . Bb3^047 . Bb3^047 Bb3^047 . Bb3^047 . Bb3^047 Bb3^047 . Bb3^047 . . | F4^047 F4^047 . F4^047 . F4^047 F4^047 . F4^047 . F4^047 F4^047 . F4^047 . . | C4^047 C4^047 . C4^047 . C4^047 C4^047 . C4^047 . C4^047 C4^047 . C4^047 . .", + lead: "A5 - - - - - - - F5 - - - D5 - - - | D6 - - - - - - - C6 - - - Bb5 - - - | A5 - - - - - - - C6 - - - F6 - - - | E6 - - - - - - - D6 - - - C6 - - -", + }, + C: { + bass: "G1 G1 G1 G1 G2 G1 G1 G1 G1 G1 G1 G1 G2 G1 F1 G1 | Bb1 Bb1 Bb1 Bb1 Bb2 Bb1 Bb1 Bb1 Bb1 Bb1 Bb1 Bb1 Bb2 Bb1 A1 Bb1 | C2 C2 C2 C2 C3 C2 C2 C2 C2 C2 C2 C2 C3 C2 Bb1 C2 | A1 A1 A1 A1 A2 A1 A1 A1 A1 A1 A1 A1 A2 A1 C#2 E2", + drums: "k . h k s . h k k . h k s . h k | k . h k s . h k k . h k s . h k | k . h k s . h k k . h k s . h k | k . h k s . h k s s s s ks s ks s", + arp: "D5 G5 Bb5 D5 G5 Bb5 D5 G5 Bb5 D5 G5 Bb5 D5 G5 Bb5 C6 | D5 F5 Bb5 D5 F5 Bb5 D5 F5 Bb5 D5 F5 Bb5 D5 F5 Bb5 C6 | E5 G5 C6 E5 G5 C6 E5 G5 C6 E5 G5 C6 E5 G5 C6 D6 | C#5 E5 A5 C#5 E5 A5 C#5 E5 A5 C#5 E5 A5 C#5 E5 A5 G5", + stab: "G3^037 - - - - - - - - - - - - - - - | Bb3^047 - - - - - - - - - - - - - - - | C4^047 - - - - - - - - - - - - - - - | A3^047a - - - - - - - - - - - - - - -", + lead: "Bb5 - - - - - - - D6 - - - G6 - - - | F6 - - - - - - - D6 - - - Bb5 - - - | G6 - - - - - - - E6 - - - C6 - - - | C#6 - - - - - - - E6 - - - - - - -", + }, + }, + order: ["A", "B", "C", "B", "C"], + }, + // Overdrive at dusk: F minor outrun at 112 with the sun going down: a big gated snare on two and + // four, an octave-bouncing sawtooth bass, a rolling sixteenth arp and gated chord pulses, and a + // sawtooth lead doubled an octave below; the chorus swings B-flat minor, A-flat, D-flat to a + // bright C major. + trailsOverdrive: { + bpm: 112, + rush: 12, + voices: { + bass: { wave: "sawtooth", gain: 0.4, decay: 0.07, sustain: 0.4 }, + drums: { kit: true, gain: 0.8, from: 0.1 }, + arp: { wave: "pulse", duty: 0.125, gain: 0.16, decay: 0.03, sustain: 0.3, from: 0.3 }, + pad: { wave: "pulse", duty: 0.25, gain: 0.2, decay: 0.05, sustain: 0.3, from: 0.25 }, + lead: { wave: "sawtooth", gain: 0.2, decay: 0.12, sustain: 0.8, vibrato: { rate: 5.5, depth: 0.01, delay: 0.2 }, from: 0.5 }, + low: { wave: "pulse", duty: 0.5, gain: 0.16, decay: 0.12, sustain: 0.8, from: 0.5 }, + }, + patterns: { + A: { + bass: "F1 . F2 . F1 . F2 . F1 . F2 . F1 . F2 . | Db2 . Db3 . Db2 . Db3 . Db2 . Db3 . Db2 . Db3 . | Ab1 . Ab2 . Ab1 . Ab2 . Ab1 . Ab2 . Ab1 . Ab2 . | Eb2 . Eb3 . Eb2 . Eb3 . Eb2 . Eb3 . Eb2 . G2 Bb2", + drums: "k . h . s . h . k . h k s . h . | k . h . s . h . k . h k s . h . | k . h . s . h . k . h k s . h . | k . h . s . h . s s s s s s s s", + arp: "F4 Ab4 C5 F5 Ab5 F5 C5 Ab4 F4 Ab4 C5 F5 Ab5 F5 C5 Ab4 | F4 Ab4 Db5 F5 Ab5 F5 Db5 Ab4 F4 Ab4 Db5 F5 Ab5 F5 Db5 Ab4 | Eb4 Ab4 C5 Eb5 Ab5 Eb5 C5 Ab4 Eb4 Ab4 C5 Eb5 Ab5 Eb5 C5 Ab4 | Eb4 G4 Bb4 Eb5 G5 Eb5 Bb4 G4 Eb4 G4 Bb4 Eb5 G5 Eb5 Bb4 G4", + }, + B: { + bass: "F1 . F2 . F1 . F2 . F1 . F2 . F1 . F2 . | Db2 . Db3 . Db2 . Db3 . Db2 . Db3 . Db2 . Db3 . | Ab1 . Ab2 . Ab1 . Ab2 . Ab1 . Ab2 . Ab1 . Ab2 . | Eb2 . Eb3 . Eb2 . Eb3 . Eb2 . Eb3 . Eb2 . G2 Bb2", + drums: "k h h h s h h h k h k h s h h h | k h h h s h h h k h k h s h h h | k h h h s h h h k h k h s h h h | k h h h s h h h s . s s s s s s", + arp: "F4 Ab4 C5 F5 Ab5 F5 C5 Ab4 F4 Ab4 C5 F5 Ab5 F5 C5 Ab4 | F4 Ab4 Db5 F5 Ab5 F5 Db5 Ab4 F4 Ab4 Db5 F5 Ab5 F5 Db5 Ab4 | Eb4 Ab4 C5 Eb5 Ab5 Eb5 C5 Ab4 Eb4 Ab4 C5 Eb5 Ab5 Eb5 C5 Ab4 | Eb4 G4 Bb4 Eb5 G5 Eb5 Bb4 G4 Eb4 G4 Bb4 Eb5 G5 Eb5 Bb4 G4", + pad: "F4^037 . F4^037 F4^037 . F4^037 . F4^037 F4^037 . F4^037 F4^037 . F4^037 . F4^037 | Db4^047 . Db4^047 Db4^047 . Db4^047 . Db4^047 Db4^047 . Db4^047 Db4^047 . Db4^047 . Db4^047 | Ab3^047 . Ab3^047 Ab3^047 . Ab3^047 . Ab3^047 Ab3^047 . Ab3^047 Ab3^047 . Ab3^047 . Ab3^047 | Eb4^047 . Eb4^047 Eb4^047 . Eb4^047 . Eb4^047 Eb4^047 . Eb4^047 Eb4^047 . Eb4^047 . Eb4^047", + lead: "C6 - - - - - Ab5 - F5 - - - Ab5 - - - | Db6 - - - - - C6 - Ab5 - - - F5 - - - | Eb6 - - - - - C6 - Ab5 - - - C6 - - - | Bb5 - - - - - - - - - - - . . . .", + low: "C5 - - - - - Ab4 - F4 - - - Ab4 - - - | Db5 - - - - - C5 - Ab4 - - - F4 - - - | Eb5 - - - - - C5 - Ab4 - - - C5 - - - | Bb4 - - - - - - - - - - - . . . .", + }, + C: { + bass: "Bb1 . Bb2 . Bb1 . Bb2 . Bb1 . Bb2 . Bb1 . Bb2 . | Ab1 . Ab2 . Ab1 . Ab2 . Ab1 . Ab2 . Ab1 . Ab2 . | Db2 . Db3 . Db2 . Db3 . Db2 . Db3 . Db2 . Db3 . | C2 . C3 . C2 . C3 . C2 . C3 . C2 . E2 G2", + drums: "k h h h s h h h k h k h s h h h | k h h h s h h h k h k h s h h h | k h h h s h h h k h k h s h h h | k h h h s h h h s s s s s s s s", + arp: "F4 Bb4 Db5 F5 Bb5 F5 Db5 Bb4 F4 Bb4 Db5 F5 Bb5 F5 Db5 Bb4 | Eb4 Ab4 C5 Eb5 Ab5 Eb5 C5 Ab4 Eb4 Ab4 C5 Eb5 Ab5 Eb5 C5 Ab4 | F4 Ab4 Db5 F5 Ab5 F5 Db5 Ab4 F4 Ab4 Db5 F5 Ab5 F5 Db5 Ab4 | E4 G4 C5 E5 G5 E5 C5 G4 E4 G4 C5 E5 G5 E5 C5 G4", + pad: "Bb3^037 . Bb3^037 Bb3^037 . Bb3^037 . Bb3^037 Bb3^037 . Bb3^037 Bb3^037 . Bb3^037 . Bb3^037 | Ab3^047 . Ab3^047 Ab3^047 . Ab3^047 . Ab3^047 Ab3^047 . Ab3^047 Ab3^047 . Ab3^047 . Ab3^047 | Db4^047 . Db4^047 Db4^047 . Db4^047 . Db4^047 Db4^047 . Db4^047 Db4^047 . Db4^047 . Db4^047 | C4^047 . C4^047 C4^047 . C4^047 . C4^047 C4^047 . C4^047 C4^047 . C4^047 . C4^047", + lead: "Db6 - - - - - - - F6 - - - Db6 - - - | C6 - - - - - - - Eb6 - - - C6 - - - | Ab5 - - - - - - - Db6 - - - F6 - - - | E6 - - - - - - - G6 - - - E6 - - -", + low: "Db5 - - - - - - - F5 - - - Db5 - - - | C5 - - - - - - - Eb5 - - - C5 - - - | Ab4 - - - - - - - Db5 - - - F5 - - - | E5 - - - - - - - G5 - - - E5 - - -", + }, + }, + order: ["A", "B", "C", "B", "C"], + }, + // Laser highway: G minor at 120 on an empty highway of light: a pushing octave bass, a pad that + // pumps on every beat like it is breathing with the kick, a sequence ticking over each chord, and + // a lead with an echo trailing a dotted eighth behind it; the chorus climbs C minor, B-flat, + // E-flat to F. + trailsLaserHighway: { + bpm: 120, + rush: 10, + voices: { + bass: { wave: "sawtooth", gain: 0.4, decay: 0.06, sustain: 0.35 }, + drums: { kit: true, gain: 0.78, from: 0.1 }, + pad: { wave: "sine", gain: 0.22, decay: 0.2, sustain: 0.6, from: 0.2 }, + seq: { wave: "pulse", duty: 0.125, gain: 0.16, decay: 0.03, sustain: 0.25, from: 0.35 }, + lead: { wave: "pulse", duty: 0.25, gain: 0.34, decay: 0.12, sustain: 0.8, vibrato: { rate: 5.5, depth: 0.01, delay: 0.2 }, from: 0.5 }, + echo: { wave: "pulse", duty: 0.25, gain: 0.12, decay: 0.12, sustain: 0.6, from: 0.55 }, + }, + patterns: { + A: { + bass: "G1 . G2 . G1 G1 G2 . G1 . G2 . G1 G1 G2 F2 | Eb2 . Eb3 . Eb2 Eb2 Eb3 . Eb2 . Eb3 . Eb2 Eb2 Eb3 D3 | Bb1 . Bb2 . Bb1 Bb1 Bb2 . Bb1 . Bb2 . Bb1 Bb1 Bb2 A2 | F1 . F2 . F1 F1 F2 . F1 . F2 . F1 F1 F2 A1", + drums: "k . h k s . h . k . h k s . h . | k . h k s . h . k . h k s . h . | k . h k s . h . k . h k s . h . | k . h k s . h . s s s s s s s s", + pad: "G3^037 - - . G3^037 - - . G3^037 - - . G3^037 - - . | Eb4^047 - - . Eb4^047 - - . Eb4^047 - - . Eb4^047 - - . | Bb3^047 - - . Bb3^047 - - . Bb3^047 - - . Bb3^047 - - . | F3^047 - - . F3^047 - - . F3^047 - - . F3^047 - - .", + seq: "G4 D5 Bb4 D5 G4 D5 Bb4 D5 G4 D5 Bb4 D5 A4 D5 Bb4 D5 | G4 Eb5 Bb4 Eb5 G4 Eb5 Bb4 Eb5 G4 Eb5 Bb4 Eb5 F4 Eb5 Bb4 Eb5 | F4 D5 Bb4 D5 F4 D5 Bb4 D5 F4 D5 Bb4 D5 G4 D5 Bb4 D5 | F4 C5 A4 C5 F4 C5 A4 C5 F4 C5 A4 C5 Eb5 C5 A4 C5", + }, + B: { + bass: "G1 . G2 . G1 G1 G2 . G1 . G2 . G1 G1 G2 F2 | Eb2 . Eb3 . Eb2 Eb2 Eb3 . Eb2 . Eb3 . Eb2 Eb2 Eb3 D3 | Bb1 . Bb2 . Bb1 Bb1 Bb2 . Bb1 . Bb2 . Bb1 Bb1 Bb2 A2 | F1 . F2 . F1 F1 F2 . F1 . F2 . F1 F1 F2 A1", + drums: "kh h h kh sh h h h kh h h kh sh h h h | kh h h kh sh h h h kh h h kh sh h h h | kh h h kh sh h h h kh h h kh sh h h h | kh h h kh sh h h h s . s s s s s s", + pad: "G3^037 - - . G3^037 - - . G3^037 - - . G3^037 - - . | Eb4^047 - - . Eb4^047 - - . Eb4^047 - - . Eb4^047 - - . | Bb3^047 - - . Bb3^047 - - . Bb3^047 - - . Bb3^047 - - . | F3^047 - - . F3^047 - - . F3^047 - - . F3^047 - - .", + seq: "G4 D5 Bb4 D5 G4 D5 Bb4 D5 G4 D5 Bb4 D5 A4 D5 Bb4 D5 | G4 Eb5 Bb4 Eb5 G4 Eb5 Bb4 Eb5 G4 Eb5 Bb4 Eb5 F4 Eb5 Bb4 Eb5 | F4 D5 Bb4 D5 F4 D5 Bb4 D5 F4 D5 Bb4 D5 G4 D5 Bb4 D5 | F4 C5 A4 C5 F4 C5 A4 C5 F4 C5 A4 C5 Eb5 C5 A4 C5", + lead: "D5 - - - G5 - - - Bb5 - - - A5 - G5 - | G5 - - - - - - - Eb5 - - - Bb4 - - - | D5 - - - F5 - - - Bb5 - - - C6 - D6 - | C6 - - - - - - - A5 - - - F5 - - -", + echo: ". - - D5 - - - G5 - - - Bb5 - - - A5 | - G5 - G5 - - - - - - - Eb5 - - - Bb4 | - - - D5 - - - F5 - - - Bb5 - - - C6 | - D6 - C6 - - - - - - - A5 - - - F5", + }, + C: { + bass: "C2 . C3 . C2 C2 C3 . C2 . C3 . C2 C2 C3 Bb2 | Bb1 . Bb2 . Bb1 Bb1 Bb2 . Bb1 . Bb2 . Bb1 Bb1 Bb2 A2 | Eb2 . Eb3 . Eb2 Eb2 Eb3 . Eb2 . Eb3 . Eb2 Eb2 Eb3 D3 | F1 . F2 . F1 F1 F2 . F1 . F2 . F1 F1 F2 A1", + drums: "kh h h kh sh h h h kh h h kh sh h h h | kh h h kh sh h h h kh h h kh sh h h h | kh h h kh sh h h h kh h h kh sh h h h | kh h h kh sh h h h s s s s s s s s", + pad: "C4^037 - - . C4^037 - - . C4^037 - - . C4^037 - - . | Bb3^047 - - . Bb3^047 - - . Bb3^047 - - . Bb3^047 - - . | Eb4^047 - - . Eb4^047 - - . Eb4^047 - - . Eb4^047 - - . | F3^047 - - . F3^047 - - . F3^047 - - . F3^047 - - .", + seq: "G4 Eb5 C5 Eb5 G4 Eb5 C5 Eb5 G4 Eb5 C5 Eb5 F4 Eb5 C5 Eb5 | F4 D5 Bb4 D5 F4 D5 Bb4 D5 F4 D5 Bb4 D5 G4 D5 Bb4 D5 | G4 Eb5 Bb4 Eb5 G4 Eb5 Bb4 Eb5 G4 Eb5 Bb4 Eb5 Ab4 Eb5 Bb4 Eb5 | F4 C5 A4 C5 F4 C5 A4 C5 F4 C5 A4 C5 Eb5 C5 A4 C5", + lead: "Eb6 - - - - - - - D6 - - - C6 - - - | D6 - - - - - - - Bb5 - - - F5 - - - | G5 - - - - - - - Bb5 - - - Eb6 - - - | F6 - - - - - - - C6 - - - A5 - - -", + echo: ". - - Eb6 - - - - - - - D6 - - - C6 | - - - D6 - - - - - - - Bb5 - - - F5 | - - - G5 - - - - - - - Bb5 - - - Eb6 | - - - F6 - - - - - - - C6 - - - A5", + }, + }, + order: ["A", "B", "C", "B", "C"], + }, +}; diff --git a/src/web-console/public/activities/trails-sfx.js b/src/web-console/public/activities/trails-sfx.js index 00091c3..d74a679 100644 --- a/src/web-console/public/activities/trails-sfx.js +++ b/src/web-console/public/activities/trails-sfx.js @@ -1,11 +1,15 @@ -// Plan2Code Web Console - trails: its own sound effects, merged into tones.js beside the shared kit; defines only. +// Plan2Code Web Console - trails: its own sound effects and music, merged into tones.js beside the shared kit; defines only. // // `tones` are one-shot sounds played with tone(name, level, pitch); `hums` are // held sounds kept going with hum(id, name, level, pitch). Both take the shapes // tones.js documents, as plain objects (tones.js freezes them). A name may be -// defined only once across tones.js and every game's file. No imports. +// defined only once across tones.js and every game's file. The music is in +// trails-music.js, merged in below as `music`: that file is the only import. + +import { TRAILS_MUSIC } from "./trails-music.js"; export default { + music: TRAILS_MUSIC, tones: { // A turn taken: a short, bright synth chirp (the game nudges its pitch a // little each time, so steering never sounds like one repeated beep). diff --git a/src/web-console/public/activities/trails.js b/src/web-console/public/activities/trails.js index 53a2dfd..a41fce7 100644 --- a/src/web-console/public/activities/trails.js +++ b/src/web-console/public/activities/trails.js @@ -131,6 +131,40 @@ export const ARENAS = deepFreeze({ export const arenaFor = (level) => ARENAS[Math.min(Math.max(1, level || 1), MAX_LEVEL)]; +// The music: fourteen tracks (trails-music.js), one for each arena of a round. +// A round deals them in a fresh order, so a run hears a different track in +// every arena and none twice (nine arenas, fourteen tracks), and a round never +// opens on the track the last one opened on. +export const MUSIC_TRACKS = Object.freeze(["trailsGridElectro", "trailsRecognizer", "trailsMainframe", "trailsBlackIce", "trailsSentinel", "trailsThrone", "trailsSiege", "trailsIronGate", "trailsSkyCitadel", "trailsDeepCore", "trailsMonolith", "trailsNetrunner", "trailsOverdrive", "trailsLaserHighway"]); + +// Every track in a new order, shuffled with the given random, the first never `last`. +export function dealMusic(random = Math.random, last = null) { + const deck = [...MUSIC_TRACKS]; + for (let i = deck.length - 1; i > 0; i--) { + const j = Math.floor(random() * (i + 1)); + [deck[i], deck[j]] = [deck[j], deck[i]]; + } + if (deck[0] === last) [deck[0], deck[1]] = [deck[1], deck[0]]; + return deck; +} + +// The deal's track for an arena: the first for level 1, the second for level 2. +export const trackFor = (deck, level) => deck[(Math.max(1, level) - 1) % deck.length]; + +// How hot play is for the music, 0 to 1. While a heat lines up or shows how +// it went, HEAT_WAIT: the bass, drums and sequence. Once the riders go, +// HEAT_RACE brings in the brass and lead; down to the last rival it is +// HEAT_DUEL, and a boost pushes it all the way, the tempo with it. +const HEAT_WAIT = 0.3; +const HEAT_RACE = 0.7; +const HEAT_DUEL = 0.85; +export function heat(round) { + if (round.phase !== "race") return HEAT_WAIT; + if (active(round, "boost")) return 1; + const rivals = round.riders.filter((r) => r.id !== 0 && r.alive).length; + return rivals <= 1 ? HEAT_DUEL : HEAT_RACE; +} + const LEVEL_COLORS = Object.freeze(["#1fb6d9", "#1fb6d9", "#ff8a1f", "#a466ff", "#4f7cff", "#7a7f99", "#ff4fa3", "#8fd3ff", "#e2553f", "#f5b301"]); const levelColor = (level) => LEVEL_COLORS[Math.min(level, LEVEL_COLORS.length - 1)]; @@ -1208,10 +1242,13 @@ function teaser(furthest) { const MAX_PARTS = 400; -function create({ canvas, tone = () => {}, hum = () => {}, onScore = () => {}, best = () => 0, memo = null }) { +function create({ canvas, tone = () => {}, hum = () => {}, music = () => {}, onScore = () => {}, best = () => 0, memo = null }) { const ctx = canvas.getContext("2d"); let colors = null; let round = newRound(); + // The round's deal of tracks, and the one it opened on (so the next round opens on another). + let deck = []; + let opener = null; let state = "ready"; let cell = MIN_CELL; let bestAtStart = 0; @@ -1541,6 +1578,8 @@ function create({ canvas, tone = () => {}, hum = () => {}, onScore = () => {}, b const start = () => { colors = null; round = newRound(); + deck = dealMusic(Math.random, opener); + opener = deck[0]; state = "running"; resetFx(); resetSfx(); @@ -1601,7 +1640,10 @@ function create({ canvas, tone = () => {}, hum = () => {}, onScore = () => {}, b advance(round, ms); drain(); if (round.over) end(); - else listen(); + else { + listen(); + if (deck.length) music(trackFor(deck, round.level), heat(round)); + } paint(); }, resize(w, h) { diff --git a/src/web-console/public/music.js b/src/web-console/public/music.js index 23663b9..a123ff7 100644 --- a/src/web-console/public/music.js +++ b/src/web-console/public/music.js @@ -15,10 +15,13 @@ import { MUSIC_TABLES, audioOut } from "./tones.js"; A track is: - { bpm, rush, voices: { name: voice }, patterns: { id: { voice: "..." } }, order: [id, ...] } + { bpm, rush, bar, voices: { name: voice }, patterns: { id: { voice: "..." } }, order: [id, ...] } `bpm` is the tempo at intensity 0 and `rush` the beats a minute added at - intensity 1. Each step is a sixteenth note. A voice is a chip channel: + intensity 1. Each step is a sixteenth note. `bar` is the steps in a bar + (16 when left out); only a track in another meter sets it (12 for 6/8, 14 + for 7/8, 20 for ten beats), so a track picks up again on the start of a + bar, and a track that sets it must give every pattern a whole number of bars. A voice is a chip channel: { wave, duty, gain, from, decay, sustain, vibrato, kit }. `wave` is "pulse" (with `duty`, 0.125, 0.25 or 0.5, the classic chip squares), "triangle", "sine", "square" or "sawtooth"; `kit` makes it the drums @@ -93,6 +96,8 @@ const tokens = (line) => line.split(/\s+/).filter((t) => t && t !== "|"); // does not read throws, which the suite catches for every listed track. export function compileTrack(track) { if (!(track.bpm >= 40 && track.bpm <= 240)) throw new Error("bpm out of range"); + const bar = track.bar ?? 16; + if (!(Number.isInteger(bar) && bar >= 4 && bar <= 64)) throw new Error("bar out of range"); const voices = Object.keys(track.voices || {}); if (!voices.length) throw new Error("no voices"); const patterns = {}; @@ -123,6 +128,7 @@ export function compileTrack(track) { lines[voice] = notes; } if (!length) throw new Error(`${id}: empty`); + if (track.bar !== undefined && length % bar) throw new Error(`${id}: ${length} steps is not whole bars of ${bar}`); patterns[id] = { length, lines }; } const order = track.order || []; @@ -276,7 +282,7 @@ function startTrack(a, name, rampS, volume) { bus.connect(musicOut(a)); const song = compiledTrack(name); const was = positions.get(name) || 0; - return { name, song, bus, step: was - (was % 16), next: a.c.currentTime + 0.05, intensity: 0, seen: 0, volume }; + return { name, song, bus, step: was - (was % (song.track.bar ?? 16)), next: a.c.currentTime + 0.05, intensity: 0, seen: 0, volume }; } function letGo(playing, ms) { diff --git a/src/web-console/static.mjs b/src/web-console/static.mjs index 9f3dba9..30b1b20 100644 --- a/src/web-console/static.mjs +++ b/src/web-console/static.mjs @@ -219,8 +219,10 @@ export const SERVABLE = new Set([ "activities/ghoul-rush/draw/ghoul-monsters-draw.js", "activities/pills.js", "activities/snake-sfx.js", + "activities/snake-music.js", "activities/golf-sfx.js", "activities/trails-sfx.js", + "activities/trails-music.js", "activities/bugs-sfx.js", "activities/drive-sfx.js", "activities/stack-sfx.js",