# Repeating audio bug

**URL:** <https://phaser.discourse.group/t/repeating-audio-bug/15435>\
**Category:** Phaser 3\
**Created:** [July 29, 2025, 7:14pm UTC](https://phaser.discourse.group/t/repeating-audio-bug/15435 "2025-07-29T19:14:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bread](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/bread/32/9050_2.png) [@bread](https://phaser.discourse.group/u/bread)\
**Post date:** [July 29, 2025, 7:14pm UTC](https://phaser.discourse.group/t/repeating-audio-bug/15435/1 "2025-07-29T19:14:22Z")

</div>

My game has several different cannons / guns, and every time you shoot, it plays a small ‘pew’ sound effect. However, it seems Phaser 3 does not have a way to support extremely fast repeating sounds, which is a problem for my machine guns. With some of the faster guns, you can’t even hear the audio play. and with slower ones, it clips off the moment the next projectile is shot. How can I make it so the audio finishes it’s duration? This is my code for the shooting (ignore the lilbig logic)

```javascript
if (isShooting && fireDelay <= 0) {
  if (currentGun.family == GUN_FAMILIES.LIL_BIG) {
    fireGun(currentGun.littleGun);

    fireDelay = currentGun.littleGun.fireDelay;

    this.shoot.play();

    this.shoot.setVolume(0.03);
  } else {
    fireGun(currentGun);

    fireDelay = currentGun.fireDelay;

    this.shoot.play();

    this.shoot.setVolume(0.03);
  }
}

```

I’ve tried messing around with volume and shorter and shorter sound effects, but none are short enough for some of my extremely fast guns.

This is the audio I’m using ( not sure if link works):

[pew2.mp3](https://cdn.uppbeat.io/audio-files/57ef60eab5fd4218838423222dc07d99/29d3d2aa9f3c3bddbe8a1400a05cf81d/0a2fbe697b1149b9e73ac0f08c4a0369/STREAMING-arcade-game-retro-8-bit-laser-gun-fascinatedsound-1-00-00.mp3)

---

<div class="post-metadata">

**Author:** ![scottwestover](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/scottwestover/32/7442_2.png) [@scottwestover](https://phaser.discourse.group/u/scottwestover)\
**Post date:** [July 31, 2025, 12:32pm UTC](https://phaser.discourse.group/t/repeating-audio-bug/15435/2 "2025-07-31T12:32:42Z")

</div>

Depending on the result you are looking for, there could be a few different solutions. If you want to have multiple instances of the sound playing at once, for example each time you shoot a bullet we want to trigger an instance of the ‘pew’ sound, you could create pool of these audio objects and then play each one as a bullet is fired.

If you just want to reuse the single audio instance, before you call the `play` method, you could check if the audio is already playing, and if so, increment a counter to keep track of the number of ‘pew’ sounds that need to be played. For this to work, you would need to listen for the `complete` event for once the audio is done playing, and when that happens, decrease the counter and play the pew sound again.

Related events: [Audio](https://docs.phaser.io/phaser/concepts/audio#events)

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [August 1, 2025, 3:12pm UTC](https://phaser.discourse.group/t/repeating-audio-bug/15435/3 "2025-08-01T15:12:32Z")

</div>

A sound created by `add.sound()` is a single track that will restart if you call `play()` while it’s already playing.

If you want to play simultaneous sounds and don’t care about when they complete it’s probably simplest to do

```javascript
this.sound.play('pew', { volume: 0.03 })

```

etc.

---

<div class="post-metadata">

**Author:** ![TomAtom](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/tomatom/32/226_2.png) [@TomAtom](https://phaser.discourse.group/u/TomAtom)\
**Post date:** [August 3, 2025, 7:02am UTC](https://phaser.discourse.group/t/repeating-audio-bug/15435/4 "2025-08-03T07:02:37Z")

</div>

Check my answer [here](https://phaser.discourse.group/t/phaser-and-same-button-sounds-in-multiple-scenes-code-organisation-question/14905/3). It is about building simple audio manager with slots, that allows you to play the same sound multiple times. It works well for me.
