Pencil Code Reference > new Audio

 

new Audio play sound from files

new Audio will allow sound files to be played directly from the code.

example = new Audio('soundfile.mp3')

The new Audio command itself will only load the file. To play the file, use play().

example = new Audio('soundfile.mp3')
example.play()