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 available 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 doorbell stack block#
  play sound [act happy v] ▶

Parameters

Description

sound

One of the built-in sounds shown below.

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.

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 sound act happy.#
  when started :: hat events
  [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 user sound 1 stack block#
  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

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 user sound 1.#
  when started :: hat events
  [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.

The play note action block.#
  play note [low v] [C v] [note_eight v] ▶

Parameters

Description

octave

The octave of the note:

  • low
  • high

note

Defines the musical pitch:

  • C
  • C#
  • D
  • D#
  • E
  • F
  • F#
  • G
  • G#
  • A
  • A#
  • B
  • rest

note length

Sets the length of the note:

  • Whole note - Whole note
  • Half note - Half note
  • Quarter note - Quarter note
  • Eighth note - Eighth note
  • Sixteen note - Sixteenth 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

Play sound file 1 and don’t wait. wait for 2 seconds. If sound is still active, then stop sound.#
  when started :: hat events
  [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.

The stop sound action block.#
  stop sound

Parameters

Description

This block has no parameters.

Example

Play sound file 1 and don’t wait. wait for 2 seconds. If sound is still active, then stop sound.#
  when started :: hat events
  [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.

The sound active Boolean block.#
  <sound active?>

Parameters

Description

This block has no parameters.

Example

Play sound file 1 and don’t wait. wait for 2 seconds. If sound is still active, then stop sound.#
  when started :: hat events
  [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