5f7a8e5301
* update yotta defaults for 16kb devices * refactor deprecated blocks * updates for button events * update button events * update refference * update docs * update docs * update button event blocks * update docs * update block id
1.1 KiB
1.1 KiB
play Melody
Play a short melody of notes composed in a string.
music.playMelody("", 120);
The melody is short series of notes composed in a string. The melody is played at a rate set by the tempo value you give. The melody string contains a sequence of notes formatted like this:
"E B C5 A B G A F "
The melody is shown in the ||music:play melody||
block as note symbols which also appear in the Melody Editor.
music.playMelody("E B C5 A B G A F ", 120);
The melodies are most often created in the Melody Editor from the block so that valid notes are chosen and the correct melody length is set.
Parameters
- melody: a string which contains the notes of the melody.
- tempo: a number which is the rate to play the melody at in beats per minute.
Example #example
Play the Mystery
melody continuously.
basic.forever(function () {
music.playMelody("E F G F E G B C5 ", 120)
})