0

I am unable to play a multi channel wave file in java using javax.sound.sampled package. I am using an external USB 7.1 surround sound card from logilink. The wave file is generated by myself. If I generate a stereo track, I am able to play the file. If I use the 6 channel track, I get the following error message:

javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED     48000.0 Hz, 16 bit, 6 channels, 12 bytes/frame, little-endian not supported.

I checked if the line is supported and it is by using this code

AudioFormat format = new AudioFormat(48000, 16, 6, true, false);
DataLine.Info info = new DataLine.Info(TargetDataLine.class, format);
if (info.isFormatSupported(format)) {
  // is supported
}

I play the wave file as follows:

AudioListener listener = new AudioListener();
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(clipFile);
Clip clip = null;
clip = AudioSystem.getClip();
clip.addLineListener(listener);
clip.open(audioInputStream);
clip.start();

Any idea what is wrong?

Denysole
  • 3,903
  • 1
  • 20
  • 28
Johan
  • 101
  • 1
  • 9
  • I guess that's the key part of the error message: "little-endian not supported". Not an expert in wav files, but the place where you generate the file - is there a setting for big-endian there? – Grzegorz Oledzki Jan 04 '18 at 10:00
  • Hi Grzegorz, thanks for replying. I am just creating a wave file with some simple tones. I am setting the wave file header by my own, so maybe I can change the endian. I must admit I was also thinking, it could be the endian thing but did not look into it if I am really able to change it... – Johan Jan 04 '18 at 10:49
  • The strange thing is, if I change in the header wave file from multi channel to stereo, I am able to play the wave file. – Johan Jan 04 '18 at 12:44

0 Answers0