I'm Building An NFT-Based Generative Music System

I'm Building An NFT-Based Generative Music System

Ok, I want to preface this by saying I'm kinda obsessed with electronic music. I love how it sits at the nexus of art and technology, how it's math brought to life as music.

I'm also fascinated by generative art. Generative art is art that celebrates a creative algorithm just as much as it celebrates a final visual / audio product. It's art where the artist sits down, spends time carefully crafting and creating an algorithm and then lets that algorithm create something of beauty. When you buy / appreciate generative art, you're buying both the final product and the underlying algorithm used to make it.

It's pretty common in the NFT space to see the term "generative NFT" batted around, and sure I guess they are all technically generative NFTs ... but honestly, most of them feel more like "randomized NFTs" to me. They've got randomized traits, but aren't really generative ... although maybe I'm splitting hairs here?

Anyway, back to my project.

I've had this idea to build a generative art system for a while. I wanted to create something where a single algorithm creates both audio and visuals. Instead of creating an audio-reactive visuals, I wanted to create everything all at once, all from the same algorithm. However, like many of the 11 billion ideas rattling around in my mind, it just kinda sat there collecting dust and occasional inspiration ... all up until I did this NFT Marketplace tutorial as part of the Alchemy Road To Web 3 program.

As I worked through the tutorial, it hit me that I could take my generative art project and combine it with NFTs to make something really unique.

To create the audio / visuals I wanted for my project, I would need to create an algorithm that feeds off a collection of colors and sound design. Sound Designers are the people who create the blips and bloops your phone makes, they make the sounds in video games, they make synth presets that are used by musicians. They don't normally have a direct to consumer relationship, their work is incorporated into projects by other creatives.

Most NFT projects celebrate the work of visual artists, I've started to see some new options for musicians to release their work as an NFT, but have yet to see anything focused on sound designers.

As I dug deeper into my idea, I decided to focus on creating something people could play with, could interact with and could also leave running in the background. I'd focus on creating an algorithm that generated peaceful, soothing music you could have running while coding, while designing, while relaxing with your computer.

Architecture.png

I sat down and started to sketch out an architecture. I had a rough idea in my head what sort of data I would need to store in the NFT, but knew it wouldn't fully gel until I had the generative system working. First I built a simple website in ReactJS, I chose this because I had been learning it over the last couple of weeks and because RainbowKit and the wagmi hooks make it so easy to interact with smart contracts (something I learned when building https://adams.exchange).

With the basics of the website down, I started to build the generative system. As I got deeper into my idea, I thought more and more about how to expand on the generative system. I would create an algorithm that would generate music using Tone.js, while simultaneously generating visuals using HTML Canvas animations I made myself. I decided to use the 2d physics engine Matter.js to handle animations and interactions and then let those interactions further modulate the visuals and audio.

Basically my goal would be to create an orgy of interactions. My basic algorithm interacted with the audio and visuals, then the visuals further interacted back with the algorithm. A fantastical orgy of components interacting with, modulating, changing and evolving each other.

Taking this orgy analogy a bit further, just how an orgy's host gets to pick who comes, in my system a user would decide which components to join together by buying different NFTs. An NFT would have a base color and then either a synth setting that would be plugged into a Tone.js synth or a collection of sound files used by Tone.js to create a sampler.

The system is about half done now, the website's there, it's generating music and visuals and I've created an on-chain NFT using Polygon.

I've still got lots to do, but should have an MVP ready by end of August 2022. I will be documenting and updating the project here and also on Twitter.

Talk soon.