且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

尝试播放音频(.wav)文件时无声音

更新时间:2022-04-16 02:55:23

尝试类似的方法:

File soundFile = new File( "something.wav" );
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream( soundFile );
clip = AudioSystem.getClip();
clip.open(audioInputStream);
clip.start();//This plays the audio

加载音频流后,您可能必须使用AudioSystem.getClip() .

You might have to use AudioSystem.getClip() after loading the audio stream.