This has to do with how loadImage
and loadSound
are implemented. The functions use something called Fetch API and have that configured in such a way that downloading of files isn’t allowed locally. Believe it or not, it’s related to security.
There’s not much you can do about it really (except patching p5.js). Running a web server (locally or elsewhere) as you did is the way to go.
If you’re interested in the technical details, read up on CORS and Fetch API.