It is Computer Science Education week https://csedweek.org
With all kinds of coding activities going on around the world we thought we’d share some fun things to do with Skoog and coding using Apple’s Swift Playgrounds app and our dedicated Skoog playground.
When you first think about it music and coding may not sound like ideal partners but coding and music are a perfect mix. In many ways music is the organisation of sound, and much of this organisation is done according to logical principles. By combining Skoog with Swift Playgrounds (Apple’s app for iPad that makes learning Swift interactive and fun) you can have fun with activities that are scientific, social and inclusive!
The Skoog playground lets you get under the hood of your Skoog and build your very own electronic instrument using Skoog as the controller and Swift Code on iPad to generate the sounds. In the Skoog playground there are sections on simple signal processing, notes or tones and using a sound library. The Skoog playground also has sections to help create interactive elements on the iPad (Pings) and more advanced data processing to give you full control of your Skoog sounds. You can learn about MIDI and some core music theory too.
But for now let’s focus on these 3 coding activities in the Skoog playground:
- Signal processing
- Generating Sounds
- Assigning notes or tones
And we are going to use them to solve a puzzle! This can be done in groups, individually or as a class. If you have Apple TV or the ability to share your iPad screen via a projector or interactive white board then this can be a great class exercise.
What we are going to do is choose one of the songs from the Skoog online songbook (a popular tune that has been transcribed into a Skoog color pattern – for example let’s try Journey – Don’t Stop Believing).
And here is the puzzle; is if we give them the notes and the pattern to play can they guess the song from the opening lines or perhaps the chorus? Or you can mix it up and take a different approach; give them the right notes and get them to work out the pattern required to play a tune or song of your choosing, maybe Ode to Joy? (Have a look through the online songbook to find some tunes that will work for you and the class). This puzzle approach is really neat as it highlights the impact of a sequence of commands or actions to create meaningful output from that sequence, namely a tune!
From the Skoog color score simply select the section you want them to play. For example in this case I have selected the first couple of lines (Just a small town girl, Living in a lonely world). You can pop these up on a screen or print them off it’s up to you (remember to trim away the words or this may give it away).
In the top of the Skoog color score it gives you the notes you need to set for each color: Red E4, Blue F#4, Yellow G#4, Green A4 and Orange B4.
So let’s get coding!
- First get the students familiar with their Skoog and how it is going to work as a controller using the ‘Handling your Skoog’ page of the playground. This is where you can see the data coming in from the Skoog and you can set the threshold for each side to make a sound. Connecting the action on the Skoog to an event. Get them to explore setting different thresholds to make the drum sound. We are now going to use this data from the Skoog as a controller to play musical notes, and the students will use this to play the color pattern to guess the song.
- Now they need to choose a sound to connect the data from the Skoog to. Using the ‘What’s My Sound’ page explore the different sounds available using SoundStyles. There are 16 different sounds to choose from. The glossary has a list of available soundStyles and lots of other useful information that’s relevant to the Skoog playground.
- Once they have found a sound they like get them to note down the code required e.g. setSound (.afromallet)
- Now in order to play a song we need the right notes, so open the ‘Hitting the right notes’ page. Get them to explore what happens to their Skoog when they change the editable numbers in the code view.
- Chat about MIDI notes and the standard keyboard set up to help understand how the numbers relate. In the instructions on this page you can show MIDI numbers against a standard keyboard by tapping the MIDI number text in the instructions (highlighted in blue).
For the Journey classic we need:
Red E4, Blue F#4, Yellow G#4, Green A4 and Orange B4.
Use the keyboard in the glossary to work out the MIDI numbers.
Once identified get the students to note down the MIDI numbers they need.
- Now let’s play! We are going to bring the ‘.setSound’ command and the ‘setNotes’ command together to set the Skoog up to play the pattern/color sequence.
- Go to the ‘Performance with Ping!’ page. The only code you need to adjust is the ‘setSound’ and the ‘setNotes’ sections. Ignore the rest.
Once you have entered the correct sound and notes hit ‘Run My Code’ and put the notes in the right order following the color score to play the sequence…. Now the fun begins, who can name that tune!
This is a really fun and adaptable exercise. If working in groups you could get groups to do different sections of a song and then bring them together for a final play along. Or to do different songs. You can also adopt a challenge approach where a group knows their song (so you tell them the track etc but they still need to code to set up the Skoog to play it) but each group needs to work out what the other group’s song is.
There are lots of great resources for Swift Playgrounds available from Apple including the EveryoneCanCode resources which are excellent:
Here is a link to a great iBook on Swift playgrounds by Daniel Budd, Joe Moretti and Anders Randler:
For more information on Skoog and Swift playgrounds:
Or why not get in touch with our team: