Sound#
Introduction#
The VEX AIM Coding Robot’s sounds allow users to play built-in sounds, custom audio files, and musical notes. It also includes controls for stopping sounds and detecting if audio is currently playing.
Below is a list of all blocks:
play sound — Plays a built-in sound from a predefined list.
play sound file — Plays a user-uploaded sound.
play note — Plays a musical note with a specified pitch, octave, and duration.
stop sound — Stops any currently playing sound.
sound active? — Checks if a sound is currently playing.
play sound#
The play sound block plays one of the robot’s built-in sounds.
play sound [act happy v] ▶
Parameters |
Description |
|---|---|
sound |
One of the built-in sounds shown below. |
expanding arrow |
By default, this is a waiting block, so the robot will finish playing the sound before running the next block. To make the robot start playing the sound and immediately run the next block right away, expand the block to say and don’t wait. |
Sound Name |
Play Sound |
|---|---|
act happy |
|
act sad |
|
act silly |
|
act angry |
|
act excited |
|
move forward |
|
move reverse |
|
turn right |
|
turn left |
|
crash |
|
brakes |
|
pickup |
|
sensing |
|
detected |
|
obstacle |
|
sparkle |
|
blinker |
|
chirp |
|
looping |
|
complete |
|
send |
|
receive |
|
pause |
|
resume |
|
tada |
|
fail |
|
doorbell |
|
huah |
|
flourish |
|
cheer |
Example
when started
[Play the act happy sound.]
play sound [act happy v] ▶
play sound file#
The play sound file plays a custom sound loaded by the user.
play sound file [1 v] ▶
Parameters |
Description |
|---|---|
sound slot number |
The custom sound to use, number 1 to 10. The sound number aligns with the number shown in the AIM Control Panel. |
expanding arrow |
By default, this is a waiting block, so the robot will finish playing the note before running the next block. To make the robot start playing the note and immediately run the next block right away, expand the block to say and don’t wait. |
Example
when started
[Upload a sound file in VEXcode.]
[Play the custom sound.]
play sound file [1 v] ▶
play note#
The play note block plays a specific note for a specific duration.
play note [low v] [C v] [note_eight v] ▶
Parameters |
Description |
|---|---|
octave |
The octave of the note:
|
note |
Defines the musical pitch:
|
note length |
Sets the length of the note:
|
expanding arrow |
Expand the block to say and don’t wait and make the block a non-waiting block. By default, this block is a waiting block. |
Example
when started
[Play a short tune.]
play note [low v] [C v] [note_half v] ▶
play note [low v] [D v] [note_quarter v] ▶
play note [low v] [E v] [note_sixteenth v] ▶
stop sound#
The stop sound block stops a sound that is currently playing.
stop sound
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
when started
[Stop sound if it is still playing after 2 seconds]
play sound file [1 v] ◀ and don't wait
wait (2) seconds
if <sound active?> then
stop sound
end
sound active?#
The sound active? block returns a Boolean indicating whether any sound is currently playing.
True — There is a sound playing.
False — There is no sound playing.
<sound active?>
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
when started
[Stop sound if it is still playing after 2 seconds]
play sound file [1 v] ◀ and don't wait
wait (2) seconds
if <sound active?> then
stop sound
end