Sound.play.

From MiniScript Wiki
Jump to navigation Jump to search

Sound.play is a method that takes up to 3 parameters to play a previous setup Sound. It loops the sound if Sound.loop is true.

Parameters

The method has the following signature: Sound.play v, p, s

Parameter Description
v Volume, sets volume between 0 and 1
p Pan, sets pan between -1 (full left) and 1 (full right)
s Speed, sets the playback speed multiplier

The default of all the parameters is 1.

Example for backroundmusic loop

Load some background music from a file, set it to loop, and then play it on volume 0.2.

background_loop_track = file.loadSound("/usr/sound/background_loop.wav")
background_loop_track.loop = 1
background_loop_track.play 0.2, 1, 1

Sound Example 1 from https://miniscript.org/files/MiniMicro-CheatSheet.pdf

pew = new Sound
pew.init 0.3, [8000,100], [1,0]
pew.play

See also: Sound