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

loadSound is not defined in preload() in 1.11.11

Open bsack23 opened this issue 2 weeks ago • 1 comments

Most appropriate sub-area of p5.js?

  • [ ] Accessibility
  • [ ] Color
  • [ ] Core/Environment/Rendering
  • [x] Data
  • [ ] DOM
  • [ ] Events
  • [ ] Image
  • [ ] IO
  • [ ] Math
  • [ ] Typography
  • [ ] Utilities
  • [ ] p5.strands
  • [ ] WebGL
  • [ ] DevOps, Build process, Unit testing
  • [ ] Internationalization (i18n)
  • [ ] Friendly Errors
  • [ ] Other (specify if possible)

p5.js version

1.11.11

Web browser and version

chrome 143

Operating system

mac os 15.6.1

Steps to reproduce this

Steps:

  1. declare a variable
  2. use loadSound() in function preload() to assign
  3. error: loadSound is not defined

all versions prior to 1.11.11 support loadSound()

Snippet:

let beat; function preload() { beat = loadSound('sounds/worm.mp3'); }

bsack23 avatar Dec 03 '25 18:12 bsack23

Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, please make sure to fill out the inputs in the issue forms.

For guidance on contributing, check out our contributing guidelines and other resources for contributors. 💬 If you have questions or need support, feel free to join the Processing Foundation Forum or visit our Community page. 📜 Please also review our Code of Conduct to understand our community standards. Thank You!

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

Could not recreate the issue. Works fine on my system which is ubuntu using a cdn. Make sure if your are using cdn you include

Om-A-osc avatar Dec 14 '25 07:12 Om-A-osc

Hi! This is an issue with the cdnjs version of p5, which is a bug with them unfortunately. Unfortunately that's the current CDN that the web editor uses for p5.sound, but see this issue for progress on that: https://github.com/processing/p5.js-web-editor/issues/3728

davepagurek avatar Dec 15 '25 13:12 davepagurek

A secondary issue is that the default project setup (when using editor.p5js.org) calls sound lib 1.11.11 (which, as reported, doesn't allow loading sound file). If possible, until this is fixed - to revert the dev env to use 1.11.10 for projects to work. Most students don't aware of this option themselves... simple example: https://editor.p5js.org/tau1arnony/sketches/yjAKxv40j

arnony avatar Dec 17 '25 12:12 arnony

Fixing the CDN should resolve this, I've put up a PR here: https://github.com/processing/p5.js-web-editor/pull/3758

davepagurek avatar Dec 17 '25 13:12 davepagurek