How to save audiofiles manipulated by OpenAL?

Started by r0bse, January 16, 2013, 14:48:27

Previous topic - Next topic

r0bse

Hello @ all,

the following text is a copy of my question at Stackoverflow. But since you guys should be more familiar with that kind of problem I'm asking it here to.

In my current project, I need to be able to manipulate Wave - Files. They consist of a recorded voice, which is to be anonymized. My first idea was to change the pitch and the speed, but it seems that the Java Sound API does not support something like that. I thought some basic sound manipulation would be easily possible with Java... Well it doesn't matter if there are other possibilities.

After a little research I found the OpenAL Library and the corresponding manual OpenAL Programmers Guide. So far I'm able to change the pitch, gain asf. and even add some minor effects with LWJGL (JOAL works too). If I want to listen to the result I just need to call:

AL10.alSourcePlay( int source );

But I want to save the manipulated audiofile. As far as I understand it, I need to get the datastream and work with that. After studying the manual and the sources, the only function which looks like it would something support like that, is:

ALC11.alcCaptureSamples( ALCdevice device, ByteBuffer buffer, int samples );

But the examples I found so far, suggest that this function is more used to capture inputstreams and not for manipulated sources. So the question is: Is it even possible to save a manipulated audiofile? And if it is, what would be the right approach?

basil

I guess you will not be too happy with openAL doing that. The caputure command you're pointing is about recording input from your audiodevice.

At the end of the day openAL is ment to be a pure 3D positional audio system. with 'sources' that emit 'sound' captured by a 'listener'. Not too sure but I think nor custom DSP or virtuall output/group channels are supported. That's maybe what you want, a dummy-listener (output) or DSP effect routing into a user defined stream.

Maybe you are better of with fmod. It's pretty easy to do sub-mixing or sound splitting (routing) and catching the audio stream at any point you want. A simple Idea would be a self made pass-through effect encoding the data into some audiofile. More simple, init a fmod soundsystem with output set to FMOD_OUTPUTTYPE_WAVWRITER.