Change:
/************/
InputStream is = getClass().getResourceAsStream(s);
AudioInputStream ais;
BufferedInputStream bis = new BufferedInputStream(is);
ais = AudioSystem.getAudioInputStream(bis);
/************/
To something like:
/************/
URL url = getClass().getResource(s);
AudioInputStream ais;
ais = AudioSystem.getAudioInputStream(url);
/************/
It will work because getResourceAsStream
typically returns a non-repositionable input stream, whereas if you provide the URL to the AudioSystem
, it can establish as many streams as it wants from the URL, or wrap it in a repositionable stream.