<Sound Dev> Great work on the Java Sound API for Linux!

Nerius Landys nlandys at gmail.com
Sat Nov 7 02:05:37 PST 2009


Well, the OpenJDK really improves the audio situation for me on Debian
Linux.  I can now finally mix multiple audios together in the Java
program using Clip, and I can run the Java program while other audio
apps are running.

However, just wanted to point out that on my system the call
"AudioSystem.getClip()" does not work.  It's not stopping me from my
programming, but I thought perhaps it should work.

OpenJDK  Runtime Environment (build 1.6.0_0-b11)
OpenJDK 64-Bit Server VM (build 1.6.0_0-b11, mixed mode)

=============================
import java.io.*;
import javax.sound.sampled.*;

public class PlayAudios {

  public static void main(String[] args)
    throws Exception {
    // This call fails on my 64 bit Debian
    // Lenny 5.0 system, HP Z400 workstation:
    //AudioSystem.getClip();
    // It throws an IllegalArgumentException.

    for (String filename : args) {
      AudioInputStream auIn =
        AudioSystem.getAudioInputStream
        (new File(filename));
      AudioFormat format = auIn.getFormat();
      DataLine.Info info = new DataLine.Info
        (Clip.class, format);
      Clip clip = (Clip) AudioSystem.getLine(info);
      clip.open(auIn);
      clip.start();
    }
    Thread.sleep(3000);
  }

}


More information about the sound-dev mailing list