I found this online and manipulated it to the best of my ability but I cannot get it to work.
import java.io.*;
import sun.audio.*;
/**
* A simple Java sound file example (i.e., Java code to play a sound file).
* AudioStream and AudioPlayer code comes from a javaworld.com example.
* @author alvin alexander, devdaily.com.
*/
public class SoundTest
{
public static void main(String[] args)
throws IOException
{
// open the sound file as a Java input stream
String gongFile = "C:/Users/jd186856/Desktop/SoundTest/IMALEMON.au";
InputStream in = new FileInputStream(gongFile);
// create an audiostream from the inputstream
AudioStream audioStream = new AudioStream(in);
// play the audio clip with the audioplayer class
AudioPlayer.player.start(audioStream);
}
}
Here are the error codes:
Exception in thread "main" java.io.IOException: could not create audio stream from input stream at sun.audio.AudioStream.(AudioStream.java:80) at SoundTest.main(SoundTest.java:23)
Thanks for any help in advance!!