public static void main(String[] args) {
try{
File file = new File("audiodata/test.wav");
AudioInputStream ain = AudioSystem.getAudioInputStream(file);
AudioFormat format = ain.getFormat();
DataLine.Info info = new DataLine.Info(Clip.class, format);
Clip clip = (Clip) AudioSystem.getLine(info);
clip.open(ain);
clip.start();
}catch(Exception e){
e.printStackTrace();
}
}
I have written this simple main method to play the sound file, but it does not work. There is no Exception thrown. The program ends and I cannot hear anything. I have no idea, what my mistake is. Also creating the Clip by AudioSystem.getClip();
does not change anything.