Sound#

Introduction#

The VEX IQ (2nd generation) Brain can produce audio through its built-in speaker using blocks from the Sound category. These blocks play preloaded sound effects or musical notes.

For the examples below, the constructed Brain includes access to the Sound methods and will be used in all subsequent examples throughout this API documentation when referring to those methods.

Below is a list of all available methods:

Actions – Play sounds from the Brain.

  • playSound – Play a preset sound from the Brain.

  • playNote – Play a musical note from the Brain.

Actions#

playSound#

playSound plays one of the Brain’s built-in sounds.

Usage:
Brain.playSound(sound);

Parameters

Description

sound

The specified sound to play from the Brain.

Sound Name

Play Sound

alarm

alarm2

doorClose

fillup

headlightsOff

headlightsOn

powerDown

ratchet

ratchet2

siren

siren2

tada

tollBooth

wrench

wrongWay

wrongWaySlow

// Example coming soon

playNote#

playNote plays a musical note from the Brain.

Usage:
Brain.playNote(octave, note, duration);

Parameters

Description

octave

The integer that represents the octave the note is played in:

  • 1 to 3 – low octave
  • 4 to 7 – high octave

note

The note to play:

  • 0 – C
  • 1 – D
  • 2 – E
  • 3 – F
  • 4 – G
  • 5 – A
  • 6 – B

duration

Optional. The duration in milliseconds to play the note for, up to a max of 500 milliseconds. If no duration is provided, the default duration is 500 milliseconds.

// Example coming soon