Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'skip:[ 20': 0.03; 'mrab': 0.05; 'that?': 0.05; '[1,': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'value.': 0.15; '2],': 0.16; '[2,': 0.16; 'dashes.': 0.16; 'decoding': 0.16; 'dots': 0.16; 'numpy': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'code.': 0.20; 'import': 0.21; 'cc:2**0': 0.23; 'monday,': 0.23; 'cc:no real name:2**0': 0.24; 'command': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'looks': 0.26; 'received:209.85.212': 0.28; 'array': 0.29; 'probably': 0.29; "i'm": 0.29; 'received:google.com': 0.34; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'should': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'think': 0.40; 'maximum': 0.63; 'sum': 0.66; 'skip:n 30': 0.69; 'average.': 0.84; 'stereo': 0.84; 'received:209.85.212.56': 0.91 Newsgroups: comp.lang.python Date: Mon, 10 Sep 2012 13:14:18 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=65.205.52.2; posting-account=_dIAQQoAAAB7Yieol6fmkK_HviJUbJt3 References: User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 65.205.52.2 MIME-Version: 1.0 Subject: Re: Numpy combine channels From: Wanderer To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 56 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1347308061 news.xs4all.nl 6959 [2001:888:2000:d::a6]:39290 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28851 On Monday, September 10, 2012 4:12:40 PM UTC-4, MRAB wrote: > On 10/09/2012 20:39, Wanderer wrote: > > > 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? > > > > > >>> import numpy > > >>> numpy.array([[1,1],[1,2],[2,3]], dtype="i") > > array([[1, 1], > > [1, 2], > > [2, 3]]) > > >>> a[:, 0] > > array([1, 1, 2]) > > >>> a[:, 1] > > array([1, 2, 3]) > > >>> a[:, 0] + a[:, 1] > > array([2, 3, 5]) > > > > But should they be added together to make mono? > > > > Suppose, for example, that both channels have a maximum value. Their > > sum would be _twice_ the maximum. > > > > Therefore, I think that it should probably be the average. > > > > >>> (a[:, 0] + a[:, 1]) / 2 > > array([1, 1, 2]) I'm decoding morse code. So it's CV dots and dashes.