Hi , I am trying to play a .wav file with java. I need it when a button is pressed to play a short beep sound. I have google it but most of the code wasn't working. Can someone give me a simple code to play a .wav file.
+1
A:
The snippet here works fine, tested with windows sound:
public static void main(String[] args) {
AePlayWave aw = new AePlayWave( "C:\\WINDOWS\\Media\\tada.wav" );
aw.start();
}
stacker
2010-03-10 13:12:45
If you still have issues with that try to change the sound device. See also the tool recommended here http://stackoverflow.com/questions/2175318/how-to-change-default-sound-playback-device-programatically/2216886#2216886
stacker
2010-03-10 13:32:42
+1
A:
Have a look at the open source project jlGui at http://www.javazoom.net/jlgui/jlgui.html which has a BasicPlayer that supports "MP3, OGG Vorbis, FLAC, MONKEY's AUDIO, WAV, AIFF, AU and SPEEX audio formats".
Kennet
2010-03-10 13:57:13
A:
The code here works great for my project. Check it out. http://forums.sun.com/thread.jspa?threadID=5196428
anothem
2010-03-11 20:36:32