1

I am working on a live music visualization project in Java (technically Processing, but we're using Eclipse) that requires audio input from multiple mics at the same time. We had a good system going with JACK (as per the answer to this question), but I would like to be independent of JACK -- it has been flaky and I simply don't trust it in a professional setting.

However, I haven't been able to access multiple lines from my DAC within Java. I can get the Mixer that corresponds to it, open a TargetDataLine, get the data from an AudioInputStream into a buffer, but this all corresponds to the first mic only. Is there a way that I can grab a different line while remaining in Java, or will I have to do some combination of C/PortAudio-or-equivalent with JNI?

Community
  • 1
  • 1
Aemilia
  • 43
  • 6
  • Can you get any and each of the desired lines at this point, but only one at a time? It seems to me you should be able to devote a unique TargetDataLine and AudioInputStream for each line, then read and combine the data from each (requires converting from bytes to PCM, and adding the PCM) and outputting the summed PCM (after converting back to bytes) via a SourceDataLine. I haven't tried getting multiple mike in's though, but mixing (summing) multiple sources (e.g., multiple synths and wav files) and outputting to an SDL has worked for me. – Phil Freihofner Nov 16 '16 at 19:55
  • @Aemilia A hint in a different direction: Can you use MaxMSP ? There's an [adc~](https://docs.cycling74.com/max5/refpages/msp-ref/adc~.html) that can take multiple audio inputs. It should be much easier to handle audio with it than Java/Processing. You can do visuals there as well using Jitter or you can send processed audio data to Processing over OSC. If the license is an issue, [PureData](https://puredata.info/) also provides ```adc~``` – George Profenza Nov 22 '16 at 15:53
  • @GeorgeProfenza That would be a lot simpler -- even just using OSC, as you recommend. Thanks; this might be the next direction we try! – Aemilia Dec 30 '16 at 22:45
  • @PhilFreihofner That's one part of it. If I make multiple TargetDataLine/AudioInputStream's that correspond to multiple USB mics, only one has any data; however, when I connect the mics via my DAC, I can only access the first mic. I'm also not sure about summing them, because I want to use the data from each line independently -- and if I understand correctly, I would lose that when I sum them? – Aemilia Dec 30 '16 at 22:50
  • It is possible to read from multiple lines in a given iteration of a while loop. What you do with the data from each is up to you. Yes, if you sum them together, they result will be the mix of those lines. But if you can only get one data line working at a time, then that option is probably moot. – Phil Freihofner Dec 31 '16 at 00:37

0 Answers0