top of page
  • matthewsoare

Pi Fidelity


I’ve got a short follow up post from the last post regarding adding an Envirophat to the PI 3 in the living room.

Short summary is that I added an Envirophat to the Raspberry Pi 3 in the living room and pulled the temperature and light data every two minutes. by outputting that data to a text file I would be able to import those numbers into something else at a later point.

I hinted in that post that Claire and I went to a thing. Well now I can write a little more about that thing and what it inspired me to do.

We went to what turned out to be an evening with Sam Aaron (@samaaron), the developer of the Sonic PI (@sonic_pi) software, who showed us the basics and explained how it worked. Turning code into music sounds really complicated but with this bit of software you can code and tweak and become an export in no time.

First of all, the basics. Sonic pi is (on the surface) a really easy to use and simple music program, originally designed for the Raspberry Pi and now available on pretty much any OS for your device of choice (Windows, Linux, Mac, Raspbian).

It’s interface is really straight froward and it’s dead easy to make music with. Even I can do it. At it’s most basic you simply type

play 80

and the software will play a noise. Code to music. Simple.

Add more code and add loops and samples and you can quickly make something that looks like this…

A simple loop, that plays one sample at note 90, then waits a second. It then plays a different sample at note 70. A live_loop is a loop in Sonic Pi that you can edit while it is playing. Simply tap play to hear what you have coded. Edit the number and hit play again and it will change the notes or the sample on the next loop through the code.

You can play about with this and change the sound, quickly and easily. I coded the above example in only a few minutes with barely any experience in the software.

On the evening with Sam and Connected Hull, Sam used data from the connected Hull project, as well as live data imported from a Raspberry Pi in the room to create a soundscape and to be honest looked like he was having a great time.

At one point, to demonstrate how you can use live data (and how it can change the code and in turn change the audio) Sam asked for volunteers from the group, and with everyone looking blankly at each other, yours truly stepped up to the plate, and used his experienced gaming thumb to cover the temperature sensor and increase the pitch of note being used.

Yours truly, captured by Jerome Whittington (@photomoments)

Overall, the evening was really good fun and inspiring. Upon returning home Claire and I played about with Sonic Pi until about 11pm and only stopped because there are small children in the houses at either side of mine.

The following weekend I had the opportunity to play with Sonic Pi again, and decided I wanted to use the data from the Pi 3 in the living room and it’s Envirophat.

A quick google later and I had an example of code that would import data from a basic text file (a .csv but lets not complicate matters). I could import the data from the temperature and light sensors, but what would it sound like?

Well… The light data changes more often than the temperature data, so I set that as a piano sample and the more stable temperature data as the bassline.

Here is what the final code looked like.

There are lots of possibilities but it was a really fun experiment and you can actually hear what my living room sounds like over the course of a weekend. You can spot where the room gets darker, but then when the lamps flick on and off on their timer.

Have a listen to what my living room sounds like…

It might not be the most amazing audio, it might not be my best coding but it does show how easy it is to work with Sonic Pi and create something that isn’t horrible to the ear.

I told you this would be a short post, but there might be another post this month, as I’ve just splashed out and bought myself a new game…

Until next time.

6 views0 comments

Recent Posts

See All


bottom of page