title: play wav files using java
body: <p>I am trying to play wav files usinf javafx on my raspbery pi, using the java sound library and the code below, i get an error as follow</p>
  
  <pre><code>javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, big-endian not supported.
  </code></pre>
  
  <p>After googleing around I found that </p>
  
  <p>big-endian audio format is not supported by the raspberry pi soundcard driver, and that i need to change the getAudioFormat() function to request a little-endian format:</p>
  
  <pre><code>boolean bigEndian = false;
  </code></pre>
  
  <p>ok so far i figured that i need the following</p>
  
  <pre><code>private AudioFormat getAudioFormat() {
  float sampleRate = 8000.0F;
  int sampleInbits = 16;
  int channels = 1;
  boolean signed = true;
  boolean bigEndian = false;
  return new AudioFormat(sampleRate, sampleInbits, channels, signed, bigEndian);
  }
  </code></pre>
  
  <p>but where do i call <code>getAudioFormat()</code> from the following code.</p>
  
  <pre><code>URL url = this.getClass().getClassLoader().getResource("Audio/athan1.wav");
  Clip clip = AudioSystem.getClip();
  AudioInputStream ais = AudioSystem.getAudioInputStream( url ); 
  </code></pre>