# How to Unpause a sound file?

**URL:** <https://discourse.processing.org/t/how-to-unpause-a-sound-file/28565>\
**Category:** Libraries\
**Created:** [March 16, 2021, 6:01am UTC](https://discourse.processing.org/t/how-to-unpause-a-sound-file/28565 "2021-03-16T06:01:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DhawanGupta](https://avatars.discourse-cdn.com/v4/letter/d/e95f7d/32.png) [@DhawanGupta](https://discourse.processing.org/u/DhawanGupta)\
**Post date:** [March 16, 2021, 6:01am UTC](https://discourse.processing.org/t/how-to-unpause-a-sound-file/28565/1 "2021-03-16T06:01:23Z")

</div>

There is a function to [pause](https://p5js.org/reference/#/p5.SoundFile/pause) a playing sound file.  
But, how to **unpause** it?  
Whenever I try to play it after pausing, it plays from the beginning, instead from where I paused it, contrary to reference document of pause().  
I tried below commented out code.

```auto
function mousePressed() {
  if(mySound.isPlaying()){
    mySound.pause();
    curTime = mySound.currentTime();
  } else if(mySound.isPaused()){
    // amplitude = new p5.Amplitude();
    // mySound.jump(curTime);
    //mySound.loop();
    mySound.play();
  } else{
    mySound.play();
  }
  // console.log("mou")
}

```

---

<div class="post-metadata">

**Author:** ![micuat](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micuat/32/19407_2.png) [@micuat](https://discourse.processing.org/u/micuat)\
**Post date:** [March 16, 2021, 2:07pm UTC](https://discourse.processing.org/t/how-to-unpause-a-sound-file/28565/2 "2021-03-16T14:07:45Z")

</div>

Hi! welcome to the forum!

Did you try the example in the reference that you mentioned? It does work (resumes from where it was paused) for me.

Do you have a complete sketch to simulate the issue? Can you share the sound file? What version of p5.js (sound) are you using?

---

<div class="post-metadata">

**Author:** ![DhawanGupta](https://avatars.discourse-cdn.com/v4/letter/d/e95f7d/32.png) [@DhawanGupta](https://discourse.processing.org/u/DhawanGupta)\
**Post date:** [March 16, 2021, 3:05pm UTC](https://discourse.processing.org/t/how-to-unpause-a-sound-file/28565/3 "2021-03-16T15:05:31Z")

</div>

Hi! Thanks for the response.  
As suggested, I also tried the example in reference. It is not working for me.

[Here](https://replit.com/@dhawangupta/p5starter-1#sketch.js) is the link to my sketch.js.  
Sound files can be found there too.  
p5.js v1.2.0

---

<div class="post-metadata">

**Author:** ![micuat](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micuat/32/19407_2.png) [@micuat](https://discourse.processing.org/u/micuat)\
**Post date:** [March 16, 2021, 3:35pm UTC](https://discourse.processing.org/t/how-to-unpause-a-sound-file/28565/4 "2021-03-16T15:35:12Z")

</div>

ok I just noticed that it works on firefox but not on chrome. I think it’s something to do with the implementation of web audio api. maybe you can jump to the previous position to get around this problem  
[https://p5js.org/reference/#/p5.SoundFile/jump](https://p5js.org/reference/#/p5.SoundFile/jump)
