I have two mono audio channels (pcm format) of audio call, incoming and outgoing. how to mix them? how to position them in space? (e.g. incoming channel sounds slightly on the left and outgoing on the right)
Asked
Active
Viewed 8,889 times
5
-
1Good spacial stereo requires a delay on one of the channels. At most the space between your ears divided by the speed of sound. – Hans Passant Dec 31 '10 at 00:48
2 Answers
5
Mixing is just a weighted addition of both signals. So if you want them to be equal in one mono signal, lower both signals by a factor of 2 and add them. If you want to position them in the stereo space, use different weighting on the left and right channel. For example 0.6 of signal 1 and 0.4 of signal 2 on the left channel and vice versa on the right channel will do the trick. For better results, a slight timeshift would be necessary, but that depends on your needs.

groovingandi
- 1,986
- 14
- 16
-
yeah, I did that (0.5 + 0.5) and received lower volume, why? so I had to just add them (1 + 1) and check for overflow - if the sum is not >32768. in this case I received good volume, but I don't understand why 32768 and not just 65536, and if 32768 is right value. – Andriy Tylychko Dec 30 '10 at 23:56
-
1@gro: Why the division? Two violins playing the same thing should actually be louder than one violin, right? – fredoverflow Dec 30 '10 at 23:57
-
3
-
+32767 is the largest signed 16-bit value that can be used. 65535 would be for unsigned values. – Michael Dorgan Dec 31 '10 at 01:25
-
4Addition of sound samples is not a good practice in sound mixing. One should fourier-transform both channels, sum two spectra, then transform the result back to time domain. – mbaitoff Dec 31 '10 at 06:41
-
-
zillions of links, at least here: http://local.wasp.uwa.edu.au/~pbourke/miscellaneous/dft/ – mbaitoff Jan 01 '11 at 18:53
-
-
@FredOverflow: Right, theoretically two signals mixed together are louder than the indiviual signals alone. I added the division because I assumed normalized digital signals using the full dynamic range, so the sum would overflow – groovingandi Jan 04 '11 at 14:09
-
@mbaitoff: do you have any explanation why the addition in frequency domain would be better than in time domain? – groovingandi Jan 04 '11 at 14:11
-
1@groovingandi: this avoids overflows and avoids ringing - appearance of additive and subtractive frequencies that do not exist in original spectra – mbaitoff Jan 04 '11 at 18:30
-
@mbaitoff: I can't find any sources on the web that explain it in more detail. Do you have any links? – groovingandi Jan 05 '11 at 16:16
-
no, can't help with any links, it's just reminiscences after reading ru.sound echoconference ten years ago. – mbaitoff Jan 06 '11 at 17:45
0
Stereo PCM is just left and right interleaved, first all the bytes for one sample of the left channel then all the bytes for one sample on the right channel.

BrokenGlass
- 158,293
- 28
- 286
- 335