I am currently trying to play different sounds in my program that is built on JavaFX. I have tried creating a Media and AudioClip but both just make exceptions. The file is indeed valid because AudioSystem sees the file. Here is my current loading code and the terminal output:
Code:
File f = new File("src/main/resources/Sounds/gameOver.wav");
try {
System.out.println(AudioSystem.getAudioFileFormat(f));
} catch (UnsupportedAudioFileException e) {
e.printStackTrace();
}
System.out.println(f.toURI().toURL().toExternalForm());
AudioClip gameOver = new AudioClip(f.toURI().toURL().toExternalForm());
Terminal output:
WAVE (.wav) file, byte length: 850484, data format: PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian, frame length: 212610
file:/C:/Users/Fred/IdeaProjects/GameEngine/src/main/resources/Sounds/gameOver.wav
Exception in Application start method