Code + music: In tune with each other
I've heard a lot of people say that music and coding have a lot in common.
On the surface, it makes a lot of sense. Musicians and programmers are both problem solvers, whether they're figuring out the best arrangement of chords or the best way to structure a website. Some solutions are clever, but don't scale well. Sometimes, it's smart to break the unspoken rules, but more often it pays to repeat the same handful of chord progressions or use a common programming framework.
The way musicians and programmers work are similar, too. Designing algorithms and composing melodies are often individual tasks, requiring focus and dozens (or more) of tedious iterations. Programmers and musicians also collaborate in teams, and must be able to tweak fine details while considering the big picture of their projects.
At the same time, I think the comparison might be a little bit of a stretch. When I thought about it some more, I realized that a lot of fields require collaboration, many more can be tedious, and anyone working towards a goal has to be a strategic problem solver.
The truth is that while music and coding aren't opposed to one another, they aren't necessarily similar either. Instead, they complement one another. Having experiences with one can help with the other, and you can even create great things when you try to bring them together.
Striking a chord: Learning code through music
How can we bring coding and music together?
In elementary school, my music teacher asked a question that stumped the whole class: ''What's the definition of music?'' After we unsuccessfully fumbled with words for a bit, he wrote a sentence on the board that's stuck with me ever since:
''Music is a collection of organized sounds.''
This definition was so simple, yet made so much sense!
Producing music is deeply creative and allows you to express your emotions and tell stories, but it's also extremely organized. You can tell if a chord will sound happy or sad based on the distance between the notes. Every note has a specific position in a song's timing — that's what makes a song you can tap your foot (or headbang) to.
Because of these systems, technology can be great for making music. Coding gives you the ability to be creative with sound. You can precisely adjust pitch and length, mix them together, and organize them to your liking.
Fun fact: Its sound library was created by Young Guru, Jay Z's sound engineer!
Finding harmony: Music-related coding projects
Creating music isn't the only thing you can do with tech, though. You can also incorporate music into your projects in other ways. Curious about what we mean? Here are a few examples available on Repl.it:
@JoannotFampionona built AutoMuSy and shared it on Repl Talk a few months ago. AutoMuSy is an online piano with mesmerizing interactive animations:
AutoMuSy is an online piano with interactive animations and lots of configuration options
@paulfears created a simple program that returns artists similar to the one you enter. Clocking in at fewer than 30 lines of code, it scrapes data from music-map.com using Python.
New Music Finder returns artists similar to the one you enter, letting you discover new artists
And as you might've already heard, Repl.it interns @jajoosam and @thesephist built lyrics.rip, which uses a Markov chain to generate lyrics in the style of any artist!
lyrics.rip generates lyrics in the style of any artist
Music isn't the only art that can inspire your code, but it's one I've been thinking about a lot lately. Feeling inspired? Try and incorporate some music into your code—just be sure to show us what you make!