“Let it Go, Let it Go . . .” Some Raspberry Pi Music

test

Frozen - Let it Go on Raspberry PiAs some of you may be aware, when I’m not doing geeky things I am learning to play the piano. Having recently passed my Grade 3 exam I decided to work on something fun over the summer; so I chose ‘Let it Go’ from the Disney film Frozen in hope that this would win me some brownie points with my young nieces next time they visit!

Much to my delight, I also recently discovered a new piece of software on the Raspberry Pi, called Sonic Pi (I’m using V2.0). Brilliant! I can combine both my hobbies into one! After watching a lovely intro video by Carrie Anne Philbin and reading a few tutorials, I understood the idea of how it worked and decided to set myself a challenge! This was to construct ‘Let it Go’ within Sonic Pi and as it also allows multiple threads to run at once, I was able to put together both the left and right hand sections of the piece and I’m really pleased with the end result:

 

This was a nice task to complete as it enabled me to discover some of the key features of Sonic Pi such as:

  • Variables
  • Loops
  • Functions
  • Threads (to run two functions at the same time)

You can see a snippet of the interface of Sonic Pi below, as you can see it has a simple and clean layout which makes it really easy to get started. Sometimes children can be overwhelmed if software has lots of menus and buttons but they shouldn’t have any problem with this!

Sonic Pi Let it Go Frozen by Nicki Cooper

To play the notes, you simply give the program the MIDI number for each note (eg. Middle C – 60) and the timings. The table below gives the corresponding MIDI numbers for each note:

Midi Numbers

You can download a copy of my source code here. Apologies for the lack of commenting in my code, however if you’re familiar with any programming language you can probably decipher it fairly easily!

It wasn’t all plain-sailing though . . . Many of the resources for Sonic Pi I found online are for version 1, so I had a few issues at first until I discovered the built-in help which proved to be invaluable for providing examples of syntax and formatting. Another issue I had was that once I added my second thread to play the left hand part my Pi really struggled and Sonic Pi threw a lot of timing errors at me saying it “couldn’t keep up” and sounded awful as many of the notes became misaligned! I was a bit concerned at this point that all my hard work was in vain but after overclocking my Pi to Turbo Mode it worked nicely! Here is a guide on how to do this.

I should also credit the source of the sheet music, which was the easier version of the song transcribed by Joyce Leong, for this and more sheet music check out her excellent website. (Note, I only went up to page 3 for this activity).

For a Getting Started guide to SonicPi V.20 check out the resources from the Raspberry Pi Foundation.

I’m really looking forward to trying this out with some of my students in September, I think this is something that will really engage them and if I notice any budding virtuosos then maybe I’ll enter them into the Sonic Pi Competition as well!

8 thoughts on ““Let it Go, Let it Go . . .” Some Raspberry Pi Music

  1. Sam Aaron

    Awesome stuff! Hopefully you don’t mind me passing on a quick tip… In Sonic Pi v2.0 you don’t have to use MIDI note numbers to notate pitch, you can now use note names such as play :C4 to play a fourth octave C. For sharps, append an s i.e. play :Fs4 and for flats append a b i.e. play :Eb3.

    Looking forward to hearing what you do next with Sonic Pi. Perhaps try some FX?

  2. Nicki Post author

    Thanks! Yes I discovered that partway through but stuck to the MIDI numbers for consistency. Also thinking, when students do this, if they get used to using MIDI numbers they can transfer the skills to Python, using Pygame fairly easily too. Definitely hoping to try out some more things over the summer

  3. Robin Newman

    Well done! Sounds great. Sonic-Pi 2 is great for transcribing to from printed score. I do this quite a lot. I enjoy doing early stuff John Dowland, Purcell etc. Has the advantage that the music score is free to download! I’ve also done some Beatles songs and Scott Joplin. You can can hear it all with links from my site rbnrpi.wordpress.com
    I haven’t released the code yet, as it uses a beta versio of Sonic PI 2 and I may have to modifiy a bit for the release version when I will publish the code. and on rbn1tube on youtube.

  4. Rohan

    Thanks for this… esp. the source code, I’ve been wondering how to structure some of my more complicate creations (only just starting out in sonic pi) and the code helped me ‘abstractize’ the piece. Cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *