目前Java有兩種處理音頻的方法,一個是簡單的Applet的AudioClip,另一個則是有些難度的JavaSound。
以下簡單介紹AudioClip用法,相當簡單:
(1)void play() //Start the audio. Furthermore, if you call this method, the audio will start from beginning.
(2)void stop() //Stop the audio.
(3)void loop() //Start the audio and loop it.
An example:
AudioClip audioClip=getAudioClip(getCodeBase(),"directory of audio");
audioClip.play();