How do I convert a stereo wav to mono

audio, language-agnostic

Solution

Mixing is the average of the two channels.

f_mono = function(l, r) {  
   return (l + r) / 2;
}

Problem

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]) ?

Original source

Related problems