Control sounds and words which can play from your programming device's speaker or the robot (R2-D2 only).
await Sound.Category.SoundName.play(true) plays a sound from your programming device. When a sound is played, if you use the
true boolean (aka: "Wait" in the block canvas) the program waits until the sound plays completely before continuing to the next command. Change to
false (aka: "Continue" in the block canvas) to go to the next command immediately. If you want to use timing different than the wait/continue commands allow, you can follow a
true (continue) command with a
delay() command so the subsequent logic is delayed for the given duration.
You can randomize all sounds by not declaring a
SoundName, such as
await Sound.play(true). If you declare a
Category but leave the
SoundName blank it will randomize in the given category, such as
await Sound.Animal.play(true) as used in the Animal Toss Game.
Preview all of sounds below, or you can hear them in the blocks canvas in the app:
Unique Star Wars Droid Sounds are available for BB-8, BB-9E and R2-D2 using
DroidName.Sound.Category.SoundName.play(). The droid names are written as
R2D2 and they can only be played on the intended Droid. This works the same as the
sound command, except that the wait and continue boolean is not available. For example, to play the R2-D2 Burnout sound use
*R2-Q5 Droid Sounds are not available
await speak() will speak a string from your programming device using the text-to-speech engine, in any language supported by your device. You can add a lot of interesting logic to your programs with this command. For example, in the Magic 8-Ball program you can change the speak command to some fun answers like
await speak('Hello World', true). You can also concatenate string values (see the + button on the block canvas) to make them dynamic. The additional values can be variables, parameters, or sensors, and/or in the form of numbers, strings, booleans, or colors. The wait/continue playback (true/false boolean) is handled the same as the Play Sound command. For example, to speak the current heading use
await speak(buildString("The heading is" + Math.round(getHeading())), true).