Numpy combine channels

Nick Cash nick.cash at npcinternational.com
Mon Sep 10 15:50:09 EDT 2012


> I have an array generated by audiolab of left and right stereo
> channels. It looks like [[1,1],[1,2],[2,3]]. I would like to combine
> the left and right channels to get an array [2,3,5]. Is there a numpy
> command to do that?

You may be over-thinking this, and numpy might not be necessary.

A simple solution would be just a quick list comprehension:

stereo_array = [[1, 1], [1, 2], [2, 3]]
mono_array = [l+r for (l, r) in stereo_array]

Thanks,
Nick Cash





More information about the Python-list mailing list