Simulator
The ||music:rest||
block works on the micro:bit board. It might not work in the simulator on every browser.
Play no sound (rest) on the speaker or at a sound pin for the amount of time you say.
music.rest(400)
The duration of the rest is set as a number milliseconds. Instead, it’s typical to use a number of beats or a beat fraction for a rest. The ||music:beat||
block is used to convert beats to milliseconds. You can also make a custom rest by setting the rest duration to certain amount of milliseconds.
The ||music:rest||
block works on the micro:bit board. It might not work in the simulator on every browser.
Continuously play a Middle C
tone for 1
beat and rest for 2
beats.
basic.forever(function () {
music.playTone(262, music.beat(BeatFraction.Whole))
music.rest(music.beat(BeatFraction.Double))
})
Continuously play a Middle C
note followed by a random rest time.
basic.forever(function () {
music.playTone(262, music.beat(BeatFraction.Whole))
music.rest(randint(500, 2000))
})