 you know being British I like clouds and so I manage all of the clouds that are software of open source and so you can come and find it on github slash manage iq and we're always welcome and we're also firing so if you want to come and work with me and help me manage clouds then come talk to me afterwards. Okay so you might be wanting to compute it actually from the other, that's a really really good ascent that's on these ones from 4.4 although they are pretty cool. These kind of synthesizers, hardware synthesizers, and if you say synthesizers you sell a lot when one of my mother gets really really hard to say because you should practically go home and synthesize it really fast. Right so I have fought with me here for small collections since I have my Ontario mini brook with some of the Volcker keys. So this is a monophonic synthesizer, this is a polyphonic synthesizer even though it's smaller. This is the Volcker beats which is now our drum machine and then I've got my co-op little bit synth which is really good for you to stick them all together and you can make your own synths by clicking things in and kids love them, it's great fun. Right so in order to understand how synthesizers work you first need to talk about oscillators they're just tiny little computer-y things that you know some wires and things that you can solder together and they basically make a pattern and they make a repeated pattern and by doing that if we then connect a sound source to that we can then hear that pattern and those patterns are called waves. I think this is the Niagara Falls I believe if Google research did me right. So there are different types of waves that we can use to make music. There are square waves which we might recognize from being developers you know this is the kind of binary on and off kind of pattern that we're used to seeing. There are also sine waves which are a bit more kind of analog-y you know like the lower waves that you would see in the skies drifting along with the radio. There are also triangle waves which are which are really really nice sounding and one of my favorites is the sawtooth. The great thing about the sawtooth is it can go this way and it can also go that way. So depending on which direction you play it makes different sounds and then of course there is our long-term mounted Google wave that's also a second. Okay and the final wave that we can make is noise so-called because that's all it is it's just noise makes it it's the kind of for any of you that were born after the 90s this is what our televisions would look like in between channels when we're trying to flip through and it's on the radio still sound like today. So let's have a look at what these things sound like. So hopefully we should also be able to visualize them. So let's run my visualizer. So we saw those different waves on the screen so let's just first we'll see what a sawtooth sounds like and then it sort of stops. That's to a square wave and as I say it's just noise. The sizes are envelopes and so we have an example here attack decay sustain release. You may think that's kind of some killer move on some kind of tech and game but easier than those combo moves on there. So an envelope is just basically a way of changing the the way instead of it just being the kind of normal sort of triangle wave as you go along we can effect the way that the shape of it. So when you press the key that's where it begins attack so that's sort of no tone and no tough that's kind of the concept it's using. So attack is the amount of time it takes to go from zero to the highest possible sound level that you've set possible volume to the sustained volume and sustain isn't the time it's actually the kind of volume at a time it takes once you take any finger off the key for the sound to kind of die away and stop being. So if we just have a look at that so this is just the normal I don't know if you can actually see so well on the camera. So this is only when you press the note normally and you take your finger off the sound stops. If we increase both the attack and delay it takes a little bit longer with the attack it takes a little bit longer for the sound to the main sound to happen. If we turn the attack and just have decay it's a bit more subtle but it changes the sound and then if we increase the release which is the end of it when I take my finger off the note we'll see it will still carry on music. So that's Emberlips in its basics. See what's next. Right so you're thinking oh that was already interesting these instruments look really really cool but with developers you know with the techie people why are you telling us about hardware instruments well there's this thing called Sonic Pi which is a way of making music essentially for kids so it's written in ruby so you write ruby code and then you use that to make music. That runs on top of something called Super Clidre which is this amazing but complicated digital synthesizer unlike all these ones here which are analog Super Clidre is a digital synthesizer so it lives inside your computer and you have other ways of using it. It's one of Sonic Pi you could also use Overturn which I believe is closure if that interests you in any way but it's basically a way of writing code to make music and so when I first started using Sonic Pi I got really confused because it's had a little bit of a code to make music and I'm not really good at code anyway and so when I looked at this it was all a bit confusing but now you can see from the just two minutes of me explaining we've we've been using a sawtooth synth but playing 60 which is the notation to say basically middle C on piano and we're increasing the attack decay sustain and releasing like oh I know all that we just didn't have a minute ago so let's see how that sounds in Sonic Pi very close. So if we just play the first bit actually you've seen this all play with it so you don't have to know Ruby because this is the same as Man of the Kid so if kids can do it you can do it so it's really simple so we're just right here play 60 and then we run this right so we restart it. Sonic Pi was made in the UK by a chap called Sam Karen who's super awesome you should all follow her on Twitter. Okay so so it's a bit dark and a bit hard to see but basically we can play the middle C and use this one instead. We can then use a sort of synthesizer which sounds a bit more like pretty close isn't it so digital and all that that's pretty cool and now going to the examples we saw on the slide and add some attack delay sustain and release this is exactly like we just did over here pretty cool right and once you kind of have these concepts have been added just play a note change the way it sounds a little bit and play another note you can then if you're like one of the contributors or if you're one of the contributors like one of the contributors Sonic Pi he then wrote this song which you might recognize so it's pretty much like we were doing to just play some notes changing the attack on the delay and the release sticking in some some some noise to make the drums and making so you remember this that's that's pretty really cool so so you've shown us we've shown us how to play instruments you've shown us how to write code in Sonic Pi but you know we won't sing a bit more than that could maybe the computer talk to the instrument and it's like ah turns out you can't so there's this protocol called MIDI but before we talk about that I just want to talk about this wonderful lady Wendy Carlos who is an amazing not also the author's the right music composer and who wrote one of the first mainstream albums called Switched On Bar which was you know classical music but made inspiredly with analog synthesizers and she then went on to write the soundtrack for Clubwork Orange so she's just super super awesome she can listen to her stuff anyway back to MIDI so MIDI stands for musical instrument digital interface there was a standard in the 80s for all different instruments all two else talk together and it's a serial protocol that you probably see that pop picture but basically you have two cables one that goes in and one that goes out and you daisy chain up to like 16 instruments together and so the kind of the message that MIDI sends is you have a status bind which sends an instruction like whether the note is on or off you know are you playing it or not which channel you're sending it on because if you've got all daisy trained together each instrument would know which channel is listening to and then you've got the note data that we saw that play 60 or c3 is the number that the instrument owes and so in all sense from the actual piano keyboard so c3 is middle c if you were to go down to c2 that'd be down an octave if you're going to c4 that'd be up an octave and the velocity is how hard you're pressing the note because if you think on the piano you can press really really softly it makes a soft note where you can bang it really hard and it makes a really really hard sense you can you can code that in this data as well so let's have a little demo of seeing that work right so let's look at some code so here i'm using uh ruby but you don't have to write this in ruby i'm sure there's other programming languages available i heard swift is pretty good so if i just connect my uh mini root so hopefully if we run this code it should um it should connect to my device and send it these notes and play them and sleep for the duration of 0.5 seconds so fingers cross demo guards the mini root and then hopefully we share some noises the device let's see all other fun things we can do see what have we got written there so um this simple arpeggiator which kind of just goes over and repeats notes and get this working up second spell we did is just send it the same notes over and over again and we're able to change the speed uh or the tempo so that was 160 beats per minute we can also slow down to like 90s and see what that sounds as well as we do that's fun well um but as you can also go all of these other devices here so drum machine so if we plug this one in okay this should play a drum beat machine doesn't seem to want to play oh okay anyway let's see what else we do so imagine your writing tests as we all do and you know you want to know that your tests are passing or if they're failing you can have like output on your screen I thought wouldn't it be more fun to have musical notes play instead and so do any of you use um mini test so I've written a plugin for mini test that uh play music when your tests are passing or failing so we just have a look at the code so this is my example app and I've got some good tests as you know as we would all write if you're on the test to pass you just return truth only to fail you return pops that's how you write good tests I'm pretty sure and so if we even the test runner a pass or or fail right songs of this right you could have like pass pass pass fail and then you could make it make a little song any problem is most test frameworks randomize your tests so you can't actually then use it to write music and to be honest you probably shouldn't be using it to write music you should probably be passing tests and you know the two and five work that would make more sense oops right so okay so we've we've made music to make tests have you ever thought while algorithms sound like because like here I was giving a good example earlier like all this data metrics and and all we've used this thing or we could use that thing and it's like oh yeah you've got science to help but how about how things sound you know because sound isn't a not feeling you need to go with feeling so I wondered which sounds better quicksort or bubble sort so let's really use the side party for this one it's quick bubble sort and then it plays a note and that note is the value that it's swapping and we're making an array we're shuffling an array from 50 to 100 which can have all the numbers between 50 and 100 we shuffle it and we sort it the reason it's 50 to 100 is those are musical notes that we can hear any too high in our ears and that all of that would be the only one that can hear it too low and we'd probably end up with the brand note if that such thing exists so let's see if what a bubble sort sounds so I could do something a bit but I don't have five minutes before I talk so let's try quicksort so I think maybe the thing about this next time you're writing some kind of algorithm that maybe speed it might get your stuff done quicker but the port computer is going to listen to this which rather something like this and general analysis based on maths fibonacci and it turns out that the two are quite similar you know it's just a sequence of numbers in some kind of way I guess in the fibonacci sequence and but it is actually what it sounds so the code for that is super simple using this midi library we can just add in this function fibonacci and play the notes quite musical I could imagine you know Lady Gallagher singing the next her next song kind of like fibonacci but and that's the reason it's because both maths and they're very very similar to carry it later so we've gone through playing with instruments then we were so this one was then we're playing with sonic pie then we're controlling the physical instruments from the computer and I know you're all thinking it's like this is really cool but this this code here looked a bit a bit rubbish and what was really good was that was sonic pie it's an amazing just editor it's got so much cool stuff behind it like it deals with all of the threading and so you can have multiple things running at the same time and you can have multiple musical loops and it's you know it's meant for like 10 year old kids so why can't we use sonic pie to control the instruments well there's no support yet in sonic pie but there will uh for midi instruments but there will be soon so in absence of that I kind of hacked in some support and so we'll look so Sam Marry the director of sonic pie he he wrote this is right the example song see if you recognize it it seems to have not worked with me today we can take that same code but instead of sending the notes to sonic pie we should be able to send them to my son of the sizes okay here so I've done here well let's stop that then okay let's backtrack let's embrace all that in the video so I made this really cool track slow drums yes okay it was working a second ago the sizes over here it's obviously making it in sonic pie it doesn't sound very good but let's see what you think these instruments are ethro because they need electricity except this one actually it's branch of power so I was playing with that that was pretty fun going over the wall sleeping people making really scary noises coming up the other cool thing is though is um you can just you can just uh find some notation on the internet and just just find the notes that you need and then make a song so on the plane I made uh this one so then my son says hey what's your favorite music can go to instruments to play whatever it is you're thinking which I think is super super cool yeah need to talk so everyone play all these instruments later