# Phaser 3 + Web Audio Help

**URL:** <https://phaser.discourse.group/t/phaser-3-web-audio-help/5451>\
**Category:** Phaser 3\
**Created:** [March 9, 2020, 5:39pm UTC](https://phaser.discourse.group/t/phaser-3-web-audio-help/5451 "2020-03-09T17:39:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dolanmiu](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/dolanmiu/32/2953_2.png) [@dolanmiu](https://phaser.discourse.group/u/dolanmiu)\
**Post date:** [March 9, 2020, 5:39pm UTC](https://phaser.discourse.group/t/phaser-3-web-audio-help/5451/1 "2020-03-09T17:39:04Z")

</div>

Hi

Everything, all sound works fine on Android and on Google Chrome on Windows.

However, when trying to put my Phaser 3 game on iOS, it only works when i use html5Audio:

```
  audio: {
    disableWebAudio: true,
  },

```

However, the moment I remove `disableWebAudio: true`, I get the following error:

```
[log] - %c %c %c %c %c Phaser v3.22.0 (WebGL | Web Audio) %c https://phaser.io background: #ff0000 background: #ffff00 background: #00ff00 background: #00ffff color: #ffffff; background: #000000 background: #fff
⚡️ [error] - ERROR {"line":83764,"column":28,"sourceURL":"capacitor://localhost/scripts.js"}
⚡️ [error] - ERROR Error: There is no audio asset with key "hit" in the audio cache

```

All audio is mp3, and ogg, and 44.1k

```
this.load.audio(ASSET_KEYS.WING_SOUND, ['assets/sounds/sfx_wing.ogg', 'assets/sounds/sfx_wing.mp3']);
this.load.audio(ASSET_KEYS.HIT_SOUND, ['assets/sounds/sfx_hit.ogg', 'assets/sounds/sfx_hit.mp3']);
this.load.audio(ASSET_KEYS.DIE_SOUND, ['assets/sounds/sfx_die.ogg', 'assets/sounds/sfx_die.mp3']);
this.load.audio(ASSET_KEYS.WOOSH_SOUND, ['assets/sounds/sfx_swooshing.ogg', 'assets/sounds/sfx_swooshing.mp3']);
this.load.audio(ASSET_KEYS.POINT_SOUND, ['assets/sounds/sfx_point.ogg', 'assets/sounds/sfx_point.mp3']);

```

Can someone help

P.S.

The same also works when I do `noAudio: true`:

```
audio: {
    noAudio: true,
},
```

---

<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:** [March 10, 2020, 4:09pm UTC](https://phaser.discourse.group/t/phaser-3-web-audio-help/5451/2 "2020-03-10T16:09:02Z")

</div>

> [@dolanmiu](#):
>
> Error: There is no audio asset with key “hit” in the audio cache

This is strange.

---

<div class="post-metadata">

**Author:** ![dolanmiu](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/dolanmiu/32/2953_2.png) [@dolanmiu](https://phaser.discourse.group/u/dolanmiu)\
**Post date:** [March 10, 2020, 6:37pm UTC](https://phaser.discourse.group/t/phaser-3-web-audio-help/5451/3 "2020-03-10T18:37:22Z")

</div>

Yes it is

Do you have any clue why?

Only HTML5 Audio works, but its very slow, and iOS only allows one “hit” sound to be played simultaneously, so you cant hit people multiple times…

---

<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:** [March 10, 2020, 6:58pm UTC](https://phaser.discourse.group/t/phaser-3-web-audio-help/5451/4 "2020-03-10T18:58:45Z")

</div>

> [@dolanmiu](#):
>
> iOS only allows one “hit” sound to be played simultaneously

You need to ask for multiple copies when loading. There is a thread here somewhere.

For the Web Audio problem, that sounds like the audio files aren’t getting loaded or aren’t getting processed after loading. Some logging may help.

---

<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:** [March 10, 2020, 7:11pm UTC](https://phaser.discourse.group/t/phaser-3-web-audio-help/5451/5 "2020-03-10T19:11:37Z")

</div>

> [@Is it possible to play two sounds at once from a soundsprite?](https://phaser.discourse.group/t/is-it-possible-to-play-two-sounds-at-once-from-a-soundsprite/4898/2):
>
> If you’re using HTML5Audio you need to pass, e.g., { instances: 2 } (or more) in the load call. If you’re using WebAudio it should just work.

---

<div class="post-metadata">

**Author:** ![dolanmiu](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/dolanmiu/32/2953_2.png) [@dolanmiu](https://phaser.discourse.group/u/dolanmiu)\
**Post date:** [March 11, 2020, 1:49am UTC](https://phaser.discourse.group/t/phaser-3-web-audio-help/5451/6 "2020-03-11T01:49:44Z")

</div>

I believe this thread is related

But there is no solution once again:

> [@Audio works on web but not iOS](https://phaser.discourse.group/t/audio-works-on-web-but-not-ios/3677):
>
> Hi there We are seeing the following errors when calling play() Audio cache entry missing: music1 ... TypeError: undefined is not an object (evaluating 'this.currentConfig.seek=0') We are using "@capacitor/ios": "^1.1.1", "phaser": "^3.19.0" And we have this scene preload() { console.log("musicOn assets/audio/example3.wav") this.load.audio('music1', 'assets/audio/example3.wav'); this.load.on('fileprogress', function (file) { console.log("filep…

---

<div class="post-metadata">

**Author:** ![dolanmiu](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/dolanmiu/32/2953_2.png) [@dolanmiu](https://phaser.discourse.group/u/dolanmiu)\
**Post date:** [March 11, 2020, 1:55am UTC](https://phaser.discourse.group/t/phaser-3-web-audio-help/5451/7 "2020-03-11T01:55:17Z")

</div>

I can’t seem to get a stack trace up on XCode but I have found that this area of the code fails

![image](https://global.discourse-cdn.com/free1/uploads/phaser1/original/2X/2/20348b748cfa94217d3c511b2ea76354062bc0c2.png)

`this.sounds.push(sound);` never gets hit
