play Sound Until Done

Play some notes of music you have placed in a string and wait the sound to finish playing.

music.playSoundUntilDone('')

Your program plays the sound and waits for the sound to finish.

The notes of your sound go into a string. The composing sounds page tells you how to make a sound string.

Also, there are built-in sounds you can use. These are part of the Sounds type. You use built-in sounds instead of your own sound string with ||music:sounds|| like this:

music.playSoundUntilDone(music.sounds(Sounds.JumpUp))

Simulator

||music:play sound until done|| works on the Adafruit Circuit Playground Express. It might not work in the simulator on every browser.

Parameters

  • sound: a string containing the notes of a sound you want to play. Look at composing sounds to find out how to make the sound string.

Examples

My sound string

Make a sound string that has 5 notes. Play the sound and wait until it finishes playing.

let mySound = "g5:1 f e d c";
music.playSoundUntilDone(mySound);

I’ll play BaDing

Play a the built-in sound called BaDing.

music.playSoundUntilDone(music.sounds(Sounds.BaDing))

See also

play sound, sounds, tempo, set tempo, change tempo by

Composing sounds

music