# High CPU / Crash under IOS Safari using p5 Audio js

**URL:** <https://discourse.processing.org/t/high-cpu-crash-under-ios-safari-using-p5-audio-js/27798>\
**Category:** Libraries\
**Created:** [February 13, 2021, 4:06pm UTC](https://discourse.processing.org/t/high-cpu-crash-under-ios-safari-using-p5-audio-js/27798 "2021-02-13T16:06:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Skuenzl](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@Skuenzl](https://discourse.processing.org/u/Skuenzl)\
**Post date:** [February 13, 2021, 4:06pm UTC](https://discourse.processing.org/t/high-cpu-crash-under-ios-safari-using-p5-audio-js/27798/1 "2021-02-13T16:06:01Z")

</div>

Hey ive using the Audio lib for my shooter game but at several times the sounds crashes my game (on mac and iphone) seems the sound is the Problem if i only load the shoot sound, the browser Crashes after a while.

i make this:

shoot = loadSound(‘assets/sound/shoot.mp3’);

function shoot() {  
shoot.play();  
}

function keyPressed(e) {  
if (key === ’ ') {  
shoot();  
}  
}

---

<div class="post-metadata">

**Author:** ![Pr0tonX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/pr0tonx/32/2590_2.png) [@Pr0tonX](https://discourse.processing.org/u/Pr0tonX)\
**Post date:** [February 14, 2021, 12:12am UTC](https://discourse.processing.org/t/high-cpu-crash-under-ios-safari-using-p5-audio-js/27798/2 "2021-02-14T00:12:53Z")

</div>

Hi,  
welcome to the processing forum !

You have actually some errors in your code when using the `keypressed` function. It does not actually expect any parameters, and you get the key by either `keyCode` either `value` (only in keyPressed). Take a look there : [reference | p5.js](https://p5js.org/reference/#/p5/keyPressed)
