chasep255
chasep255

Reputation: 12175

How to convert two channel audio into one channel audio

I am playing around with some audio processing in python. Right now I have the audio as a 2x(Large Number) numpy array. I want to combine the channels since I only want to try some simple stuff. I am just unsure how I should do this mathematically. At first I thought this is kind of like converting an RGB image to gray-scale where you would average each of the color channels to create a gray pixel. Then I thought that maybe I should add them due to the superposition principal of waves (then again average is just adding and dividing by two.) Does anyone know the best way to do this?

Upvotes: 2

Views: 7101

Answers (2)

Random Davis
Random Davis

Reputation: 6857

To convert any stereo audio to mono, what I have always seen is the following:

For each pair of left and right samples:

  1. Add the values of the samples together in a way that will not overflow
  2. Divide the resulting value by two
  3. Use this resulting value as the sample in the mono track - make sure to round it properly if you are converting it to an integer value from a floating point value

Upvotes: 2

Howardyan
Howardyan

Reputation: 657

i handle this by using Matlab.python can do the same. (left-channel+right-channel)/2.0

Upvotes: 2

Related Questions