anotherworld
0
Q:

how to play an audio in java

AudioInputStream input = new AudioInputStream(Path_to_the_file);
Clip clip=AudioSystem.geClip();
clip.open(input);
Clip.loop(Clip.LOOP_CONTINUOSLY);
clip.start();
0
import java.applet.*;
AudioClip ac = getAudioClip(getCodeBase(), soundFile);
ac.play();   //play once
ac.stop();   //stop playing
ac.loop();   //play continuously
0

New to Communities?

Join the community