Assignment 10 - Sound Composition

I was hyped for this assignment because I love working with music. However, I ran into some troubles at first which is why I’m just now finishing it up. I originally recorded a song called “icm freestyle” that I wanted to include in the sketch and then use the p5 library to add distortion and filters, but I completely forgot about the 5mb limit. I wanted the composition to feel like a collaboration between the pre-recorded material and the sketch itself. I tried compressing it down, but anything aggressive enough to fit under the limit completely destroyed the mix. So “icm freestyle” never made it past my hard drive.

Next I tried using smaller audio files from my laptop - hits, vocal chops, ambient sounds. The plan was to trigger them sequentially and layer them into something compositional. Except the samples wouldn't play reliably. Some would trigger once and then refuse to fire again. Others would load but stay completely silent. The console kept throwing vague "undefined" errors that didn't point to anything specific. So I just resorted to the p5 library.

I ended up building something entirely generative using p5.sound's built-in synthesis tools - no external files, just oscillators and effects generating audio in real time. I referenced the p5.sound library documentation heavily and used some AI assistance (Claude) to help structure the ADSR envelopes and audio routing properly.

The piece runs on three layers: a sine wave bass tuned to minor pentatonic that pulses on downbeats, a triangle wave lead that plays melodic fragments with stereo panning and reverb, and white noise bursts shaped into hi-hat hits. I used p5.SoundLoop to create a 16-step sequencer, and added randomness in a few key places - the tempo drifts slightly every bar (104-120 BPM), the hats and lead notes trigger probabilistically instead of on a fixed grid, and the lead's volume slowly swells and fades using a sine wave modulation. All instructions live in the browser console. You click once to start audio, press space to pause/resume.

You can view the sketch here: https://editor.p5js.org/mmcclane1/sketches/-TFx6dhvU

You can view the sketch here: https://editor.p5js.org/mmcclane1/sketches/-TFx6dhvU