当我在linux操作system.This上运行我的代码时,我得到了以下异常,代码在windows操作上运行良好,system.below是一个异常,使用的代码。
java.lang.IllegalArgumentException:无线路匹配接口片段,支持格式PCM_SIGNED未知采样率,16位立体声,4字节/帧,支持大端。
AudioFormat format = sourceaudio.getFormat();
format = new AudioFormat(
AudioFormat.Encoding.PCM_SIGNED,
format.getSampleRate(),
format.getSampleSizeInBits() * 2,
format.getChannels(),
format.getFrameSize() * 2,
format.getFrameRate(),
true);
AudioFileFormat.Type targettype = AudioFileFormat.Type.WAVE;
AudioInputStream targetaudiostream = AudioSystem.getAudioInputStream(format, sourceaudio);
sourceaudio.close();
targetaudiostream.close();
System.out.println("55555555");
URL url = new URL("http://localhost:8084/newvideo/PCMfile.wav");
Clip clip = AudioSystem.getClip();
AudioInputStream ais = AudioSystem.getAudioInputStream(url);
clip.open(ais);
System.out.println("seconds: " + (clip.getMicrosecondLength() / 1000000));发布于 2012-10-29 23:29:54
当音频设备在“设备管理器”中被禁用时,我在windows上也有同样的错误。我认为问题是-音频设备驱动程序,尝试更新或重新安装它。
https://stackoverflow.com/questions/2955637
复制相似问题