public static void playSoundBuffer(byte[] wavData){
  float sampleRate=11200.0f;
  int sampleSizeInBits=8;
  int channels=1;
  boolean signed=(sampleSizeInBits > 8);
  boolean bigEndian=true;
  AudioFormat format=new AudioFormat(sampleRate,sampleSizeInBits,channels,signed,bigEndian);
  SourceDataLine line;
  DataLine.Info info=new DataLine.Info(SourceDataLine.class,format);
  if (!AudioSystem.isLineSupported(info)) {
    log.warn("line not supported: " + info);
    return;
  }
  try {
    line=(SourceDataLine)AudioSystem.getLine(info);
    line.open(format);
  }
 catch (  LineUnavailableException ex) {
    log.error("error opening line: " + ex);
    return;
  }
  line.start();
  line.write(wavData,0,wavData.length);
}

public static void playSoundBuffer ( byte [ ] wavData ) { float sampleRate = 11200.0f ; int sampleSizeInBits = 8 ; int channels = 1 ; boolean signed = ( sampleSizeInBits > 8 ) ; boolean bigEndian = true ; AudioFormat format = new AudioFormat ( sampleRate , sampleSizeInBits , channels , signed , bigEndian ) ; SourceDataLine line ; DataLine . Info info = new DataLine . Info ( SourceDataLine . class , format ) ; if ( ! AudioSystem . isLineSupported ( info ) ) { log . warn ( "line not supported: " + info ) ; return ; } try { line = ( SourceDataLine ) AudioSystem . getLine ( info ) ; line . open ( format ) ; } catch ( LineUnavailableException ex ) { log . error ( "error opening line: " + ex ) ; return ; } line . start ( ) ; line . write ( wavData , 0 , wavData . length ) ; }
play a sound from a buffer
