Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (601)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (649)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Access to the sound InputStream  (Read 4165 times)
0 Members and 1 Guest are viewing this topic.
Offline helgefredriksen

Innocent Bystander

« Posted 2006-09-13 19:32:44 »


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...

Helge Fredriksen
Offline Ultraq

Junior Devvie

That's what she said

« Reply #1 - Posted 2006-09-13 21:18:00 »

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

Ultraq's Final MooCow
Bits and Pieces by Emanuel Rabina
Offline Ken Russell

JGO Coder

Java games rock!

« Reply #2 - Posted 2006-09-13 22:29:19 »

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...

Yes, sorry about that. We'll try to improve the bits the nightly build generates this or next week.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline willbracken

Junior Newbie

« Reply #3 - Posted 2007-02-03 19:31:29 »

is there perhaps a java version of this tutorial?
Offline operator

Senior Newbie

« Reply #4 - Posted 2007-02-04 09:11:01 »


you should have a look at the openal sdk capture sample (c++).

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.
Offline Ken Russell

JGO Coder

Java games rock!

« Reply #5 - Posted 2007-04-08 16:43:08 »

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.
Offline operator

Senior Newbie

« Reply #6 - Posted 2007-04-09 19:27:40 »

Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Riven (28 views)
2015-07-27 16:38:00

Riven (16 views)
2015-07-27 15:35:20

Riven (20 views)
2015-07-27 12:26:13

Riven (10 views)
2015-07-27 12:23:39

BurntPizza (27 views)
2015-07-25 00:14:37

BurntPizza (39 views)
2015-07-24 22:06:39

BurntPizza (22 views)
2015-07-24 06:06:53

NoxInc (25 views)
2015-07-22 22:16:53

NoxInc (17 views)
2015-07-22 22:13:39

Jesse (39 views)
2015-07-22 03:10:36
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!