DEV Community

Roberto Vega
Roberto Vega

Posted on

The Harmony of Code and Music: How The TB-303 Sequencing Mirrors Software Engineering

The worlds of electronic music production and software development have always been intertwined, but it took me way too long to catch on. Hopefully, this will help others in the same boat as me realize it a lot sooner than I did.

A Little Background

So, my programming journey began like many other millennials. It all started with CSS and HTML on Neopets and MySpace. Then, video game development became my main focus. But the real turning point came when I became a System Administrator. That's when I took a deep dive into Linux administration and discovered the world of Cloud Computing. Imagine going from working in a data center filled with servers to an office with none in sight. Over time, I blended my SysAdmin skills with coding, which led me down the DevOps rabbit hole. And let me tell you, the journey has been a wild ride, but I've loved every minute of it.

Me playing keytar in a band at a bar

I didn't really get into music until I was around twenty-five. I played the violin as a kid in elementary school, and I tried to learn guitar a few times, but I couldn't figure out barre chords and I kept giving up. But when I bought a drum set, that's when I really started to get interested in playing and making music. I taught myself how to play bass guitar, electric guitar, and keyboard. About two years ago, I got really interested in the production side of things. I had messed around with FL Studio (back when it was called Fruity Loops), but I never really did anything with it. Then I discovered the evil wonderful world of analog synthesizers, and I was hooked.

Different synthesizers on a desk

That brought back memories from my childhood. Remember listening to the soundtracks of Blade and Mortal Kombat? No? Just me? Well, that's how I fell in love with Acid House and Industrial Techno. A crucial instrument in those genres was the Roland TB-303. It was a bass synthesizer that everyone thought was a flop. But after it "failed," it became super popular in many genres.

The TB-303 is a tricky piece of gear, and everyone despised its built-in sequencer. However, once I approached it like a software application, everything clicked for me. That's what I want to talk about today: the intersection and similarities of the Roland TB-303 (or rather, its clone, the Behringer TD-3) and software engineering.

The TB-303 and its Sequencer

Before we dive in, I want to make it clear that I'll be talking about the Behringer TD-3, which is a clone of the Roland TB-303. The TD-3 is pretty much like the TB-303 in terms of workflow and features, but it has some extra stuff that a lot of people would love to have on their TB-303's.

So, I got my hands on my first TD-3 (I'm a bit of a collector, I've got a few different TB-303 clones too). I guess I was a bit naive, thinking I could just turn it on and start making techno music like a pro. Boy, was I wrong! The sequencer on this thing is way more complicated than I thought. I watched videos and read forums, and everyone was talking about how complex the synthesizer was. But I was determined to figure it out and start making some music with this awesome machine. There was a lot to learn before I could even start writing anything that wasn't, let's say, mediocre. I'm going to break down a few concepts of the TD-3 in a way that makes sense to me as a software engineer.

Meme of man poking a TD-3 with a stick saying c'mon do the techno thing

Notes and Melodies/Chords as Tokens and Expressions

Sheet music glowing white
In the world of music making, especially when you're working with a TD-3, notes are like the building blocks of a track. They're similar to tokens and expressions or statements in coding, which are the basic elements of a program. A token is the smallest part of a program, like a keyword, operator, or identifier. In the same way, a note is the smallest part of music. Each note, like a token, has its own meaning and purpose within the bigger picture.

In music, when you connect a series of notes, it forms a melody or a chord. It's similar to how we put tokens together to form expressions and statements in coding. Think of it this way, just like how an expression like x + y or a statement like if (x > y) controls the logic of a program, a sequence of notes creates a musical phrase or chord progression that drives the feels and rhythm of a track.

Picture this: a TD-3's six-step or five-step patterns are like short code snippets. Each note or step is like a command or operation. When these patterns loop, they build a complex and ever-changing soundscape, much like loops or functions in programming that create complex behavior from simple, repeated tasks.

Music production and programming are similar in that they both use these essential building blocks to create something amazing. In music, the mix of notes and chords creates harmony and rhythm, just like tokens and expressions combine to make useful, dynamic code. Whether you're making a track or writing a program, it's a creative process that involves carefully choosing and arranging these basic elements to get the result you want.

Patterns and Tracks as Functions and the Broader Application

TB-303 playing a pattern
Alright, so now that we've got these notes, which are basically like coding tokens, we can start to form our melody, or in other words, our statements or expressions. The next step is to put everything together in a way that makes sense, kind of like putting together a song or building an application.

Picture this: the TD-3's pattern and track modes are like functions in a program, and the entire song they create is like the program itself. In pattern mode, you're defining specific sequences of notes, just like individual functions in a program perform specific tasks. Each pattern is like its own musical phrase or idea.

When you switch to track mode, it's like arranging these patterns to make a complete song. It's similar to how you organize functions in a program to create the entire application. Each pattern adds its own unique part to the bigger picture, just like each function contributes to the overall program.

So, track mode is where everything comes together. It's where you sequence individual patterns to make a cohesive song or a fully functioning application. Just like in programming, where how functions interact determines how the program works, in music, how patterns interact and transition shapes the experience of the track.

And here's the cool part: just like functions can be reused in different parts of a program, patterns can be reused in different sections of a track. It's like maintaining a consistent theme while also allowing for variety and growth. This reusability is key in music production with the TD-3 and software development. It shows how thoughtful design and arrangement can make things more efficient and creative.

Putting the Application/Song Together

So, I hope I've helped you understand the similarities between making music with the TB-303, or any of its clones like the TD-3, and writing code.

Here is an example of an application in TypeScript. It’s a simple application where I have multiple functions to set a user’s name, get today’s date, string it all together in a line to greet the user and give the date.

// Function to get the user's name
function getUserName(): string {
    const userName: string = "Roberto"; // Hardcoding for example
    return userName;
}

// Function to get today's date
function getTodayDate(): string {
    const today: Date = new Date();
    return today.toDateString(); 
}

// Function to print the greeting message
function printGreeting(userName: string, date: string): void {
    console.log(`Hello ${userName}! Today is ${date}.`);
}

// Main function to execute the application logic
function main(): void {
    const userName: string = getUserName();
    const todayDate: string = getTodayDate();
    printGreeting(userName, todayDate);
}

// Execute the main function
main();
Enter fullscreen mode Exit fullscreen mode

Here’s an example of notes, forming patterns, to form a track or song. Imagine patterns 1-4 as the getUserName, getTodayDate, and printGreeting functions. We put all those functions together in the main function to form the sample application similar to how we put the patterns together to form the song.

Pattern 1:
A3 -> C4 -> E4 (A) -> A4 (S) -> G4 -> A4 -> E4 -> C4 (A)

Pattern 2:
E3 -> A3 (S) -> C4 (A) -> E4 -> G4 (S) -> A4 -> C5 -> G4 (A)

Pattern 3:
A3 -> E3 -> C4 (A) -> A4 (S) -> B4 -> E4 (A) -> G4 -> A4 (S)

Pattern 4:
A3 -> E4 -> C4 (A) -> B4 (S) -> G4 -> A4 (A) -> F4 -> C5 (S)

Track:
Pattern 1 -> Pattern 2 -> Pattern 1 -> Pattern 3 - > Pattern 1 -> Pattern 2 -> Pattern 1 -> Pattern 4
Enter fullscreen mode Exit fullscreen mode

In those pattern examples, the A's and S's stand for accents and slides (sometimes referred to as legato), respectively. They're like modifiers and operators.

Where a modifier like public, private, or readonly changes the behavior or emphasis of a particular code segment, an accent on the 303 alters the dynamic or intensity of a note.

Where an operator connects one operation to another such as the + in let sum = a + b; or the && in let isTrue = (a > b) && (b > 0); a slide connects one note to the next in a smooth transition.

Conclusion

Hopefully, I've managed to show you how coding and making music on the 303 are pretty similar. These ideas aren't just limited to the 303; they apply to a lot of other parts of making and writing music. The 303 was my first step into electronic music production, and linking it to programming finally made sense of it all, making it easier for me to make music on it.

Top comments (2)

Collapse
 
benstormer profile image
Benjamin Stormer

Hey Roberto, thanks for the article! I tried to get into FL Studio a few years ago, but never approached it as a software engineer. Maybe this approach would have yielded more luck for me!

Collapse
 
dev-rvega profile image
Roberto Vega

Definitely give it a try! Hopefully it works for you. And definitely share your music when you get something together. 🎶