Time to play a tune on your Circuit Playground Express! In this section, we will discuss how to make music on your Circuit Playground! We will go over the basics of tune design and walk you through making a song of your own.

Transcript

Hi, welcome back to the Circuit Playground Express online workshop, in this section we're going to learn about music.

The Circuit Playground Express has a speaker built right into the top of the board, that's capable of producing a wide range of frequencies and tones. So, we can use this to add just an audio element to our projects or we can make a song within MakeCode. So, in this section, we're going to learn how to make a simple song and I'll show you a more complex one.

So if we take a look at MakeCode we'll go to the music column to see our different music and tone options that we have within MakeCode, there are first two options our pre-made sounds that we can use just little jingles I suppose that you can throw into a project really easily so an example of that would be this powerup sound. We can choose different sounds from the drop-down and that allows you to add kind of an audio element to your project without having to dig into without having to dig into creating something from scratch too much.

Then we have the tones and sounds that we can pick manually, so we can play the tone for a certain amount of time or we can just have it turn on and stay on, something I passed over is the stop all sounds which is important and then we have rests, I think there's a quote out there about music not being the notes but the pause between the notes. So, rests are important if you want to make a song within MakeCode we have our set volume command, we can change our tempo.

So, one of the things about music that's nice is that, when we set our pauses for a full beat in our rests for that amount of time, it's going up 120 beats per minute standard, so a half beat is 500 milliseconds. So, we are capable of changing the speed of our whole song by just changing the tempo, rather than needing to remake our song from scratch or go through and change every beat to a different length. Then we can also grab our tempo, our tempo speed to reference in other parts of our sketch. We can return the hertz of each note we play, and we can return the milliseconds of a beat. So that allows us to let's say sync up lights with our music if we want our music to be the variable or our driving value in our sketch. So, let's look at making a simple tone song.

So I'll grab the play tone at middle C, we can change this by just clicking on it and we can select a Hertz value if you know the exact Hertz and note you want to play or we can just select it off the keyboard and we'll put a rest between it we'll grab another one and then put another rest. So, if we play this now, we have a simple alternating tone and we can use that in our sketch however we want or reference it in other places. If we look at a more complex version of a song that I made for Elise by Beethoven, part of it anyway. I used functions which come in handy when you're making music, so if we go into the advance column and go to functions, we can click make a function and name it whatever you want, and it creates a bracket on the screen, and it creates a call. So you can put the different parts of your music into these functions and then basically just have one forever bracket that plays through each, so this will go to the first call function intro and that will play and then it goes to the second call function intro to and then back to the first because there's a lot of repeating things within a song. Normally it allows you to condense your code down so you don't have to write out every note the repeating part so you can just reference a function for.

Which is handy in something like this, which can be quite long. So, if you want to check out me for Elise sketch or play around with it there's a link to it in this section of the workshop, otherwise, stick around our next workshops going to be all about using external devices on the Circuit Playground Express.

Feedback

Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.