Question

How does Javasound handle multiple microphones? Is it possible to select one of multiple microphones? How does one determine which microphone is being used? Is the input of multiple microphones even handled by the Java Virtual Machine? Finally, is this method standardized across operating systems or does the OS affect what the JVM hears. Here is the code I am currently using to generate a TargetDataLine from the microphone.

DataLine.Info dataLineInfo = new DataLine.Info(TargetDataLine.class, getAudioFormat());
setTargetDataLine((TargetDataLine) AudioSystem.getLine(dataLineInfo));
Was it helpful?

Solution

I believe separating out various microphone inputs depends on whether or not these mikes are exposed to Java via their own lines or ports.

The tutorial section named Accessing Audio System Resources will provide you with the means of identifying what Java is able to "see." It is the first main section after the overview intro. If you list the info for each, hopefully you will be able to identify each mike line (assuming your sound card and OS are configured to allow this).

Agreed, the Audio tutorial is one of the most difficult! In part, this is because audio IS difficult, complicated by the various OS's that it must run on as well as intervening hardware and software. Different sound card and OS combinations can work in different ways. At some stage they have to expose lines or ports to Java. I'm not aware of any multiplexing systems (two or more mikes somehow sharing a single line or port). I'm also not clear on whether it is the lines or ports that you need to focus on.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top