Skip to content

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

Closed
@davepagurek

Description

@davepagurek
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

Activity

moved this to Todo in p5.sound.json Jun 7, 2025
ksen0

ksen0 commented on Jun 7, 2025

@ksen0
Member

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.

davepagurek

davepagurek commented on Jun 10, 2025

@davepagurek
ContributorAuthor

That sounds good to me!

self-assigned this
on Jun 10, 2025
raclim

raclim commented on Jun 10, 2025

@raclim
Collaborator

This sounds good to me as well! Thanks so much @ksen0 and @davepagurek!

ksen0

ksen0 commented on Jun 11, 2025

@ksen0
Member

Thank you @davepagurek for putting together the PR! Though the "last version" code is being removed, the above idea is to reinstate it in the future. What do you all think about making an issue documenting what remains to be done ~year from now? All the necessary detail is already in the issue+PR, so I'm more asking about making sure that it is revisited. Or what would be a better way to track this (keeping this issue open?)?

moved this from Ready for Work to In Progress in p5.sound.json Jun 11, 2025
davepagurek

davepagurek commented on Jun 11, 2025

@davepagurek
ContributorAuthor

Maybe we could have a column in our project management board for items to do before 2.0 becomes default, and then put in an issue there? I'm not sure yet what else will go in there but I assume we'll have more things like this (something related to the beta website probably?)

moved this from In Progress to Done in p5.sound.json Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugError or unexpected behaviors

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @ksen0@davepagurek@raclim

    Issue actions

      Old p5.sound + p5 2.0 throws an error, but it's very hard to switch · Issue #3513 · processing/p5.js-web-editor