Skip to content

Old p5.sound + p5 2.0 throws an error, but it's very hard to switch #3513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
davepagurek opened this issue Jun 6, 2025 · 1 comment
Open
Labels
Awaiting Maintainer Approval Needs review from a maintainer before moving forward Bug Error or unexpected behaviors

Comments

@davepagurek
Copy link
Contributor

p5.js version

2.x

What is your operating system?

Mac OS

Web browser and version

Firefox

Actual Behavior

Currently, if you switch the p5 version to 2.0 and then run the default sketch, you get this error in the browser console:

Image

This is coming from the old p5.sound, made for 1.x. However, there isn't a way to easily switch it to the new p5.sound. Turning it off and on again uses the old p5.sound still, since we currently try to restore whatever the original version was in a sketch:

Image

Definitely not obvious, but if you turn off p5.sound, save, and reload, and then turn it back on, THEN it turns on the new p5.sound which works with 2.0.

Expected Behavior

I'm not sure what the best way forward here is, I'd appreciate your input @ksen0 and @raclim! Some options I can think of:

  • Auto-update from old p5.sound to new p5.sound when you switch to 2.0
    • Downside: either there's no easy way to switch back to the old p5.sound if you go back to 1.x, or our existing logic keeping track of the last version of p5.sound you had needs to change to handle this special case
  • Auto-disable p5.sound when you switch to 2.0 and remove the feature where we keep track of the previous p5.sound version
    • This would mean toggling back on p5.sound would use the new version when you're in 2.x
    • If you change back to 1.x and then turn on p5.sound again, you'd get the default version of old p5.sound and not whichever specific version you were previously using

Steps to reproduce

  • Switch p5 version to 2.0
  • p5.sound is still the old version in index.html
@davepagurek davepagurek added Bug Error or unexpected behaviors Awaiting Maintainer Approval Needs review from a maintainer before moving forward labels Jun 6, 2025
@ksen0 ksen0 added this to p5.sound.js Jun 7, 2025
@ksen0 ksen0 moved this to Todo in p5.sound.js Jun 7, 2025
@ksen0
Copy link
Member

ksen0 commented Jun 7, 2025

Since older p5.sound.js is not compatible with 2.0 (and also the documentation is pretty split - 2.0 site has new sound, 1.x site has old sound) and the goal of the tracking previous version was to prevent accidental significant damage to 1.x sketches, what to you think about the following updates?:

  1. Auto-disable p5.sound when you switch to 2.0 and remove the feature where we keep track of the previous p5.sound version as described above
  2. Update copy under main library and next to sound to link to the reference; the link and link text should correspond to the right version. "You can find the p5.sound.js version compatible with p5.js 2.0.3 here: bets.p5js.org"
  3. Once new p5.sound.js is more widely rolled out with more resources, then reinstate some version of the "last version" toggle but default in all sketches (also 1.x - compatibility is not an issue) to the new sound.

For some more context, p5.sound.js is starting to have more active volunteer development, and the aim is to release on npm as "2.0" so it can also be called "2.0" - though right now it's 0.2.0. The main prerequisite to that release would be FES-style console.log explanations for functions that are missing from 1.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Maintainer Approval Needs review from a maintainer before moving forward Bug Error or unexpected behaviors
Projects
Status: Todo
Development

No branches or pull requests

2 participants