views:

532

answers:

2

If I already have the wav data in two arrays (left channel & right channel) how does one go about to converting them to a single mono array?

Is there a function f so that Mono[x] = f(L[x],R[x]) ?

+3  A: 

Just take an average of both value.

J-16 SDiZ
Unfortunatly you lost the coinflip of who would get the "select answer". But I voted you up instead.
Nifle
+3  A: 

Mixing is the average of the two channels.

f_mono = function(l, r) {  
   return (l + r) / 2;
}
Mark Renouf
That simple ....
Nifle
Something to keep in mind: suppose you have a stereo file where there is a left-only sound and a center sound, which originally are perceived to have equal volume. When you linearly add the two channels together, the center sound will instead be perceived as louder. (Run the sound wave energy calculations with two point speakers and one mic, and then move the speakers together.) I don't have any clever ideas as for how to avoid this, though.
ephemient
It's not an issue thankfully. The audio is just a visual aid for timing issues. The original audio file is used when playing the ausdio. I just wanted to convert to mono to ease the calculation of the waveform. See http://stackoverflow.com/questions/1035533/how-do-i-visualize-audio-data
Nifle