Music Extension: Play Notes
-
Prerequisite
What is a Note?
When playing music, a “note” represents a sound of a specific pitch.
Music notes are often represented using the first seven letters of the alphabet (from A to G), along with the Sharp (♯) or Flat (♭) symbols.
The Sharp ♯ and Flat ♭ symbols represent the notes in-between the normal notes. For example, the note between C and D can be written as C♯ (C-sharp) or D♭ (D-flat).
Play Notes Using the Music Extension
There are three stack blocks in the CreatiCode Music Extension that allow you to play notes of different instruments.
The “Set instrument to ()” Block
This block allows you to select which instrument to play the note with. You can select any of the 21 instruments from the drop-down menu.
“Play note () for () beats blocking () beats” Block
This block plays a note for the given number of beats, and also allows you to control how long to pause before running the next blocks attached below.
To select a specific note to play, you can click on the note input box, and then click on the keys to listen to and select the notes.
Here is how this block works for different values of blocking:blocking is blank
If blocking is empty, then the next block will not start until the current block finishes playing for the number of beats you have specified.
For example, in the program below, the note 60 will be played for 1 beat, then the note 72 will start.
blocking is 0
If the blocking value is 0, then the next block will start playing at the same time as the current block.
As shown below, both “play note” blocks run almost at the same time because the blocking value is 0 for note 60.
blocking is 1 or more
If the blocking value is 1 beat or more, then the next block will not start until the given number of beats have passed.
As shown in the example below, note 60 will only play for 1 beat, but it will last for 2 beats. So there is 1 beat of silence before note 72 starts playing.
“Play note () () () () for () beats loudness () blocking () beats” Block
This block plays four specified notes together, for the given number of beats and the selected level of loudness. You can also set the blocking time just like the “Play note () for () beats blocking () beats block”.
Here is how it works for different levels of loudness:
Loudness level mp:
Loudness level ppp: