Here is the example provided by the library tinySound : https://github.com/finnkuusisto/TinySound/blob/master/example/TinySoundExample.java
I read the example and wrote the basic piece of code to test its functions :
TinySound.init(); Music forest = TinySound.loadMusic("absolutepath/day.ogg"); forest.play(true);
Upon execution I get :
Unable to find resource /absolutepath/day.ogg!
I work with visual studio code and was wondering why java couldn’t find the file, even though the path put in is absolute and the resource is in the workspace.
Here is the reduced project tree structure :
/Project |------/ResourceMusic-----/forest----day.ogg |------/lib |------/bin |------/src----Main.java (location of my test of tinySound)
After tinkering around a bit, I found an alternative to absolute paths for tinySound in vsc.
It goes as follows :
File aFilesound = new File("relativePath/file.wav"); Music fileMusic = TinySound.loadMusic(aFilesound); fileMusic.play();
This way, the resource folder doesn’t need to be in the src folder for the music to work.