PlaySound

Family: Sound · 4 forms

What it does

PlaySound makes something happen at once: it plays. It takes soundID (an integer), and answers an integer. That is the first of 4 forms. soundID is the id of a Sound object, the one LoadSound returned: it is how the call knows what to act on.

Syntax

1
PlaySound(soundID integer) → integer
2
PlaySound(soundID integer, volume integer) → integer
3
PlaySound(soundID integer, volume integer, loop integer) → integer
4
PlaySound(soundID integer, volume integer, loop integer, priority integer) → integer

Parameters

NameTypeIn forms
soundIDintegerall
volumeinteger2, 3, 4
loopinteger3, 4
priorityinteger4

Every form returns

integer

Example · generated

Form 1, the short one

sound = LoadSound("assets/sound.wav")DO  Print(PlaySound(sound))  Sync()LOOP

Form 4, with every argument

sound = LoadSound("assets/sound.wav")DO  Print(PlaySound(sound, 1, 1, 1))  Sync()LOOP

LoadSound is there to give the call something to act on; PlaySound is the line that matters. The DO … LOOP is not decoration: a classic BASIC program ends the moment it runs out of lines, and Sync() is what draws the frame.

37 commands in Sound