# How to overlap two RAW audio signal

I hope I can find some help here.

I have started working on a little project concerning voice recordings. What I would like to is: given two audio files in RAW format (or WAV, as long as I can convert them to arrays of bytes), I would like to overlap them, that it get the RAW signal that is roughly equivalent to playing them at the same time.

Being the complete newbie that I am at signal processing, the first thing I've tried, as soon as I was able to turn my files into arrays, was to average them arithmetically ((x+y)/2) and geometrically (sqrt(x*y)). Clearly both approaces return a shriek from hell. Now I was looking into convolutions, but I don't think it is the way to go. Last I thought I could go with FFT, sum themin the transform space and then convert back, but I'm not quite sure. So here goes:

How can I overlap two RAW audio signals? That is, given two audio signals that sound good by themselves, how can I produce a new audio signal that sounds as if the former were being played at the same time?

Hope it is possible to do it using RAW audio, but other suggestions are appreciated. Thanks

• Why the downvote? Is it the wrong community? Should I ask on stack overflow? The question is clear, I did some research too but could not find anything Commented Jul 3, 2017 at 8:15
• adding the signals in time domain(sample by sample addition) while ensuring they don't add up to saturate will give you the desired effect. Commented Jul 3, 2017 at 8:39
• You mean I can add the signal element by element (i.e. just a+b) and scale them so that they stay in a reasonable range? Isn't that like doing a arithmetic mean? I'll look up saturation. Thanks for the suggestion Commented Jul 3, 2017 at 8:55
• yup, it is adding and normalizing(like arithmetic mean). in question it is mentioned that taking mean is not giving desired results, this puzzles me. if i understand the desired effect properly then, adding element by element in time domain and normalizing it should do. Commented Jul 3, 2017 at 9:44
• Tryied again, adding in time works, I was doing a wrong thing with the normalization... Thank you for the help! Commented Jul 3, 2017 at 9:49