Music

Package: Libraries.Robots.Spike · Inherits from: Libraries.Language.Object

The music library is used to play music through the SPIKE App.

Example Code

use Libraries.Robots.Spike.Music
Music music
music:PlayDrum(music:DRUM_SNARE)

Variables

  • integer INSTRUMENT_BASS
  • integer DRUM_BASS
  • integer DRUM_TRIANGLE
  • integer INSTRUMENT_GUITAR
  • integer DRUM_CLAVES
  • integer DRUM_BONGO
  • integer INSTRUMENT_ELECTRIC_PIANO
  • integer DRUM_SIDE_STICK
  • integer DRUM_CLOSED_HI_HAT
  • integer INSTRUMENT_CHOIR
  • integer INSTRUMENT_MUSIC_BOX
  • integer INSTRUMENT_STEEL_DRUM
  • integer DRUM_CABASA
  • integer DRUM_OPEN_HI_HAT
  • integer DRUM_SNARE: Constants for drums
  • integer INSTRUMENT_ORGAN
  • integer INSTRUMENT_ELECTRIC_GUITAR
  • integer DRUM_VIBRASLAP
  • integer DRUM_CRASH_CYMBAL
  • integer DRUM_WOOD_BLOCK
  • integer INSTRUMENT_VIBRAPHONE
  • integer INSTRUMENT_SYNTH_PAD: Play the provided drum sound
  • integer INSTRUMENT_BASSOON
  • integer INSTRUMENT_CLARINET
  • integer DRUM_TAMBOURINE
  • integer INSTRUMENT_PIZZICATO
  • integer DRUM_GUIRO
  • integer DRUM_HAND_CLAP
  • integer INSTRUMENT_WOODEN_FLUTE
  • integer INSTRUMENT_SAXOPHONE
  • integer INSTRUMENT_MARIMBA
  • integer INSTRUMENT_FLUTE
  • integer INSTRUMENT_TROMBONE
  • integer INSTRUMENT_CELLO
  • integer DRUM_CONGA
  • integer INSTRUMENT_SYNTH_LEAD
  • integer DRUM_CUICA: Constants for instruments
  • integer DRUM_COWBELL
  • integer INSTRUMENT_PIANO: Constants for instruments

Actions

PlayDrum(integer drum)

Play the provided drum sound

Parameters

  • drum integer: Which drum to play, out of the DRUM constants

Example

use Libraries.Robots.Spike.Music
Music ms
ms:PlayDrum(ms:DRUM_SNARE)

PlayInstrument(integer instrument, integer note, integer duration)

Play the provided instrument sound with a given tone and duration

Parameters

  • instrument integer: Which instrument to play, out of the INSTRUMENT constants
  • note integer: The midi note to play (0-130)
  • duration integer: How long to play the instrument/note for, in milliseconds

Example

use Libraries.Robots.Spike.Music
Music ms
ms:PlayInstrument(ms:INSTRUMENT_PIANO, 50, 3000)   // Play for 3 seconds

Inherited Actions

3 actions from Libraries.Language.Object