Phaser.js: Phaser: Playing sounds

Join the AI Workshop to learn more about AI and how it can be applied to web development. Next cohort February 1st, 2026

The AI-first Web Development BOOTCAMP cohort starts February 24th, 2026. 10 weeks of intensive training and hands-on projects.


This post is part of a Phaser series. Click here to see the first post of the series.

Similar to displaying images, Before you can play an audio file, you must preload it and assign it to a label:

function preload() {
  this.load.audio('sound', 'sound.mp3')
}

For images we used this.load.image(), here we use this.load.audio().

Once this is done, we can use the sound into our create() or update() functions:

this.sound.add('sound')

This will get you back an object. It’s important to assign it to a variable:

const sound = this.sound.add('sound')

Because later, when we want, we’ll call the play() method on it:

sound.play()

You can combine this with mouse events, for example, to play a sound when an item is clicked or hovered.

Lessons in this unit:

0: Introduction
1: Setting up a project to build a JavaScript game with Phaser
2: Phaser: The Canvas
3: Phaser: Scenes
4: Phaser: Multiple scenes
5: Phaser: The game loop
6: Phaser: Adding images
7: Phaser: Sprites
8: Phaser: GameObjects
9: Phaser: Animations
10: Phaser: Keyboard events
11: Phaser: Mouse input
12: Phaser: Physics
13: Phaser: collisions and screen boundaries
14: ▶︎ Phaser: Playing sounds
15: How to create a platformer game with Phaser.js