• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
LPCM Downmix Algorithm problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LPCM Downmix Algorithm problem


  • Subject: LPCM Downmix Algorithm problem
  • From: Bob Ingraham <email@hidden>
  • Date: Thu, 12 Aug 2010 07:31:30 -0600

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

  • Follow-Ups:
    • Re: LPCM Downmix Algorithm problem
      • From: uɐıʇəqɐz pnoqɥɒɯ <email@hidden>
  • Prev by Date: Re: Outputting Multichannel sound from stereo sources
  • Next by Date: Re: Outputting Multichannel sound from stereo sources
  • Previous by thread: Re: Outputting Multichannel sound from stereo sources
  • Next by thread: Re: LPCM Downmix Algorithm problem
  • Index(es):
    • Date
    • Thread