Subject: Re: [linux-audio-dev] Combining audio streams
From: Paul Davis (pbd_AT_Op.Net)
Date: Fri Feb 08 2002 - 18:18:43 EET
>I am new to audio programming, so please excuse that I am asking the basics
>here, but I could not find an answer elsewher in the web (probably because
>its too simple :-)
>
>I have written a few applications which need to output audio at the same
>time. So I need a simple audio mixer which combines the different audio
>streams (all are 16kHz, 16bit, signed linear) and writes them to /dev/dsp.
>How can I do this?
if the incoming signals are so "hot" that adding them up as 16 bit
integers causes them to overflow, then you cannot mix them on a 16 bit
device without attenuating them somewhat. what level of attenuation
you provide is up to you (and/or the user).
>If there are say two input streams, and I simply add the 16bit shorts from
>both streams, I get lots and lots of overflows. If I divide each stream by
>two before adding them, it sounds very bad.
thats a pretty large degree of attenuation (-6dB). you might try
something smaller. the basic problem, however, is that you've got
signals that are too hot to be represented as a summed value in 16 bits.
also, given what you describe as the basic problem, why are you not
using esd, artsd, ALSA "share" or jack (jackit.sf.net) ? why are you
reinventing the wheel?
--p
This archive was generated by hypermail 2b28 : Fri Feb 08 2002 - 18:10:07 EET