Answers for "how to run a sound from java program"

2

How to play sounds on java

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();
}
Posted by: Guest on April-27-2021

Code answers related to "how to run a sound from java program"

Browse Popular Code Answers by Language