Averaging channel data

### 28.2.5 Averaging channel data

The stereo2mono command converts a multichannel audio clip to a single channel audio clip.

- stereo2mono takes A, a multichannel audio clip.
- stereo2mono(A) returns an audio clip with the input channels in A mixed down to a single channel.

  Every sample in the output is the arithmetic mean of the samples at the same position in the input channels.

#### Example

Enter:

t:=soundsec(3):; L,R:=sin(2*pi*440*t),sin(2*pi*445*t):; s:=stereo2mono(createwav([L,R]))

a sound clip with 132300 samples at 44100 Hz (16 bit, mono) |  |  |  |  |  |  |  |  |  |

Then:

playsnd(s)

Output: The sound of the single channel of the combination of L and R is played.