SERGEY·VERSE · Planet Radio
How a song is made from a Qubic tick
No samples and no recordings. Every world's sixteen stations compose their own music in your browser from three numbers, so everyone tuned to the same station hears the same song.
Try it · roll the dice
Three numbers in, one song out
The song needs exactly three inputs. Roll any of them, or type your own, and watch the whole recipe change. Keep all three the same and everyone in the galaxy hears the same song.
Highlighted lines changed on the last roll. Run renders the nine stems with the game's own code, right here in your browser, then plays the five-minute arrangement.
Formula lab · every tick, a new track
Set the limits. The ledger writes the tracks.
Pick a station and narrow its dice: the tempo range, the keys and modes, the instruments, the layers. Then go live. Every Qubic tick (about one a second) seeds a brand-new track inside your formula, and they pile up below. Go back and play any of them: the same tick and formula always give the same track.
Qubic tick
—press Go liveNo tracks yet. Each Go live listens to the ledger for 5 seconds and adds a track for every tick.
Input 1 · the ledger
Qubic tick
The live tick, extrapolated between polls. Every 300 ticks (about 6 minutes) is a new song window.
Input 2 · the world
World seed
The same number that builds the planet's terrain, sky and ruins also gives its stations their identity.
Input 3 · the dial
Station salt
Each station mixes in its own constant, so Jazz and Jungle on the same world never collide.
The formula
window = floor( tick / 300 )
songSeed = worldSeed ⊕ stationSalt ⊕ imul( window + 1, 0x9E3779B1 )
rng = mulberry32( songSeed ) → every choice below is one draw
The station's callsign and dial frequency come from the world seed and salt alone, so they never change. The song changes every window, or after 5 minutes of play.
1The recipe: what the dice decide
Style
Weighted by station: swing, acid, liquid roller, alien hymn, UK garage… 48 styles in all
Tempo
Within the style's range: 42 bpm floating ambient up to 176 bpm drum and bass
Key and mode
Any of 12 keys from its own hash, plus a consonant mode: ionian, lydian, dorian, mixolydian…
Chords
A progression from the style's set, or a fresh one walked chord by chord; one of eight voicings; one or two bars per chord
Instruments
Lead, breakdown lead, comping and bass: kalimba, Rhodes, supersaw, hoover, acid line, choir…
Rhythm
Euclidean drum patterns, amen-style breaks or four-to-the-floor, with the song's own swing
Melody
One of eight shapes (stepwise, arpeggio, pentatonic, call-and-response, long notes, riff, falling, pedal) on one of seven rhythms, phrased A · A′ · B · A
Extras
1–3 of 18 creature calls, 3 of 12 sparkle flourishes, and a silly title and artist
The dice, rolled: one world, every station
All sixteen stations on Raxdraka-665 (world seed 211398936) in song window 6101. This is what the recipe step returns, straight from the game's code. Press Run on any card to hear it.
WRAX 101.5 FM
Space Ambient
"Study in Apogee (Live at Station Zarya)" by The Long Exposure
{
"style": "ambient",
"bpm": 44,
"key": "Ab deep-space lydian",
"chords": [0, 4, 5, 3],
"barsPerChord": 2,
"comp": "hollow",
"kit": {
"snare": "rim",
"hand": "conga",
"mallet": "kalimba"
},
"swing": 0.02,
"critters": ["wolf"],
"flourishes": ["comet", "shaker", "zap"]
}WRAX 97.1 FM
Planet Pop
"Луна (Moon)" by Космос Collective
{
"style": "highlife",
"bpm": 123,
"key": "F# mixolydian",
"chords": [0, 4, 0, 2],
"barsPerChord": 1,
"lead": "marimba",
"breakdownLead": "kalimba",
"comp": "guitar2",
"bass": "pluck",
"kit": {
"kick": "soft",
"snare": "rim",
"hat": "shaker",
"hand": "djembe",
"bell": "agogo"
},
"swing": 0.023,
"critters": ["crickets"],
"flourishes": ["chimes", "comet", "reverse"]
}WRAX 102.5 FM
Space Jazz
"Cantata for Deep Field 7" by Tomas Takahara & Gegenschein
{
"style": "ballad",
"bpm": 76,
"key": "Bb dorian",
"chords": [1, 4, 2, 5],
"barsPerChord": 2,
"lead": "flute",
"breakdownLead": "sax",
"comp": "rhodes",
"bass": "round",
"kit": {
"kick": "feather",
"snare": "brush",
"hat": "pedal"
},
"swing": 0.19,
"critters": ["owl", "rooster", "loon"],
"flourishes": ["spinback", "riser", "harp"]
}KRAX 90.3 FM
Space Opera
"Hymn for Europa's Ocean" by Светлана Звездина
{
"style": "majestic",
"bpm": 70,
"key": "D lydian",
"chords": [0, 3, 0, 4],
"barsPerChord": 2,
"lead": "horn",
"breakdownLead": "violin",
"comp": "strings",
"bass": "round",
"swing": 0.015,
"critters": ["birds", "cuckoo"],
"flourishes": ["zap", "chimes", "harp"]
}KRAX 97.3 FM
Bunker 138
"Nocturne for the Oort Cloud" by Дмитрий Морозов & The Deep Field Ensemble
{
"style": "peak",
"bpm": 137,
"key": "E phrygian",
"chords": [0, 0, 5, 5],
"barsPerChord": 1,
"lead": "theremin",
"breakdownLead": "stab",
"comp": "dub",
"bass": "roll",
"swing": 0.013,
"critters": ["frogs"],
"flourishes": ["reverse", "zap", "shaker"]
}WRAX 99.7 FM
Deep House Lounge
"Study in Spectral Lines" by Occultation
{
"style": "deep",
"bpm": 120,
"key": "A ionian",
"chords": [0, 3, 0, 3],
"barsPerChord": 1,
"lead": "pluck",
"breakdownLead": "vibes",
"comp": "rhodes",
"bass": "warm",
"swing": 0.094,
"critters": ["kookaburra", "wolf"],
"flourishes": ["twinkle", "musicbox", "bubbles"]
}WRAX 95.3 FM
Hyperspace Trance
"Aphelion, Op. 66" by Олег Орлов
{
"style": "uplifting",
"bpm": 140,
"key": "Ab aeolian",
"chords": [5, 3, 0, 4],
"barsPerChord": 2,
"lead": "arp",
"breakdownLead": "theremin",
"comp": "saw",
"bass": "roll",
"swing": 0.007,
"critters": ["gull", "cuckoo", "whale"],
"flourishes": ["reverse", "twinkle", "glitter"]
}KRAX 92.3 FM
Rave Signal 92
"Study in Deep Field" by Tidal Lock
{
"style": "rave92",
"bpm": 140,
"key": "F# ionian",
"chords": [0, 2, 1, 2],
"barsPerChord": 1,
"lead": "piano",
"breakdownLead": "hoover",
"comp": "piano",
"bass": "sub",
"swing": 0.004,
"critters": ["moo", "frogs"],
"flourishes": ["glitter", "twinkle", "riser"]
}WRAX 98.5 FM
Warehouse Party
"Луна (Moon) (Long Exposure Mix)" by Saoirse Lune
{
"style": "chicago",
"bpm": 121,
"key": "C# ionian",
"chords": [0, 5, 4, 0],
"barsPerChord": 2,
"lead": "choir",
"breakdownLead": "piano",
"comp": "piano",
"bass": "warm",
"swing": 0.141,
"critters": ["moo", "crickets"],
"flourishes": ["comet", "spinback", "zap"]
}WRAX 97.5 FM
Pirate 2-Step FM
"After Enceladus" by Mira Achterberg
{
"style": "twostep",
"bpm": 136,
"key": "C# aeolian",
"chords": [0, 2, 5, 1],
"barsPerChord": 1,
"lead": "vox",
"breakdownLead": "vibes",
"comp": "rhodes",
"bass": "wob",
"swing": 0.257,
"critters": ["crickets"],
"flourishes": ["comet", "harp", "shaker"]
}WRAX 94.7 FM
Radio Caliente
"Пустота" by Halden Takahara & Occultation
{
"style": "salsa",
"bpm": 99,
"key": "A ionian",
"chords": [0, 3, 4, 3],
"barsPerChord": 1,
"lead": "trumpet",
"breakdownLead": "flute",
"comp": "montuno",
"bass": "tumbao",
"swing": 0.017,
"critters": ["rooster", "dolphin"],
"flourishes": ["reverse", "twinkle", "spinback"]
}KRAX 91.5 FM
Thrash Forge 666
"After a Dying Star" by Наталья Морозова
{
"style": "speedm",
"bpm": 160,
"key": "F# dorian",
"chords": [0, 0, 6, 5],
"barsPerChord": 2,
"lead": "shred",
"breakdownLead": "shred",
"comp": "gallop",
"bass": "dist",
"swing": 0.003,
"critters": ["kookaburra"],
"flourishes": ["bubbles", "reverse", "musicbox"]
}WRAX 101.1 FM
Echo Chamber Dub
"Elegy for Voyager" by Квартет «Горизонт»
{
"style": "steppers",
"bpm": 77,
"key": "G phrygian",
"chords": [0, 0, 3, 3],
"barsPerChord": 2,
"lead": "melodica",
"breakdownLead": "theremin",
"comp": "skank",
"bass": "dubsub",
"swing": 0.088,
"critters": ["loon"],
"flourishes": ["glitter", "zap", "comet"]
}KRAX 96.5 FM
Eyeliner FM
"Light from the Pale Blue Dot" by Ольга Волкова & The Kuiper Belt Orchestra
{
"style": "emopop",
"bpm": 161,
"key": "B ionian",
"chords": [0, 4, 0, 5],
"barsPerChord": 2,
"lead": "crunch",
"breakdownLead": "vox",
"comp": "crunch",
"bass": "eighths",
"swing": 0.008,
"critters": ["kookaburra"],
"flourishes": ["shaker", "comet", "reverse"]
}KRAX 102.5 FM
Fogbound FM
"Light from Voyager" by Adaeze Brandt
{
"style": "darkhop",
"bpm": 82,
"key": "F aeolian",
"chords": [0, 3, 0, 6],
"barsPerChord": 2,
"lead": "vox",
"breakdownLead": "theremin",
"comp": "harpsi",
"bass": "deep",
"swing": 0.119,
"critters": ["cicada", "moo"],
"flourishes": ["spinback", "shaker", "riser"]
}KRAX 99.7 FM
Jungle Pressure FM
"Холод (Cold) (Remastered from Telemetry)" by Михаил Белов
{
"style": "darkstep",
"bpm": 175,
"key": "B aeolian",
"chords": [5, 4, 0, 1],
"barsPerChord": 2,
"lead": "theremin",
"breakdownLead": "stab",
"comp": "pad",
"bass": "reese",
"swing": 0.001,
"critters": ["wolf", "whale"],
"flourishes": ["harp", "shaker", "glitter"]
}♪How the sounds are made: no samples
There are no recordings in the music. Every note, drum hit and animal call is built from scratch by your browser's audio engine (Web Audio) out of five basic parts, wired into different instruments.
Oscillators
The raw tones: sine (pure), triangle (soft), square (hollow) and sawtooth (buzzy) waves
Noise
White noise, the source for hi-hats, snares, shakers, breath and wind
Filters
Shape the tone: darker, brighter, nasal, or tuned to a vowel
Envelopes
How fast each sound starts, how long it holds and how it fades
Wobblers
Slow oscillators that bend pitch or volume: vibrato and tremolo
The instruments
- Bass
- One sine or triangle wave through a low-pass filter that closes quickly, for a soft thump that settles into a hum.
- Sax, violin, horn
- A sawtooth wave (buzzy, like a reed or a bow) with vibrato that fades in. What tells them apart is mostly how each note starts: a violin swells in, a trumpet snaps.
- Choir
- Two slightly detuned sawtooth waves through filters set where a human mouth resonates for an "ah" vowel.
- Theremin
- A pure sine wave with wide, fast vibrato that glides from the last note into the next.
- Music box, celesta
- A few sine waves stacked at the odd, slightly out-of-tune overtones a metal tine makes, each dying away at its own speed: the "ting".
- Kalimba, marimba, vibes
- The same idea with different overtone ratios, which is what makes wood sound different from metal.
- Plucked guitar
- A classic trick: a burst of noise fed through a tiny repeating loop rings like a string.
- Drums
- A kick is a sine wave that drops sharply in pitch. A snare is a short tone plus a burst of filtered noise. Hi-hats are noise with only the top end left.
- The break engine
- Jungle is built from chopped drum breaks, and so is this, without a single sample. The game first plays three classic-style breaks on a detailed drum kit (layered kick, two-tone snare, metallic ride and tambourine, a small room, bus compression and saturation, human timing) and records each once. Then it chops them like a producer: slices re-ordered, stuttered, reversed and re-pitched, resampled to the song's tempo, which gives jungle its pitched-up crackle. Trip hop plays a dusty, low-passed break at its own slow tempo.
- FM synthesis
- The DX7 trick: one oscillator wobbles another's pitch. Moving the depth makes jump-up's growling "wub" bass, metallic stabs and the bell-like e-piano in trip hop.
- Ragga and jump up extras
- An overdriven 808 boom, offbeat skanks, toaster vocal chops, "pull up" laser shots, tape rewinds, sirens and air horns; for jump up, a hoover lead of detuned saws that dips in pitch.
- Acid line
- A buzzy wave through a resonant filter that sweeps on accented steps, with notes sliding into each other: the classic 303 squelch.
- Animal calls
- The same parts with pitch sweeps. A wolf rises, holds and falls with a breathy edge; crickets are fast high chirps; a whale is a slow, low glide. Every call is retuned to the current chord so it fits the song.
- Thrash guitars
- Two detuned sawtooth waves through a wave-shaper that clips them hard (the "amp"), then a speaker-cabinet filter. Short notes are palm-muted chugs; open power chords add the fifth and octave. The solo bends between notes with wide vibrato.
- Accordion, melodica
- Free reeds: two or three slightly detuned oscillators through a body filter, with a gentle wobble. Accordion for cumbia, melodica for dub.
- Garage vocal chops
- No singer: a buzzy tone through two vowel filters that slide from "oh" to "ah" or "yeah", cut short and stuttered like a sampler chop.
- Dub echo
- A tape-style echo: each repeat runs through a filter that gets darker, so skanks, snares and sirens thrown into it trail away into the distance.
- Latin percussion
- Clave, congas, cowbell, timbale shell and maracas: short pitched thumps and filtered noise, played in the son clave and tumbao patterns. The güiro is noise scraped long-short.
- Hi-hats
- Six square waves at clashing, out-of-tune pitches (the classic drum-machine recipe) blended with noise, so hats shimmer like metal instead of hissing.
- The mix
- Every stem goes through its own channel strip: a low cut so only the bass and kick own the low end, a tidy-up EQ, gentle tape-style warmth, light compression and a touch of air. Pads and strings get their own bus that clears out the muddy low mids, and the drums are softened at the attack and in the 3–4 kHz bite so kicks and snares hit firmly without snapping. A seeded hall reverb (early reflections, then a tail that darkens as it fades) and a ping-pong echo add space, and each oscillator drifts a few cents like real analog hardware.
- Tuning static
- Filtered noise between stations, generated too.
What is a recording
Only the radio hosts and adverts: short voice lines made with Kokoro, a free text-to-speech voice model, about 15 KB each and fetched only when a line is about to be said. Everything else, including each planet's own song, is composed live.
Every planet has its own song
With the radio off, the world plays its own tune. The planet's seed picks one of three mellow stations (ambient, pop or jazz) at random and a song of its own, using exactly the same recipe as the radio. It's a short loop of four stems (bed, drums, lead, light percussion) that starts the moment the bed is rendered, often while you're still warping in. Its title and artist are never shown: it's simply that planet's song, and it's the same tune every time you come back.
2The stems: rendered once
The recipe becomes nine 8-bar layers, each rendered a single time at 24 kHz by the browser's offline audio renderer, in slices between game frames. Each takes about 0.3–1.8 seconds.
- bed A
- bed B
- drums
- light percussion
- lead A
- lead B
- breakdown lead
- effects A
- effects B
3The arrangement: five minutes from nine buffers
A second seed decides which stems play in each 8-bar section. After the first few seconds nothing more is rendered; the next song's opening is prepared while this one plays out.
- Introbed A, light percussion
- Versebed, drums, lead B
- Versebed, drums, lead A
- Breakdownbed, light percussion, breakdown lead
- Versebed B, drums, lead B
- … 5 minthen the next song
4On air
Its own audio engine
A separate audio context with a limiter, so game sounds and lasers can't stall the music
Your EQ
Five bands from 60 Hz to 12 kHz on the music; hosts and adverts stay clear of it
Hosts and ads
Recorded voices with accents, about 15 KB a line, fetched only when a line is about to be said
The Beat-sync laser reads the same grid
Songs start on a known audio time, so the beat grid is exact. On the seven dance stations, laser pulses land on the 16ths, triplets or offbeats and play chord stabs in the song's key.
0 KBmusic downloaded
16stations on every world
9stems per song, rendered once
5 minper song, then a new seed
</>The code
The real functions from the game, unedited. r() is the song's random generator: each call is one roll of the dice, and pick(list) picks from a list with one roll.
radioStation() The seeds: one station, one song window
function radioStation(p, genre, win = radioWin() + (RAD.songOff || 0)){
const gs = genre === 'ambient' ? 0 : genre === 'jazz' ? 0x1A22 : genre === 'pop' ? 0x5A7E : genre === 'dnb' ? 0xD7B : genre === 'techno' ? 0x7EC4 : genre === 'trance' ? 0x7A2C : genre === 'rave' ? 0x9A7E : genre === 'warehouse' ? 0xA4E5 : genre === 'house' ? 0x40C5 : genre === 'garage' ? 0x2575 : genre === 'latin' ? 0x1A71 : genre === 'metal' ? 0x3E7A : genre === 'dub' ? 0xD0B : genre === 'emo' ? 0xE307 : genre === 'triphop' ? 0x7121 : 0x0BE2A, id = mulberry32((p.seed ^ 0xA11B1E ^ gs) >>> 0);
const letters = (p.name.replace(/[^A-Za-z]/g, '').toUpperCase() + 'XYZQ').slice(0, 3);
const freq = (88.1 + Math.floor(id() * 100) * 0.2).toFixed(1), callK = id() < 0.5 ? 'K' : 'W', home = id(); // the station's identity never changes
// the song: world seed mixed with the current tick window, so each station plays a new track every window
const r = mulberry32((p.seed ^ gs ^ Math.imul(win + 1, 0x9E3779B1)) >>> 0), pick = a => a[Math.floor(r() * a.length)];
const modeName = pick(['ionian', 'lydian', 'lydian', 'dorian', 'mixolydian', 'aeolian']); // consonant modes only: no clashing scales
const st = {
genre, pid: p.id, world: p.name, call: callK + letters, freq, win, track: (win % 1000) + 1, win,
bpm: pick([40, 45, 45, 50]), key: Math.floor(r() * 9) - 4, keyR: (((p.seed ^ gs ^ Math.imul(win + 3, 0x2C1B3C6D)) >>> 0) % 12), modeName, mode: MODES[modeName], prog: pick(PROGS),
pad: pick(['glass', 'warm', 'choir', 'hollow']), bright: 0.7 + r() * 0.6, detune: 3 + r() * 4,
bells: r() < 0.85, arp: r() < 0.5, wind: r() < 0.5, drone: r() < 0.85, sub: r() < 0.7, shimmer: r() < 0.7, sparkle: 0.5 + r() * 0.5,
// the melody uses chord tones on the strong steps and only steps between them on the weak ones, so it never clashes
motif: Array.from({ length: 8 }, (_, i) => r() < (i % 2 ? 0.45 : 0.2) ? null : i % 2 ? pick([0, 2, 4, 7, 1, 3]) : pick([0, 2, 4, 7, 9])), motifOct: pick([1, 1, 2]),
rng: mulberry32((p.seed ^ 0x5EC7 ^ win ^ gs) >>> 0), rseed: (p.seed ^ 0x5EC7 ^ win ^ Math.imul(gs, 0x9E37)) >>> 0, arrSeed: (p.seed ^ 0xA77 ^ gs ^ Math.imul(win + 7, 0x85EBCA6B)) >>> 0, homeKey: Math.floor(home * 9) - 4
};
st.exotic = r() < 0.12; // a rare "deep cut": extra shimmer and a long, slow lydian float
if (st.exotic) { st.mode = MODES.lydian; st.modeName = 'deep-space lydian'; st.shimmer = true; st.sparkle = 1; st.bpm = 40; }
st.key = st.keyR > 6 ? st.keyR - 12 : st.keyR; // every song its own key, spread over all twelve
{ const r2 = mulberry32((st.rseed ^ 0x5EED17) >>> 0), pk = xs => xs[Math.floor(r2() * xs.length)]; // ambient variety: generated progressions and pad voicings
if (r2() < 0.5) st.prog = genProg(r2, pk, /aeolian|phrygian|dorian/.test(st.modeName));
st.padVoc = pk([[[0, 0, -0.45], [4, 0, 0.45], [2, 1, -0.2], [8, 1, 0.25]], [[0, 0, -0.45], [1, 0, 0.45], [4, 0, -0.2], [7, 0, 0.25]], [[0, 0, -0.45], [4, 0, 0.45], [6, 0, -0.2], [9, 0, 0.25]],
[[0, 0, -0.45], [3, 0, 0.45], [4, 0, -0.2], [9, 0, 0.25]], [[2, 0, -0.45], [4, 0, 0.45], [7, 0, -0.2], [9, 1, 0.25]], [[0, 0, -0.45], [4, 0, 0.45], [7, 0, -0.2], [11, 0, 0.25]]]); }
radioGroove(st, r, pick);
st.keyName = ['C', 'C#', 'D', 'Eb', 'E', 'F', 'F#', 'G', 'Ab', 'A', 'Bb', 'B'][(st.key + 12) % 12];
return st;
}GENRE_STYLES The style dice: weighted per station
const GENRE_STYLES = { triphop: { triphop: 60, darkhop: 40 }, emo: { emopop: 45, midwest: 35, emoballad: 20 }, garage: { twostep: 65, speedg: 35 }, latin: { salsa: 40, reggaeton: 30, cumbia: 30 }, metal: { thrash: 60, speedm: 40 }, dub: { onedrop: 55, steppers: 45 }, trance: { uplifting: 55, psy: 45 }, rave: { rave92: 55, hardhouse: 45 }, warehouse: { acidhouse: 35, chicago: 30, garage: 35 }, techno: { minimal: 35, peak: 35, acid: 30 }, house: { deep: 50, soulful: 25, lofi: 25 }, dnb: { jungle: 30, ragga: 22, jumpup: 20, darkstep: 22, liquid: 6 }, ambient: { ambient: 70, musicbox: 30 }, pop: { village: 55, highlife: 45 }, jazz: { swing: 35, ballad: 25, lounge: 20, bossa: 20 }, opera: { heroic: 30, tragic: 25, majestic: 25, hymn: 20 } };STYLES What each style can roll
const STYLES = {
village: { w: 30, bpm: [96, 126], modes: ['ionian', 'ionian', 'lydian', 'mixolydian'], cb: 1, swing: [0.08, 0.2], lead: ['flute', 'ocarina', 'whistle', 'xylo', 'kalimba', 'steel', 'pluck', 'clarinet'], comp: ['uke', 'uke', 'piano'], bass: ['pluck', 'tuba', 'round'], name: 'village' },
highlife: { w: 24, bpm: [104, 126], modes: ['ionian', 'mixolydian', 'mixolydian'], cb: 1, swing: [0, 0.06], lead: ['guitar', 'kalimba', 'flute', 'marimba', 'kalimba'], comp: ['guitar2'], bass: ['pluck', 'round'], name: 'highlife' },
musicbox: { w: 14, bpm: [70, 92], modes: ['ionian', 'lydian'], cb: 2, swing: [0, 0.08], lead: ['musicbox', 'celesta', 'kalimba', 'vibes'], comp: ['harp'], bass: ['round'], name: 'music box' },
bossa: { w: 12, bpm: [84, 104], modes: ['ionian', 'dorian', 'lydian'], cb: 2, swing: [0, 0.04], lead: ['flute', 'vibes', 'nylon', 'whistle'], comp: ['nylon'], bass: ['round', 'pluck'], name: 'bossa' },
ambient: { w: 20 },
// Space Jazz
swing: { bpm: [116, 160], modes: ['ionian', 'dorian'], cb: 1, swing: [0.2, 0.26], lead: ['sax', 'trumpet', 'vibes'], comp: ['rhodes'], bass: ['pluck'], name: 'swing', jazz: true },
ballad: { bpm: [60, 76], modes: ['ionian', 'dorian', 'lydian'], cb: 2, swing: [0.14, 0.2], lead: ['sax', 'trumpet', 'flute'], comp: ['rhodes'], bass: ['round'], name: 'smoky ballad', jazz: true },
lounge: { bpm: [96, 116], modes: ['lydian', 'ionian', 'mixolydian'], cb: 1, swing: [0.06, 0.12], lead: ['theremin', 'vibes', 'flute'], comp: ['rhodes'], bass: ['round'], name: 'space-age lounge', jazz: true },
// Space Opera
heroic: { bpm: [96, 112], modes: ['ionian', 'mixolydian'], cb: 2, swing: [0, 0.02], lead: ['violin', 'horn'], comp: ['strings'], bass: ['round'], name: 'heroic march', orch: true },
tragic: { bpm: [58, 72], modes: ['aeolian', 'dorian'], cb: 2, swing: [0, 0.02], lead: ['violin', 'choir'], comp: ['strings'], bass: ['round'], name: 'tragic aria', orch: true },
majestic: { bpm: [66, 84], modes: ['lydian', 'ionian'], cb: 2, swing: [0, 0.02], lead: ['horn', 'violin'], comp: ['strings'], bass: ['round'], name: 'majestic overture', orch: true },
// Jungle Pressure FM
jungle: { bpm: [160, 170], modes: ['aeolian', 'phrygian', 'aeolian', 'dorian'], cb: 2, swing: [0, 0.03], lead: ['stab', 'stab', 'theremin'], comp: ['dark'], bass: ['sub'], name: 'amen jungle', brk: 'jungle' },
ragga: { bpm: [162, 172], modes: ['aeolian', 'dorian', 'phrygian'], cb: 2, swing: [0, 0.03], lead: ['toast', 'toast', 'stab'], comp: ['skank'], bass: ['boom'], name: 'ragga jungle', brk: 'ragga' },
jumpup: { bpm: [172, 176], modes: ['aeolian', 'phrygian', 'dorian'], cb: 2, swing: [0, 0.01], lead: ['hoover', 'stab'], comp: ['none'], bass: ['wub'], name: 'jump up', brk: 'jumpup' },
triphop: { bpm: [84, 96], modes: ['aeolian', 'dorian', 'phrygian'], cb: 2, swing: [0.12, 0.2], lead: ['theremin', 'vox', 'trumpet'], comp: ['epiano'], bass: ['deep'], name: 'trip hop', brk: 'triphop' },
darkhop: { bpm: [74, 84], modes: ['phrygian', 'aeolian'], cb: 2, swing: [0.08, 0.16], lead: ['theremin', 'violin', 'vox'], comp: ['harpsi'], bass: ['deep'], name: 'dark trip hop', brk: 'darkhop' },
liquid: { bpm: [170, 176], modes: ['dorian', 'aeolian', 'dorian'], cb: 2, swing: [0, 0.02], lead: ['flute', 'vibes', 'pluck', 'kalimba'], comp: ['rhodes'], bass: ['sub'], name: 'liquid roller', dnb: true },
darkstep: { bpm: [172, 176], modes: ['phrygian', 'aeolian'], cb: 2, swing: [0, 0.01], lead: ['stab', 'theremin'], comp: ['pad'], bass: ['reese'], name: 'dark stepper', dnb: true },
// Bunker 138 (techno) and Deep House Lounge
minimal: { bpm: [126, 132], modes: ['aeolian', 'dorian', 'mixolydian', 'dorian'], cb: 4, swing: [0, 0.04], lead: ['stab', 'pluck'], comp: ['dub'], bass: ['roll'], name: 'minimal', four: 'techno' },
peak: { bpm: [132, 138], modes: ['phrygian', 'aeolian'], cb: 4, swing: [0, 0.02], lead: ['stab', 'theremin'], comp: ['dub'], bass: ['roll'], name: 'peak-time', four: 'techno' },
acid: { bpm: [128, 136], modes: ['aeolian', 'phrygian', 'dorian', 'mixolydian'], cb: 4, swing: [0, 0.05], lead: ['acid'], comp: ['dub'], bass: ['acid'], name: 'acid', four: 'techno' },
deep: { bpm: [118, 122], modes: ['dorian', 'aeolian', 'ionian', 'mixolydian', 'lydian'], cb: 2, swing: [0.08, 0.14], lead: ['vibes', 'flute', 'pluck'], comp: ['rhodes'], bass: ['warm'], name: 'deep house', four: 'house' },
soulful: { bpm: [120, 124], modes: ['ionian', 'dorian', 'mixolydian', 'lydian'], cb: 2, swing: [0.1, 0.16], lead: ['choir', 'sax', 'vibes'], comp: ['rhodes'], bass: ['warm'], name: 'soulful house', four: 'house' },
lofi: { bpm: [116, 120], modes: ['dorian', 'ionian', 'lydian', 'mixolydian'], cb: 2, swing: [0.14, 0.2], lead: ['kalimba', 'pluck', 'flute'], comp: ['rhodes'], bass: ['warm'], name: 'lo-fi house', four: 'house' },
// Hyperspace Trance, Rave Signal 92, Warehouse Party
uplifting: { bpm: [136, 140], modes: ['ionian', 'aeolian', 'lydian', 'mixolydian'], cb: 2, swing: [0, 0.01], lead: ['arp', 'theremin'], comp: ['saw'], bass: ['roll'], name: 'uplifting trance', four: 'trance' },
psy: { bpm: [142, 146], modes: ['phrygian', 'aeolian', 'dorian'], cb: 4, swing: [0, 0.01], lead: ['acid', 'arp'], comp: ['dub'], bass: ['gallop'], name: 'psytrance', four: 'trance' },
rave92: { bpm: [136, 142], modes: ['aeolian', 'mixolydian', 'dorian', 'ionian'], cb: 2, swing: [0, 0.03], lead: ['hoover', 'piano'], comp: ['piano'], bass: ['sub'], name: 'old-skool rave', four: 'rave' },
hardhouse: { bpm: [145, 150], modes: ['aeolian', 'mixolydian', 'phrygian'], cb: 2, swing: [0, 0.02], lead: ['hoover', 'stab'], comp: ['saw'], bass: ['donk'], name: 'hard house', four: 'rave' },
acidhouse: { bpm: [120, 126], modes: ['aeolian', 'dorian', 'mixolydian'], cb: 2, swing: [0.04, 0.1], lead: ['acid'], comp: ['piano'], bass: ['acid'], name: 'acid house', four: 'warehouse' },
chicago: { bpm: [120, 124], modes: ['dorian', 'mixolydian', 'ionian'], cb: 2, swing: [0.1, 0.16], lead: ['sax', 'choir', 'piano'], comp: ['piano'], bass: ['warm'], name: 'Chicago jacker', four: 'warehouse' },
garage: { bpm: [130, 134], modes: ['dorian', 'ionian', 'aeolian', 'lydian'], cb: 2, swing: [0.18, 0.24], lead: ['pluck', 'vibes', 'choir'], comp: ['rhodes'], bass: ['warm'], name: 'UK garage', four: 'warehouse', twostep: true },
// Pirate 2-Step FM, Radio Caliente, Thrash Forge 666, Echo Chamber Dub (drawn by xBar)
twostep: { bpm: [130, 136], modes: ['dorian', 'aeolian', 'ionian', 'mixolydian'], cb: 2, swing: [0.2, 0.26], lead: ['vox', 'vibes', 'pluck'], comp: ['organ', 'rhodes'], bass: ['wob', 'sub'], name: '2-step garage', x: 'garage' },
speedg: { bpm: [128, 132], modes: ['aeolian', 'dorian', 'phrygian'], cb: 2, swing: [0.12, 0.18], lead: ['vox', 'stab'], comp: ['organ'], bass: ['warp'], name: 'speed garage', x: 'garage' },
salsa: { bpm: [92, 100], modes: ['aeolian', 'dorian', 'ionian'], cb: 1, swing: [0, 0.02], lead: ['trumpet', 'flute', 'trumpet'], comp: ['montuno'], bass: ['tumbao'], name: 'salsa', x: 'latin' },
reggaeton:{ bpm: [88, 96], modes: ['aeolian', 'dorian', 'phrygian'], cb: 2, swing: [0, 0.03], lead: ['marimba', 'pluck', 'flute', 'nylon'], comp: ['dembow'], bass: ['808'], name: 'reggaeton', x: 'latin' },
cumbia: { bpm: [88, 100], modes: ['ionian', 'mixolydian', 'aeolian', 'dorian'], cb: 1, swing: [0.02, 0.06], lead: ['accordion', 'accordion', 'flute'], comp: ['offbeat'], bass: ['cumbia'], name: 'cumbia', x: 'latin' },
thrash: { bpm: [176, 200], modes: ['phrygian', 'aeolian', 'phrygian'], cb: 2, swing: [0, 0.01], lead: ['shred', 'shred'], comp: ['chug'], bass: ['dist'], name: 'thrash', x: 'metal' },
speedm: { bpm: [150, 168], modes: ['aeolian', 'phrygian', 'dorian'], cb: 2, swing: [0, 0.01], lead: ['shred'], comp: ['gallop'], bass: ['dist'], name: 'speed metal', x: 'metal' },
onedrop: { bpm: [66, 76], modes: ['aeolian', 'dorian', 'mixolydian'], cb: 2, swing: [0.14, 0.22], lead: ['melodica', 'melodica', 'horn'], comp: ['skank'], bass: ['dubsub'], name: 'one-drop dub', x: 'dub' },
steppers: { bpm: [72, 80], modes: ['aeolian', 'dorian', 'phrygian'], cb: 2, swing: [0.06, 0.14], lead: ['melodica', 'theremin'], comp: ['skank'], bass: ['dubsub'], name: 'steppers dub', x: 'dub' },
emopop: { bpm: [150, 176], modes: ['ionian', 'aeolian', 'ionian', 'dorian'], cb: 1, swing: [0, 0.01], lead: ['vox', 'crunch'], comp: ['crunch'], bass: ['eighths'], name: 'emo pop-punk', x: 'emo' },
midwest: { bpm: [124, 140], modes: ['ionian', 'lydian', 'dorian', 'mixolydian'], cb: 1, swing: [0, 0.02], lead: ['twinkle', 'twinkle', 'vox'], comp: ['clean'], bass: ['melodic'], name: 'Midwest emo', x: 'emo' },
emoballad:{ bpm: [68, 80], modes: ['aeolian', 'ionian', 'dorian'], cb: 2, swing: [0.02, 0.06], lead: ['vox', 'violin'], comp: ['strum'], bass: ['round'], name: 'acoustic emo ballad', x: 'emo' },
hymn: { bpm: [52, 64], modes: ['dorian', 'aeolian', 'lydian'], cb: 2, swing: [0, 0.02], lead: ['choir', 'violin'], comp: ['strings'], bass: ['round'], name: 'alien hymn', orch: true }
};radioStyle() Rolling the style, melody and kit
function radioStyle(st, r, pick){
const W = GENRE_STYLES[st.genre] || GENRE_STYLES.ambient;
if (st.exotic && st.genre === 'ambient') { st.style = 'ambient'; st.cb = 2; return; }
let tot = 0; for (const k in W) tot += W[k]; let x = r() * tot, sk = 'ambient';
for (const k in W) { x -= W[k]; if (x < 0) { sk = k; break; } }
st.style = sk; st.cb = 2; if (sk === 'ambient') return;
const Y = STYLES[sk]; st.exotic = false;
st.modeName = pick(Y.modes); st.mode = MODES[st.modeName]; st.prog = Y.jazz ? pick(JAZZ_PROGS) : Y.orch ? pick(OPERA_PROGS[sk]) : Y.dnb || (Y.brk && Y.brk !== 'triphop' && Y.brk !== 'darkhop') ? pick(DNB_PROGS) : Y.brk ? pick(X_PROGS.triphop) : Y.four ? pick(FOUR_PROGS[Y.four]) : Y.x ? pick(X_PROGS[Y.x]) : pick(CHEER); st.cb = Y.cb; st.jazz = !!Y.jazz; st.orch = !!Y.orch || !!Y.dnb || !!Y.four || !!Y.x || !!Y.brk; st.x = Y.x || null; st.brk = Y.brk || null; st.dnb = !!Y.dnb; st.four = Y.four || null;
if (!Y.jazz && !Y.orch && r() < 0.55) st.prog = genProg(r, pick, /aeolian|phrygian|dorian/.test(st.modeName));
if (!Y.jazz && !Y.orch && r() < 0.25) st.cb = st.cb === 1 ? 2 : 1;
st.voc3 = pick(VOICINGS); st.voc2 = st.voc3.map(([d, o]) => [d, o]);
st.bpm = Y.bpm[0] + Math.floor(r() * (Y.bpm[1] - Y.bpm[0] + 1)); st.swing = Y.swing[0] + r() * (Y.swing[1] - Y.swing[0]); st.grooveName = Y.name;
st.drone = false; st.wind = false; st.shimmer = false; st.sparkle = 0.35 + r() * 0.3; st.fast = false;
st.lead = pick(Y.lead); const l2 = Y.lead.filter(x2 => x2 !== st.lead); st.lead2 = l2.length ? pick(l2) : st.lead;
st.comp = pick(Y.comp); st.bassK = pick(Y.bass); st.leadOct = st.lead === 'whistle' || st.lead === 'musicbox' || st.lead === 'celesta' ? 2 : 1; st.seventh = Y.jazz || r() < 0.4;
st.critterRate *= 0.6;
// the melody: A, A' (new ending), B, A with a cadence onto the root
{ const M = makeMelody(r, pick); st.mel = M.mel; st.melShape = M.shape + '/' + M.rk; }
// kits
const E = euclid, at = (...xs) => Array.from({ length: 16 }, (_, i) => xs.includes(i));
if (sk === 'village') { st.kit = { kick: pick(['soft', 'soft', 'none']), snare: pick(['rim', 'snap', 'rim']), hat: 'shaker', hand: pick(['none', 'none', 'conga']), mallet: 'none', bell: 'none' };
st.pat.kick = at(0, 8, ...(r() < 0.4 ? [10] : [])); st.pat.snare = at(4, 12); st.pat.hat = E(8, 16); }
else if (sk === 'highlife') { st.kit = { kick: 'soft', snare: pick(['none', 'rim']), hat: 'shaker', hand: pick(['conga', 'djembe', 'djembe']), mallet: 'none', bell: 'agogo' };
st.pat.kick = at(0, 6, 10); st.pat.snare = at(4, 12); st.pat.hat = E(12, 16, 1); st.pat.hand = E(pick([5, 7]), 16, Math.floor(r() * 3)); st.pat.bell = at(0, 3, 5, 7, 9, 12, 15); }
else if (Y.jazz && sk !== 'bossa') { st.kit = { kick: 'feather', snare: 'brush', hat: 'pedal', hand: 'none', mallet: 'none', bell: 'none' };
st.pat.kick = sk === 'ballad' ? at(0, 8) : at(0, 4, 8, 12); st.pat.snare = sk === 'ballad' ? at(4, 12) : E(3, 16, 2 + Math.floor(r() * 4)); st.pat.hat = at(4, 12); }
else if (Y.four) { st.kit = { kick: 'none', snare: 'none', hat: 'none', hand: 'none', mallet: 'none', bell: 'none' }; st.pat.kick = []; st.pat.hat = [];
st.perc = E(pick([3, 5, 7]), 16, 1 + Math.floor(r() * 3)); st.chordPat = pick([[3, 11], [3, 10], [2, 7, 13], [0, 6, 12], [3, 6, 11, 14]]);
st.acidSeq = Array.from({ length: 16 }, (_, i) => r() < (i % 4 === 0 ? 0.9 : 0.6) ? { d: pick([0, 0, 0, 7, 2, 4, -2, 5]), oct: r() < 0.25 ? 1 : 0, acc: r() < 0.3, sl: r() < 0.2 } : null);
st.kickPat = Y.twostep ? at(0, 10) : null;
st.bassPat = sk === 'deep' || sk === 'lofi' ? pick([[3, 6, 10, 14], [2, 6, 10, 14], [3, 7, 11, 14]]) : pick([[2, 6, 10, 14], [3, 6, 10, 15], [2, 3, 6, 7, 10, 11, 14, 15]]); }
else if (Y.x) { st.kit = { kick: 'none', snare: 'none', hat: 'none', hand: 'none', mallet: 'none', bell: 'none' }; st.pat.kick = []; st.pat.hat = [];
st.chordPat = pick([[2, 6, 10, 14], [3, 6, 11, 14], [2, 7, 10, 15], [0, 3, 6, 10, 13]]);
st.bassLine = Array.from({ length: 16 }, (_, i) => r() < (i === 0 ? 1 : i % 4 === 0 ? 0.55 : i % 2 ? 0.3 : 0.4) ? pick([0, 0, 0, 4, 7, 5, 2, -1]) : null);
st.riff = Array.from({ length: 16 }, (_, i) => i % 4 === 0 || r() < 0.7 ? (r() < 0.22 ? { d: pick([0, 1, 4, 5, 6, 7]), pow: true } : { d: r() < 0.85 ? 0 : pick([1, 5, 6]), pow: false }) : null);
st.ghost = E(pick([5, 7]), 16, Math.floor(r() * 4)); st.throwRate = 0.3 + r() * 0.35; st.guiro = r() < 0.5; st.vocal = pick(['oh', 'yeah', 'ah']); st.zoo = Y.x === 'dub' ? ['birds', 'frogs', 'parrot'] : null; if (Y.x === 'emo') st.vocal = pick(['oh', 'ah']); }
else if (Y.brk) { st.kit = { kick: 'none', snare: 'none', hat: 'none', hand: 'none', mallet: 'none', bell: 'none' }; st.pat.kick = []; st.pat.hat = [];
const B = Y.brk, slow = B === 'triphop' || B === 'darkhop';
st.brkKit = slow ? 'dusty' : B === 'jumpup' ? 'think' : 'amen'; st.brkAlt = slow ? 'dusty' : r() < 0.5 ? 'think' : 'amen';
st.brkPitch = slow ? 1 : 0.98 + r() * 0.08; st.chopRate = B === 'ragga' ? 0.26 : B === 'jungle' ? 0.32 : slow ? 0.05 : 0.08;
st.bassLine = Array.from({ length: 16 }, (_, i) => r() < (i === 0 ? 1 : i % 4 === 0 ? 0.5 : i % 2 ? 0.22 : 0.35) ? pick([0, 0, 0, 4, 5, 7, -1, 2]) : null);
st.horn = !slow && r() < 0.8; st.zoo = B === 'jungle' ? ['monkey', 'parrot', 'elephant', 'roar', 'frogs', 'birds'] : B === 'ragga' ? ['parrot', 'birds'] : null;
st.vocal = pick(['oh', 'yeah', 'ah']); st.wubRate = pick([2, 4, 4, 8]); st.scratch = slow && r() < 0.8; }
else if (Y.dnb) { st.kit = { kick: 'none', snare: 'none', hat: 'none', hand: 'none', mallet: 'none', bell: 'none' }; st.pat.kick = []; st.pat.hat = []; st.breaks = sk === 'liquid' ? [2, 3, 2, 3] : [0, 1, 0, 1].map(x => r() < 0.5 ? x : Math.floor(r() * BREAKS.length)); st.horn = sk !== 'liquid' && r() < 0.8; st.zoo = sk === 'jungle' ? ['monkey', 'parrot', 'elephant', 'roar', 'frogs', 'birds'] : sk === 'darkstep' ? ['roar', 'elephant'] : ['birds', 'parrot', 'frogs']; }
else if (Y.orch) { st.kit = { kick: 'none', snare: 'none', hat: 'none', hand: 'none', mallet: 'none', bell: 'none' }; st.pat.kick = []; st.pat.hat = []; st.march = sk === 'heroic'; }
else if (sk === 'musicbox') { st.kit = { kick: 'none', snare: 'none', hat: pick(['shaker', 'none']), hand: 'none', mallet: 'none', bell: 'none' }; st.pat.kick = []; st.pat.hat = E(4, 16); }
else { st.kit = { kick: 'soft', snare: 'rim', hat: 'tick', hand: 'none', mallet: 'none', bell: 'none' }; st.pat.kick = at(0, 6, 8, 14); st.pat.snare = at(0, 3, 6, 10, 13); st.pat.hat = E(16, 16); }
st.bell = st.kit.bell;
}radioGroove() Rolling the groove, patterns, creatures and flourishes
function radioGroove(st, r, pick){
const gk = st.exotic ? 'float' : pick(['float', 'downtempo', 'downtempo', 'dub', 'lilt', 'trip', 'skitter', 'tribal', 'swing']), G = GROOVES[gk];
st.groove = gk; st.grooveName = G.name; st.bpm = st.exotic ? 44 : G.bpm[0] + Math.floor(r() * (G.bpm[1] - G.bpm[0] + 1));
st.kit = { kick: pick(G.kick), snare: pick(G.snare), hat: pick(G.hat), hand: pick(G.hand), mallet: pick(['marimba', 'kalimba', 'steel', 'vibes', 'log', 'none']) };
st.swing = G.swing[0] + r() * (G.swing[1] - G.swing[0]); st.fast = !!G.fast;
const rot = () => Math.floor(r() * 4);
st.pat = {
kick: st.kit.kick === 'none' ? [] : euclid(pick([2, 3, 3, 4, 5]), 16),
snare: G.back === 'back' ? Array.from({ length: 16 }, (_, i) => i === 4 || i === 12) : G.back === 'half' ? Array.from({ length: 16 }, (_, i) => i === 8) : euclid(pick([3, 4, 5]), 16, 2 + rot()),
hat: euclid(pick([6, 8, 8, 11, 12, 16]), 16, rot()),
hand: euclid(pick([3, 5, 7, 9]), 16, rot()), handTone: Array.from({ length: 16 }, () => pick([0, 0, 1, 2])),
mallet: euclid(pick([3, 4, 5, 6, 7]), 16, rot()), malletDeg: Array.from({ length: 16 }, () => pick([0, 2, 4, 4, 7, 9]))
};
// melodic percussion plays a chord tone on its pattern; its line is rerolled each section for variety
st.flourishes = []; { const fp = FLOURISHES.slice(); for (let i = 0; i < 3; i++) st.flourishes.push(fp.splice(Math.floor(r() * fp.length), 1)[0]); }
const n = 1 + (r() < 0.5 ? 1 : 0) + (r() < 0.2 ? 1 : 0), pool = CRITTERS.slice(); st.critters = [];
for (let i = 0; i < n; i++) st.critters.push(pool.splice(Math.floor(r() * pool.length), 1)[0]);
st.critterRate = 0.12 + r() * 0.25; // chance per bar that something calls
st.flair = pick(['harp', 'chimes', 'drop', 'harp', 'chimes']); // the section-change flourish
radioStyle(st, r, pick);
}radioArr() The arrangement: which stems play when
function radioArr(st, sec){ // which stems play in each section: the song's arrangement, from its seed
const r = mulberry32((st.arrSeed + Math.imul(sec + 1, 7919)) >>> 0), v = r() < 0.5 ? 'A' : 'B', out = [];
const dark = st.genre === 'dnb' && st.style !== 'liquid', lc = dark ? 0.3 : 0.85; // Jungle Pressure: drums and bass first, leads only now and then
if (sec === 0) { out.push('bedA'); if (r() < 0.6) out.push('lite'); if (!dark && r() < 0.3) out.push('leadA'); out.push('fxA'); }
else if (sec % 4 === 3) out.push('bed' + v, 'lite', 'alt', 'fx' + v);
else { out.push('bed' + v, 'drums', 'fx' + (r() < 0.5 ? 'A' : 'B')); if (r() < lc) out.push(sec % 2 ? 'leadB' : 'leadA'); if (r() < 0.25) out.push('lite'); }
return out.filter(k => stemOk(st, k));
}Stations: Space Ambient · Planet Pop · Space Jazz · Space Opera · Bunker 138 · Deep House Lounge · Hyperspace Trance · Rave Signal 92 · Warehouse Party · Pirate 2-Step FM · Radio Caliente · Thrash Forge 666 · Echo Chamber Dub · Eyeliner FM · Fogbound FM · Jungle Pressure FM · Play the game