The sound library is capable of playing sounds from the speaker embedded in the Spike hub. It's basic functionalities include playing a sound, stopping sound, and changing the volume of a sound.
ANY=-2
DEFAULT=-1
WAVEFORM_SINE=1
WAVEFORM_SAWTOOTH=3
WAVEFORM_SQUARE=2
WAVEFORM_TRIANGLE=1
None
integerfrequency
The frequency in hertz of the sound
integerduration
The duration in milliseconds of the sound
integervolume
The volume intensity of the sound from 0 to 100
1
2
3
use Libraries.Robots.Spike.Sound
Sound noise
noise:Beep(440, 500, 100)
None
integerfrequency
The frequency in hertz of the sound
integerduration
The duration in milliseconds of the sound
integervolume
The volume intensity of the sound from 0 to 100
integerattack
The time in milliseconds between the start of the sound to the peak
integerdecay
The time in milliseconds between the peak volume to sustain volume
integersustain
The volume intensity of the sustain of the sound between 0 and 100 until the sound is released
integerrelease
The time in milliseconds for the volume intensity to decay to 0 from release time
integertransition
The time in milliseconds for the sound to transition from the currently playing sound
integerwaveform
The waveform to use to play the sound, using one of the constants defined in the Sound class
integerchannel
The channel to play on, either DEFAULT or ANY from the constants defined in the Sound class
1
2
3
use Libraries.Robots.Spike.Sound
Sound noise
noise:Beep(440, 500, 100, 120, 50, 50, 60, 10, noise:WAVEFORM_SQUARE, noise:DEFAULT)
None
integervol
The volume intensity of the sound from 0 to 100
1
2
3
4
use Libraries.Robots.Spike.Sound
Sound noise
noise:Beep(440, 5000, 100)
noise:Stop()
None
None
1
2
3
4
5
6
7
use Libraries.Robots.Spike.Sound
use Libraries.Robots.Spike.Hub
Sound noise
Hub hb
noise:Beep(440, 5000, 100)
hb:Sleep(1000)
noise:SetVolume(25)