p5.js-sound icon indicating copy to clipboard operation
p5.js-sound copied to clipboard

loadSound pause() method working similarly to stop()

Open dannewoo opened this issue 5 years ago • 8 comments

Most appropriate sub-area of p5.js?

  • [ ] Accessibility (Web Accessibility)
  • [ ] Build tools and processes
  • [ ] Color
  • [ ] Core/Environment/Rendering
  • [ ] Data
  • [ ] DOM
  • [ ] Events
  • [ ] Friendly error system
  • [ ] Image
  • [ ] IO (Input/Output)
  • [ ] Localization
  • [ ] Math
  • [ ] Unit Testing
  • [ ] Typography
  • [ ] Utilities
  • [ ] WebGL
  • [x] Other (specify if possible)

Details about the bug:

  • p5.js version: 1.1.9
  • Web browser and version: Chrome 86.0.4240.198
  • Operating System: Mac OSV
  • Steps to reproduce this: Toggling between pause and play for when loading in sound using the loadSound function stops and starts the audio again from the beginning rather than from the place it was paused. If you use createAudio then it works properly. loadSound example not working properly: https://editor.p5js.org/dannewoo/sketches/PBnk-Hg50 createAudio example working properly: https://editor.p5js.org/dannewoo/sketches/WlVwWTGwq

dannewoo avatar Dec 03 '20 18:12 dannewoo

Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.

welcome[bot] avatar Dec 03 '20 18:12 welcome[bot]

I'm also experiencing this issue. I've also noticed that currentTime() always returns 0. Here is my example: https://editor.p5js.org/intermodal/sketches/0vNe_x4vZ

This may be a known issue, given line 742 in https://github.com/processing/p5.js-sound/blob/master/src/soundfile.js.

pdmeyer avatar Dec 25 '20 08:12 pdmeyer

A few additional notes:

  • This seems to be browser-specific. I am in Chrome 87.0.4280.88, and play() is restarting from the beginning after a pause(). However, a user in the CodingTrain discord channel tested the sketch i pasted above in Firefox v72, and it worked as is meant to (play() resumes from the point at which it was paused).
  • This issue is specific to P5.SoundFile. P5.MediaElement works as expected. I tried loading my mp3 using createAudio(), and play() resumed from the point at which it was paused

pdmeyer avatar Dec 26 '20 01:12 pdmeyer

hey, @endurance21 is this really a good-first-issue? as the problem is clearly a browser-specific one and it does not seem like a simple issue to fix to me.

satyasaibhushan avatar Feb 02 '21 14:02 satyasaibhushan

Also, I observed that in the example mentioned by @pdmeyer, song.currentTime() is also not being updated from zero in chrome but it's working fine in my safari browser.

Is this is an issue on p5 web editor or p5 sound library?

Please help me understand this.. I am fairly new to this project

satyasaibhushan avatar Feb 02 '21 14:02 satyasaibhushan

Confirmed that the issue is not isolated to the web editor.

When I run this in Chrome, it's posting an error to the console that points to the push function within the RingBuffer class, where it attempts to set sourceLength to arraySequence[0].length. It appears arraySequence is undefined.

This exact line was updated in https://github.com/processing/p5.js-sound/commit/6c54c282c87e8ce122715e3122abe510e0f9ff7e, so it seems to me like this recent version of RingBuffer.js simply needs to be merged into the sound library that is available on the CDN.

pdmeyer avatar Feb 02 '21 16:02 pdmeyer

@satyasaibhushan these are some important and feature breaking issues and I believe new comers are more enthusiastic , however there are bunch of other GFE .

You can have a look on them as well. @pdmeyer I think, we should really wait for the release and then you can test the same . We are planning to have a new release soon.

endurance21 avatar Feb 02 '21 17:02 endurance21

ok perfect, thanks @endurance21

pdmeyer avatar Feb 02 '21 18:02 pdmeyer