Sonic Pi - live coding practice

By Russell Barnes. Posted

Practice makes perfect and Sam Aaron has eight tips on how to do that

Last time, we took a look at five important techniques for mastering live coding; in other words, we explored how we could use Sonic Pi to approach code in the same way we would approach a musical instrument. One of the important concepts that we discussed was practice. This month, we’re going to take a deeper dive into understanding why live-coding practice is important and how you might start.

The full article can be found in The MagPi 50 and was written by Sam Aaron. You can also find out and learn more about Sonic Pi in our Sonic Pi Essentials book!

 Get the Sonic Pi essentials book to learn more about Sonic Pi

Practise regularly

The most important piece of advice is to make sure you practise regularly. Veterans typically practice for 1-2 hours a day, but 20 minutes is just fine when you’re starting out. Little but often is what you’re aiming for.

Tip #1 – start to develop a practice routine. Find a nice time in the day that works for you, and try to practise at that time as many days of the week as you can. Before long, you’ll be looking forward to your regular session.

Learn to touch-type

If you watch a professional musician performing on stage you’ll likely notice a few things. Firstly, when they play they don’t stare at their instrument. Their fingers, arms, and bodies know which keys to press, strings to pluck, or drums to hit without them having to think about it too much. This is known as ‘muscle memory’ and although it might sound like something only professionals can do, it’s just the same as when you first learned to walk or ride a bike: practising through repetition.

Tip #2 – learn how to touch-type. There are many apps, websites, and even games to help you achieve this. Find one you like the look of and stick at it until you can code without looking down.

Code whilst standing

The body of a musician is conditioned for playing their instrument. For example, a trumpet player needs to be able to blow hard, a guitar player needs to be able to grip the fretboard with strength, and a drummer needs to be able to continually hit the drums for long periods of time. So, what’s physical about live-coding? Just like DJs, live-coders typically perform standing up, and some even dance whilst they code! If you practise live-coding whilst sitting at a desk and then have to get up and stand at a gig, you’ll likely find the difference very difficult and frustrating.

Tip #3 – stand while you practise. The easiest way to do this is to use a standing height desk. However, if you don’t have one at home there are a couple of low-fi options, such as practising on an ironing board or with a keyboard on a stack of books. Make sure you stretch before you start practising, and try to maybe dance a little during the session.

Practise setting up

Most instruments require some assembly and tuning before they can be played. Unless you’re a rock star with a bus full of roadies, you’ll have to set up your own instrument before your gig. This is often a stressful time and it’s easy for problems to occur. One way to help with this is to incorporate the setup process into your practice sessions.

Tip #4 – treat setting up as an important part of your practice. Pack a box with all the performance essentials and put them together before each practice session. Once you’ve finished practising, take the time to carefully pack everything away afterwards. This may take some time at first, but with practice you’ll get faster.

Experiment musically

Once you’ve set up and are ready to start making music, you might find yourself struggling to know where to start. You might have a good idea of the kind of sounds you want to make, but are frustrated that you can’t produce them, or you don’t even know what kind of sound to make! Don’t worry: this is very common and happens to every musician, even if they’ve been practising for a long time. It’s much more important to be making sounds you don’t like than not making any sounds at all.

Tip #5 – spend time experimenting. Try to make time to explore new sounds and ideas. Don’t worry that it might sound terrible if it’s not the style you’re looking for. You’ll increase the chance of stumbling over a sound or combination of sounds which you love! Even if 99% of the sounds you make are bad, that 1% might be the riff or intro to your new track. Forget the things you don’t like and remember the parts you do. This is even easier when making music with code: just press Save!

Hear the code

Many musicians can look at a musical score and hear the music in their head without having to play it. This is a very useful skill and it’s well worth incorporating into your live-coding practice sessions, to have some understanding of what the code is going to sound like. You don’t need to be able to hear it exactly in your head, but it’s useful to know if the code is going to be fast, slow, loud, rhythmic, melodic, random, etc. The final goal is then to be able to reverse this process: to be able to hear music in your head and know what code to write to make it. It may take you a long time to master this, but once you do, you’ll be able to improvise on stage and express your ideas fluently.

Tip #6 – write some code into Sonic Pi, but don’t press Run. Instead, try to imagine what sound it’s going to produce. Then press Run, listen, and think about what you got right and what you didn’t. Keep repeating this until it becomes a natural part of your coding process. Even if you’re a veteran, you might be surprised occasionally, but it does let you learn new tricks.

Remove all distractions

A common problem when practising is to become distracted with other things. Practising is hard and requires real discipline, regardless of the kind of music you’re making. If you’re struggling to get started or make progress, it’s often too easy to hop on social media; if you’ve set yourself a target of 20 minutes of practice, it’s important to try to spend all that time being as productive as possible.

Tip #7 – before you start practising, remove as many distractions as possible. For example, disconnect from the internet, put your phone in another room, and try to practise in a quiet place where you’re unlikely to be disturbed.

Keep a practice diary

When you’re practising, you’ll often find your mind is full of new exciting ideas: new musical directions, new sounds to try out, new functions to write, etc. These ideas are often so interesting that you might stop what you’re doing and start working on the idea. This is another form of distraction!

Tip #8 – keep a practice diary by your keyboard. When you get an exciting new idea, pause your practice session, quickly jot the idea down, then carry on practising. You can then spend some quality time thinking about and working on your ideas after you’ve finished practising.

Bringing it all together

Try to establish a practice routine which incorporates as many of these ideas as possible. Keep the sessions as fun as possible, but be aware that some practice sessions will be hard and feel a little like work. However, it will all be worth it once you’ve created your first piece or given your first performance. Remember, practice is the key to success!

From The MagPi store

Subscribe

Subscribe to the newsletter

Get every issue delivered directly to your inbox and keep up to date with the latest news, offers, events, and more.