As a professional Java programmer who developed software for Yandex.Market and Deutsche Bank, my public role usually consists of speaking about Java at conferences. But aside from my professional career, I’m also a musician. I have been one since my childhood: I graduated from music school with a specialization in piano, then mastered the guitar and played in different amateur bands. Having gone further in pursuing my vocation and hobby, I came to realize that music and programming are very much alike.

What do programmers and musicians have in common?

Both music and programming are an art. Or, in other words, a type of activity that doesn’t imply one specific route to a successful result. There are no ready algorithms that would allow you to create a certain musical hit, in the same way that there are no ready algorithms that would allow you to create a bestselling game. Everything is much of a blur. Even the main literary reference for budding programmers was titled by its author Donald Knuth as The Art of Computer Programming. Although it’s stuffed with formulae, algorithms, and code, the name of the book implies that despite our attempts to formalize this field of activity, it remains highly ambiguous.

It would seem that the brains of musicians and programmers have to work differently because, roughly speaking, one half of the human brain is wired for creativity, and the other for algorithmic thinking. But once upon a time, a group of scientists decided to test that axiom in relation to musicians by putting sensors on their heads and asking them to play. What they discovered was that musicians activate both parts of the brain when performing. This was due to the fact that their kind is good with structures, and are always counting off rhythm to themselves and flexing their memory as a result.

Credit: shutterstock.com
Credit: shutterstock.com

Even musical notes and code are very similar in structure. Both programmers and composers write their ideas in the form of some language to then implement these with a computer or musical instrument. And later other people use these, if you will, scripts to repeat what was done.

The stages of creating a musical oeuvre and a video game are, too, not far from two peas in a pod. A person gets their eureka moment, then assembles a team, then seeks money from investors, having creating something small, a single or a demo. Having obtained the money, the group retreats to the studio or workplace to beaver away at their creation.

Finally, another similarity of musicians and programmers is that both groups put a premium on their working environment. We’re all extremely discerning as to whom we’ll be writing software or creating music with. At one of the companies I worked with, I worked with the same 16 people in the same room over the course of three years. Such a tight-knit environment created four couples, three of which got married later on. That’s how important the working environment is.

Common problems...

Imagine being led into a cabin of a modern jumbo jet and offered to fly it during a lengthy transatlantic flight. My guess is that you’d agree, but the bad news is that no one will let you into the pilot’s place unprepared: you’ll have to learn maths, physics, aerodynamics, psychology, leadership skills and many other things. Eight years after, if you manage to cram it all in, they’ll let you fly. In other words, to fly a jet, you’ll first have to study a lot of things not necessarily related to flights per se. You’ll be learning how to fly instead of flying.

This creates common problems for the fields of programming and music. People are not even thinking of trying to learn music or coding because of how difficult these are. You’d have to learn a ton of theory before being able to create something of your own.

Vladimir Krasilshchik's lecture
Vladimir Krasilshchik's lecture "Programming music with Sonic Pi"

And those who try, often give up very quickly. They just lose the motivation to plough on with the activity that, returning to our analogy, bears no direct relation to flying, and quit.

… and their solutions

You don’t have to tease people with showing them the cabin and then making them do unrelated tasks for years later; you have to give them the opportunity to play as early on as possible. Offer them to do something simple, to shorten the period of time from the start of the training to the first take-off. This will enable a person to more quickly decide whether they like the whole process or not.

Music and programming would also majorly benefit from introducing approaches that would allow people to get quicker first results and not give up. From my own experience, it was only in the fifth year of my studies at music school that I was able to master some pop ditty thing, play it to my classmates and get some kind of feedback along with motivation to continue learning. It was the same with programming: for three solid years, I was learning algorithms, data and everything else that non-programmers can’t see the importance of.

Sam Aaron. Credit: cc.au.dk
Sam Aaron. Credit: cc.au.dk

In 2016, when participating in a conference on Java, I met Sam Aaron, a prominent software developer and a self-proclaimed “computational thinker”. He came to St. Petersburg to demonstrate Sonic Pi, a software for music programming he developed. At the conference’s closing party, Sam was in charge of the music, DJ-ing in the course of two hours with Sonic Pi as the only tool. This was what prompted me to start learning this software.

About Sonic Pi

Sonic Pi is very close to a regular coding environment. In essence, it’s no more than a text editor that allows for programming of music by manipulating a set of notes played through specific interims. In fact, the latter is Sonic Pi’s main programmable aspect. You compose by writing either in musical gamut or the numerical order of piano keys, and can listen to your creation straight away after finishing.

The software allows to regulate a variety of features, from the duration of a sound to its variations and tempo. In addition, Sonic Pi can emulate the sounds of many musical instruments and samples, and lets you record your compositions in stereo.

Vladimir Krasilshchik
Vladimir Krasilshchik

Interdisciplinary approach

Which country’s educational system is best? This is one difficult question, but lately it’s Finland that gets the most of the plaudits. The country has recently banned all school subjects; students just come in to participate in projects, like preparing a special dish. In this they’re helped by different teachers, each covering the project in the context of their own specialization: where the ingredients are grown, on what kind of soil, when the dish was created, and what national cuisine it belongs to. As a result, kids obtain a significant amount of knowledge and skills in a range of fields, and learn to harness it in their work. It’s a modern interdisciplinary approach to education.

Sonic Pi employs the same interdisciplinary approach to teaching programming, music and acoustics. Users don’t just only write the code, but also listen to the direct result of their actions and take on the role of a real software developer.

The future of the software

Sonic Pi’s author Sam Aaron left his workplace at the University of Cambridge to dedicate all his time to the tool. He is currently continuing to improve the software, as well as using it to record music and preparing for the launch of his first album. Just recently, Sonic Pi has hit its first major milestone, having been brought to the Royal Albert Hall to play among an orchestra in a large-scale performance of Convo, an interactive piece by the acclaimed composer Charlotte Harding. The software’s fast-multiplying user base has set its own goal: to create a real orchestra made of different users and perform music simultaneously.

Vladimir Krasilshchik's lecture
Vladimir Krasilshchik's lecture "Programming music with Sonic Pi"

You can download Sonic Pi for free on its official website.