0
0

Hi everyone,

I have found out how to get the raw PCM data using FMODX, but now comes the (probably) difficult part.

I am wondering how I am to convert a stereo audio file to a mono file?

Help is very much appreciated.

Yours sincerely,

Peter.

  • You must to post comments
0
0

Just average the left and right
[code:328wm1va]
for (i = to to length-1)
{
monoout[i] = stereoin[i2] + stereoin[i2 + 1] / 2;
}
[/code:328wm1va]

  • You must to post comments
0
0

Thanks, Brett.

I guess the int should be
initialized to 0 and I assume it is bytes?

Why do you need the [i*2] in the array subscript? (just curious).

Thanks,

Peter.

  • You must to post comments
0
0

yes it is 0, and no it is not bytes, it is samples.
pointers (monoout and stereoin) are whatever size your sample data is (ie signed short = 16bit). *2 is for stereo, it is selecting left and right (data is interleaved l/r/l/r/etc). See the intro tutorial in the fmod documentation for more on sound formats.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.