Foundry provides a diverse range of audio options, from global music playlists to environmental sound effects to individual sound file clips.
Official Documentation
Legend
AudioHelper.play // `.` indicates static method or property
AudioHelper#play // `#` indicates instance method or property
Stub
This section is a stub, you can help by contributing to it.
Stub
This section is a stub, you can help by contributing to it.
General document and canvas manipulations are covered on their respective pages.
Playing a sound for the current user is done with the singleton AudioHelper class available at game.audio
with the play method. If you want to trigger a sound for multiple users, the static play method that is available at foundry.audio.AudioHelper.play
and game.audio.constructor.play
(Both paths work equally well). Keep in mind that if you're calling these functions within a hook, that the hook may be called on only one client or on all clients and so it may be more appropriate to use the instance or static method.
const src = 'some/audio/path.wav'
// play locally
game.audio.play(src);
// play on all connected clients
game.audio.constructor.play({ src }, true);
Stub
This section is a stub, you can help by contributing to it.
Stub
This section is a stub, you can help by contributing to it.