Java beep wave .wav

import java.applet.AudioClip;

import java.net.URL;

import javax.swing.JApplet;

String audioResourceName = “sound/beep.wav”;
ClassLoader cl = SimEngine.class.getClassLoader();

URL resourceURL = cl.getResource( audioResourceName );
if ( resourceURL != null ) {
AudioClip sound = JApplet.newAudioClip( resourceURL );
sound.play();
} else {
System.out.println( “Resource not found[” + audioResourceName+ “]” );
} // if not null

Advertisements

~ by nambabwe on 2008/03/26.

 
%d bloggers like this: