Hi,
I'm writing an app that reads multiple LPCM channels from a multi-channel device, monitoring each channel for the presence of audio (voice-activated recording, I guess you'd call it.)
I've got the silence-detection working pretty well, but the other requirement is to take all of the channels that are currently "active" (i.e., non-silent,) and downmix them to a simple stereo output stream, which will be compressed and written to file.
I can have up to 24 channels to downmix to 2 channels at a given instant (usually 16-bit-signed, 44.1KHz).
I know I can use the "channel mapping" feature of CoreAudio, but I have to port this to other OS' when I'm done, so I'm trying to impelment the downmixing algorithm myself.
After lots of Googling and such, I've put together something like: SampleDM = (Sample1 + Sample2 + ... + SampleN) / N, for each channel.
So, adding all the samples does the trick, but getting the resultant "super-sample" back within legal 16-bit range requires something better than dividing by the number of contributing samples, since this apparently messes with the volume, among other things.
There's probably more to it than that. I've "tweaked" my algorithm in various ways, and can now barely distinguish individual contributing source channels, but there's too much crackling, popping static in the downmixed sample stream to consider it usable.
I thought this would be simple, but I guess I'm the one who's simple. :-(
Any pointers from you gurus on what a real downmixing algorithm entails would be much appreciated.
Thanks,
Bob
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden