Question : How to play sounds on java
Answered by : successful-swan-8ei2b1obatm0
void playSound(String soundFile) { File f = new File("./" + soundFile); AudioInputStream audioIn = AudioSystem.getAudioInputStream(f.toURI().toURL()); Clip clip = AudioSystem.getClip(); clip.open(audioIn); clip.start();
}
Source : https://stackoverflow.com/questions/26305/how-can-i-play-sound-in-java | Last Update : Tue, 04 May 21
Question : play sound in java
Answered by : random-dude
void playSound(String soundFile) { File f = new File("./" + soundFile); AudioInputStream audioIn = AudioSystem.getAudioInputStream(f.toURI().toURL()); Clip clip = AudioSystem.getClip(); clip.open(audioIn); clip.start();
}
Source : https://stackoverflow.com/questions/26305/how-can-i-play-sound-in-java | Last Update : Tue, 01 Mar 22
Question : play sound in java
Answered by : random-dude
playSound("sounds/effects/sheep1.wav");
Source : https://stackoverflow.com/questions/26305/how-can-i-play-sound-in-java | Last Update : Tue, 01 Mar 22