title: Java: Independently Capturing Audio From 2 Different Mic Inputs
body: <p>I am running a study where two participants will each wear a different microphone while discussing multiple topics. I need to be able to analyze each participant's audio input in Java — <strong>capturing two audio input streams independently</strong>. I cannot combine both input streams for analysis. </p>
  
  <p>Does anyone know if I can do this in Java, and how? </p>
  
  <p>I have come across <a href="http://docs.oracle.com/javase/tutorial/sound/capturing.html" rel="nofollow">this</a>, which states "Commonly, only one input port can be open at a time, but an audio-input mixer that mixes audio from multiple ports is also possible."</p>
  
  <p>Thanks</p>
  
  <p><em><strong>Edit 1</em>:</strong> 
  The capture and analysis has to be done in real-time.</p>
  
  <p><em><strong>Edit 2</em>:</strong> 
  I am using a Windows 7 64-bit operating system. My sound card has only one microphone port. I have two USB audio adapters that are similar to <a href="http://images.esellerpro.com/2485/I/831/USB-021KA.jpg" rel="nofollow">this</a>. If I cannot accomplish this in Java, what is a good alternative solution? Using a USB library has been suggested. The analysis that I will perform on the audio data is to determine the utterance rate of each speaker (how much they are talking).</p>
  
  <p><em><strong>Conclusion</em>:</strong>
  I was able to read from two TargetDataLines simultaneously by using threads in Java. Both of my USB audio adapters were visible to Java.</p>