Hey there,
I am new to processing and programming in general.
What I want to do is load a sound file in Processing P5.js and play it.
Where do I have to put my sound file in, like is there a folder on my Mac I need to put it in?
And what about this p5.sound thing??
Where do I have to put my sound file in, like is there a folder on my Mac I need to put it in?
Generally speaking storing your sound files in the same location as your sketch javascript file, or in a sub directory, are both fine. However, you will need to place it in a location that will be made available by your local web server configuration, and reference it with the appropriate relative or absolute URL. There’s a good wiki page regarding setting up a local web server. If you try to load your sketch in a web browser directly from a file (i.e. using a URL that starts with file:///) then you are going to run into difficulty because web browsers are very strict about loading resources from local files.
And what about this p5.sound thing??
p5.sound is a separate add-on library that works well with p5.js and follows the same design principles. It can be used to play sound files, synthesize tones, access microphone input, record sound files, and analyze sound frequencies. You can explore the references for this library here. Even though p5.sound is technically a separate library, it is shipped as part of each p5.js release (the current version can be referenced via https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.3.1/addons/p5.sound.min.js when including it in your sketch HTML file).