LoadSound

Family: Sound · 2 forms

What it does

LoadSound writes to a Sound object: it loads rather than reads. It takes soundID (an integer) and filename (a string), and returns nothing. That is the first of 2 forms. soundID is the id you are giving a Sound object: every later call names it by that number.

Syntax

1
LoadSound(soundID integer, filename string)
2
LoadSound(filename string) → integer

Parameters

NameTypeIn forms
soundIDinteger1
filenamestringall

What each form returns

1LoadSound(1, "assets/sound.wav")nothing
2sound = LoadSound("assets/sound.wav")integer

Example · generated

Form 1, you choose the id yourself

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

Form 2, the command hands back the id

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

LoadSound is called with values of the types its signature asks for. 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.

Related commands

37 commands in Sound