We are going to use mainly this block:
Note 60 is MIDI number for the note middle-c and 0.5 beats refers to the length the note is played. I recommend highly to look tips from Scratchwiki’s tutorial on MIDI notes and beats.
Let’s code the song “Happy Birthday to you” with both computer and Laboratorio! I recommend to find the notes for this song before you start if you want to try to figure it out yourself! Pay attention to beats and the correct pitch!
The left code is programmed with sound blocks and the right one is programmed with Lab blocks. Do you see the difference how beats are adjusted in each cases? Note that one beat does not mean time passing by in seconds. How fast beats are played depends on the tempo (bpm= beats per minute), i.e. how many beats are defined to play in a minute. In the Lab’s case the tempo is always 60 bpm.
Fun way to add something to the code is to add block “set instrument to _” and code the instrument to change after every round.
If you have Laboratory, it is possible to change the volume and tempo with the slider. Check out the codes below!
The best practice is to code them as separate mini programs. In that way you are always able to adjust the volume and tempo. It is also possible to change the tempo with block “change tempo by _”. It has a bit more challenge! Look out the code below!
Hope you will have fun with making music with Scrath! For the inspiration I recommend to check out this interesting Music project on Scratch. It is still in progress, but it gives a perspective how you can make music with RobboScratch too!
See you soon,