How to sample multi-channel sound input in Java
Asked Answered
S

4

8

I realised this might be relatively niche, but maybe that's why this is good to ask anyway. I'm looking at a hardware multiple input recording console (such as the Alesis IO 26) to take in an Adat lightpipe 8 channel input to do signal processing. As I have yet to acquire the device and need to work out whether this is feasible (budgetary concerns), I'd like to ask if anyone has any experience tapping all these 8 inputs for data in Java? I've seen tons of examples of recording sound using the Javax.sound.sampled libraries but I couldn't find any information on multichannel that is more than 2. What I'm interested in is sampling the 8 channels individual as mono source to perform some simple DSP on them. Would the hardware device be treated as one mixer? And the 8 channels be represented as 8 lines? I hope I got my terminology right.

I would appreciate if someone can point me to any relevant information. Thanks!

Sporocyte answered 12/1, 2009 at 8:36 Comment(0)
D
3

Multi-channel audio is supposed to be possible in Java depending on the version of Java you are running, the platform you are running on, and the type of soundcard you are running. See the excellent Java Audio Faq For more details. I've never been able to use this reliably across all platforms.

If you really care about doing robust multichannel audio, I would recommend using a C API, such as PortAudio, Juce, or PulseAudio.

I've had excellent luck with PortAudio and Juce both.

To use these in Java you would need to create a JNI interface to the C APIs.

This obviously is more work than just using javax.sound, but it gives you a lot more control over the audio hardware you are using. In my experience dealing with audio devices, being too far removed from the hardware (i.e. 4 layers of abstraction instead of 2) often removes your ability to do serious multi-channel, high bit depth, high sample rate audio.

Devoid answered 2/2, 2009 at 20:59 Comment(2)
Thanks Nick for pointing me the right way. java.sampled has a limitation of 2 channels. I currently have a working program in Java using PortAudio using JPAB (Java PortAudio Bindings). I'm running Windows Vista with M-Audio ProFire 2626 using ASIO drivers and I can get separate channels.Sporocyte
Sweet, I didn't even know about JPAB. Very nice wrapper around PortAudio.Devoid
B
1

I have implemented something similar with Terratec cards cascaded to 32 inputs, the only library at the time was Jsyn.

Its a really good library once you get to know it.

http://www.softsynth.com/jsyn

I am not sure if there is anything else that can help.

Brigitte answered 30/1, 2009 at 9:59 Comment(0)
T
1

I have just added a Java JNI wrapper for PortAudio. The plan is to maintain this along with PortAudio source. PortAudio supports multi-channel audio where N>2.

Today, 9/3/12, JPortAudio is still in alpha mode. By the time you read this it may be stable.

http://www.portaudio.com/docs/v19-doxydocs/java_binding.html

Twink answered 3/9, 2012 at 23:39 Comment(0)
L
0

I cannot give you an answer directly to whether the javax.sound API works with multi channels (But according to the API doc it should).

However, I've gone another way for multi channel audio processing with Java, that may be working for you as well. I used Jack (Jack Audio Connection Kit) to channel the signals from and to the audio device and then the JJack library to perform signal processing. You did not mention your target OS. I used this approach successfully under Linux. AFAIR there was a Windows port for Jack on the way.

ciao, elm

Lobate answered 28/1, 2009 at 14:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.