title: Java select audio device and play .mp3
body: <p>My PC has 3 sound cards. I can select and then play a .wav file using this code</p>
  
  <pre><code>import javax.sound.sampled.*
  
  AudioInputStream audioIn = AudioSystem.getAudioInputStream(url);
  
  Mixer.Info[] arrMixerInfo = AudioSystem.getMixerInfo();
  
  // Get a sound clip resource.
  Clip clip = AudioSystem.getClip(arrMixerInfo[1]);
  
  // Open audio clip and load samples from the audio input stream.
  clip.open(audioIn);
  clip.start();
  clip.drain();
  clip.close();
  </code></pre>
  
  <p>How can I play .mp3 file?</p>