如何在JAVA中使用音频文件

在JAVA中使用简单的音频文件可以通过文库sun.audio来被处理:

import sun.audio.*;

public class AudioExample{
public static void main(String[] args) {

        String mFlie = "C:\\Users\\lenovo\\Desktop\\ceshi.wav";
        try{
            InputStream in = new FileInputStream(mFlie);
            sun.audio.AudioStream as = new sun.audio.AudioStream(in);
            sun.audio.AudioPlayer.player.start(as);
        }
        catch (Exception e){
            e.printStackTrace();
        }
    }
}

你可能感兴趣的:(浅谈JAVA,java)