I've got a small Maven Java project which requires the playing of a WAV file, and so I'd prefer to simply put the file into the src/main/resources/*
folder for simplicity. However, if the same WAV file which works fine being loaded from disk using AudioSystem.getAudioInputStream(...)
is then put in the Maven resources directory, the program throws an instance of RIFFInvalidDataException:
com.sun.media.sound.RIFFInvalidDataException: Chunk size too big
at com.sun.media.sound.RIFFReader.<init>(RIFFReader.java:82)
at com.sun.media.sound.WaveFloatFileReader.internal_getAudioFileFormat(WaveFloatFileReader.java:65)
at com.sun.media.sound.WaveFloatFileReader.getAudioFileFormat(WaveFloatFileReader.java:55)
at com.sun.media.sound.WaveFloatFileReader.getAudioInputStream(WaveFloatFileReader.java:117)
at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1113)
at se.kth.speech.coin.tangrams.TangramsClient.playSound(TangramsClient.java:276)
at se.kth.speech.coin.tangrams.TangramsClient.signalGameStart(TangramsClient.java:335)
... 17 more
Moreover, if I use VLC to try to open the WAV file at $PROJECT/target/classes/org/coolproject/audio/
, the program actually crashes; The original file is handled without any problems
What on Earth is Maven doing with my audio file(s)? I'm using version 3.3.9/1.7.0.20160603-1931 embedded in Eclipse Neon.3 v4.6.3 (build 20170314-1500) and unfortunately cannot try building the project with a "proper" Maven instance outside of Eclipse because building depends on a nightmare hybrid of an old Eclipse project including both Java source and pre-compiled DLLs and a Java-only Maven project.