Access to the sound InputStream

Hello!

I want to grab bytes from a sound device using joal given a chosen device and a chosen format. Is that possible with joal? Any advice on how to achieve that?

PS: Would be nice with a wrapped up zip containing all external jar dependencies for people wanting to play around with/compile the code. I just had to give it up…

Regards,
Helge Fredriksen

If OpenAL can do it, then so can JOAL. While I’ve never used this feature myself, there are OpenAL functions which look like they’re related to capturing the sound going to the device. Whether it’s the raw waveform or the post-processed data, I’m not sure. The commands are:

  • alcCaptureOpenDevice
  • alcCaptureCloseDevice
  • alcCaptureStart
  • alcCaptureStop
  • alcCaptureSamples

There’s a bit of info in the OpenAL 1.1 spec document about how to use it. To summarize:

  • create a capture buffer using alcCaptureOpenDevice (here you can specify a format and device)
  • start audio capture using alcCaptureStart
  • when the app thinks there’s enough data in the buffer (you can query it), get it using alcCaptureSamples
  • (you can pause capturing as an optimization, using alcCaptureStop)
  • disconnect from the capture device with alcCaptureCloseDevice

Yes, sorry about that. We’ll try to improve the bits the nightly build generates this or next week.

is there perhaps a java version of this tutorial?
http://www.devmaster.net/articles/openal-tutorials/lesson8.php

hi,

you should have a look at the openal sdk capture sample (c++).
http://developer.creative.com/articles/article.asp?cat=1&sbcat=31&top=38&aid=45&file=OpenAL11CoreSDK.exe&l=1

what Ulraq didnt mention is the enumeration of the input devices. the capture sample uses “alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER);” to get a double null terminated string containing all input devices.
if you have more than one inputdevices, it would be very interesting if alc.alcGetStringImpl(NULL, ALC.ALC_CAPTURE_DEVICE_SPECIFIER) returns all of them.

Thanks for the suggestion. I’ve added ALC.alcGetCaptureDeviceSpecifiers() (in similar fashion to alcGetDeviceSpecifiers(), which was already there). This should show up in JOAL nightly builds dated 4/9 and later.

thx