To make your glove musical, you'll use the CPX like a synthesizer. A synthesizer works by producing an electrical signal and altering it in special ways to create different sounds. Then it sends the signal to a speaker, which translates the changes in voltage into sound wave frequencies you can hear.
Programming the CPX to play a note or musical phrase is super easy with Microsoft MakeCode. This drag-and-drop visual language has music blocks that you can adjust in multiple ways. For this project, you'll start with a single note or series of notes, then vary the sound by changing four things:
- the pitch (how high or low the notes sounds),
- the duration of the note (how long or short it is compared to other notes)
- the tempo (how fast or slow they play),
- and the volume (how loud or soft they sound).
If you haven't made your own music before with MakeCode, this page will give you a quick run-down. And if you're new to MakeCode and want to learn more, you can find a full getting-started guide by clicking the button below.
To play a repeating note, grab the
The length of the note is pre-set to one-half beat. To change it, click on that space to open a drop-down menu of choices.
To create a series of notes, just grab another block from the MUSIC menu (or click on and duplicate the first block) and drag it underneath the first block until it clicks into place. Add more notes as needed to play a musical phrase over and over.
When you want a break between notes, use a
Changing the Pitch
Click on any key to set a new note. The name of the new note will appear.
Notice that a number replaces the name of the note on the block itself. You'll learn how to use that number to vary the sound on the next page.
Controlling the Volume
To make the notes louder or softer, use the
The volume is pre-set to
You can also type a number into the box, over the number
To see how loud that sounds in real life, write a short music program and download it to your CPX. To adjust the default volume for your program, drag a
set volume block into an
on start block.
Controlling the Tempo
To make the entire musical phrase play faster or slower, use the
To adjust the tempo at the beginning of the program, use an
Be aware that even though you are changing the tempo, the notes stay the same in relation to each other. The rhythm of short and long notes will stay the same. They will just play faster or slower.
The button below takes you to a preview of the example code above. Listen for a few repetitions and notice how the notes gradually get faster and faster. To play around with the code, click "Edit" and it will open as a new project in MakeCode.
On the next page, find out how to vary the pitch, duration, tempo, and volume by changing the position of your musical glove!