4

I m getting following exception while running my code on linux operating system.This code works fine on windows operating system.below is the exception and code used.

java.lang.IllegalArgumentException: No line matching interface Clip supporting format PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, big-endian is supported.

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));
Phonon
  • 12,549
  • 13
  • 64
  • 114
angelina
  • 111
  • 1
  • 4
  • 8

1 Answers1

0

I have the same error on windows when audio devices are disabled in "device manager". I think the problem is - audio device driver, try to update or reinstall it.

Mikhail.Mamaev
  • 7,879
  • 5
  • 24
  • 28