[quote name='Jansic' timestamp='1309859506' post='4831278']
[quote name='King Joffrey' timestamp='1309859311' post='4831277']
Summing L and R is a simple L + R. The division by 2 is erroneous as it implies that it will gain compensate the output by halving the amplitude, which it wont (for reasons I posted above).
Which is exactly right, though you probably want something that preserves the channel difference too. However, this wasn't a question of halving the volume or making a signal with the correct gain; just one of reducing a stereo stream into a mono one within the bounds of the storage - for which it's a reasonable quick-fix.
Jans.
[/quote]
Ah, I see. Well, assuming that the L and R channels are below 0dbFS then attenuating the summed mono signal by 6dB will ensure the mono signal is below 0dBFS.
@Steve: I had to google this as it's been a long, long time since I dabbled with DSP but this pseudo-code looks about right:
[source]gain = 10 ^ (attenuation_ in_db / 20)[/source]
[/quote]
I'm not sure what you mean but I tried 10 ^ ( (L+R) / 20) and it sounds like hash again...
EDIT: Maybe you mean (L + R ) - (10 ^ (6 / 20))?