Sound#

Introduction#

The VEX AIR Drone Controller allows 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:

Sounds - Play and Stop Sounds

  • 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.

Sounds#

play sound#

The play sound block plays one of the controller’s built-in sounds.

play sound doorbell stack block#
  play sound [move forward 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

success

fault

sensing

detected

obstacle

looping

complete

pause

resume

send

receive

Example

when started, play sound looping.#
  when started :: hat events
  [Play the looping sound.]
  play sound [looping 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 [SOUND1 v] ▶

Parameters

Description

sound slot number

The user-uploaded sound to use. Options will change if image names are edited in the 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 [SOUND1 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_quarter 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
  [Upload a sound 10 seconds or greater in VEXcode.]
  [Stop the sound while it is playing.]
  play sound file [1 v] ◀ and don't wait
  wait [6] seconds
  stop sound

sound active?#

The sound active? block reports if there is any sound currently playing. This Block returns a True or False (Boolean) value.

  • 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
  [Display when the sound is playing.]
  play sound [looping v] ◀ and don't wait
  wait until <sound active?>
  print [I hear the sound!] on console ▶