[SciPy-user] Help with array functions

Bob.Cowdery at CGI-Europe.com Bob.Cowdery at CGI-Europe.com
Tue May 4 04:20:37 CDT 2004

Hi all,
Can anyone help me convert this loop to an array function. I can't have
loops in my signal processing as they take far too much processing power.
This is a fragment from a speech processor using Ferkins formula.
Essentially the gain array (m_procGain) which is 2048 long (m_sampl_sz)
needs its nth element processing into it's (n-1)th element. This is
eventually used to multiply the samples in m_complexout, the first 2048
elements of this are used. Attack is a scaler currently 0.4.
                peak =
                i = arange(1,self.m_sampl_sz)
                for x in i:
                    if abs(self.m_complexout[x-1]) > 0:
                       self.m_procGain[x] = ( (self.m_procGain[x-1] * (1 -
attack)) + ((attack * peak) / abs(self.m_complexout[x-1])) )         
                       if self.m_procGain[x] > level:
                           self.m_procGain[x] = level
                       self.m_procGain[x] = 1

Thanks for any assistance.
Bob Cowdery
CGI Senior Technical Architect
+44(0)1438 791517
Mobile: +44(0)7771 532138
bob.cowdery at cgi-europe.com <mailto:bob.cowdery at cgi-europe.com> 

*** Confidentiality Notice *** Proprietary/Confidential
Information belonging to CGI Group Inc. and its affiliates
may be contained in this message. If you are not a recipient
indicated or intended in this message (or responsible for
delivery of this message to such person), or you think for
any reason that this message may have been addressed to you
in error, you may not use or copy or deliver this message
to anyone else.  In such case, you should destroy this
message and are asked to notify the sender by reply email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.scipy.net/pipermail/scipy-user/attachments/20040504/33aefcd0/attachment.htm

More information about the SciPy-user mailing list