From Test-Scratch-Wiki

Play Sound ()
2.0 Play Sound ().png
Category Sound
Type Stack

The Play Sound () block is a Sound block and a Stack block. The block will play the specified sound, with no pause to its script (unlike the Play Sound () Until Done block, which will pause its script until the sound has finished playing).

Example Uses

As this block plays a sound without a delay in its script, it is mainly used when a sound must be played without bothering the script.

Some common uses for the Play Sound () block:

  • Playing a sound effect with an action
when gf clicked
play sound [meow v]
say [Hello!]
wait (1) secs
play sound [meow v]
say [Bye!]
wait (1) secs
  • If a sprite has achieved a goal, a sound effect is played
when gf clicked
forever
   move (10) steps
   if <touching [edge v]?> then
      play sound [Victory v]
   if on edge, bounce
  • Enhancing an event
when gf clicked
forever
if <touching [snowball v]?> then
play sound [collide v]
wait until <not <touching [snowball v]?>>

Workaround

Main article: List of Block Workarounds

The only other block that can play one of the pre-recorded sounds is the Play Sound () Until Done block. This block, however, waits the length of the sound before continuing to the block below it so it has to be used with a broadcast before it in order to continue the script.

. . .
broadcast [continue script v]
play sound [meow v] until done

when I receive [continue script v]
. . .

Notes

  • If a sound is playing and you play the same sound again, the sound will be cut off, but will play from the start again.
    • This does not happen if a different sound is played when a sound is currently playing.

See Also

Cookies help us deliver our services. By using our services, you agree to our use of cookies.