If you haven't already, hit the button in the top right corner. That sound isn't a recording. It's being composed in real time by about 170 lines of JavaScript running in your browser.
I wanted give the site more prescence as it's a simple site where I imagine I will post infrequently. So to breath some life into this site I repurposed a generative ambient engine that I had made for a porfolio piece called Recursive Canvas- with some tweaked additions to differentiate from it's origin.
How it works
There's a pool of seven chords native to pop or lofi tunes for easy transitions. Each chord has a weight. When it's time to move on, the engine picks the next chord using weighted probability biased toward nearby harmonic neighbors. while close chords are more likely, distant leaps are rare but not impossible.
const weights = chords.map((chord, i) => {
const distance = Math.abs(i - current);
return chord.weight / (1 + distance * 0.3);
});
The result is a progression that provides a meditative drift that i was surprisingly delight by myself. It's enchanting to listen to and wait to hear what comes next. As someone who doesnt always compose with theory as the foremost framework for which you write the music, it's a pleasant reminder just how much math resides in its creation.
Two voices
A synth plays full chords through a slow 6 second attack. This is just a pure sine pad with a subtle vibrato LFO fading in over 8 seconds. A stereo widener opens up at the 6 second mark adding a bit more space to the mix. When the notes release, a dedicated reverb ramps to fully- sometimes creating anomolies that I decided not to clean up as I felt it added some character.
Sitting on top of that is a single voice arp. Using FM synthesis, triangle carrier with a sine modulator. It picks one note from the current chord, shifts it up two octaves. An LFO on the pitch kicks in almost immediately, giving each note a bit of movement.
Signal chain
Both voices signal chains feed into a master gain, then through a dotted-quarter feedback delay into a convolution reverb with 8-second decay:
pad → vibrato → stereoWidener → padReverb → master
arp → master
master → feedbackDelay → reverb → output
The pad reverb, widener, and vibrato all have time-scheduled parameter automation synced to the chord cycle.
Generative music bad?
With the advent of AI music inevitably creating an association with the term "generative music"- I feel the need to differential the two. But that will be for a later post.
Nonetheless, it felt right to have endless generative music for a site called Diatribe Machine. The machine never stops producing.