[SciPy-User] performant envelope follower

henry lindsay smith henrylindsaysmith@gmail....
Fri Sep 17 08:44:45 CDT 2010


I have the following code backported from C envelope follower and converted
into python code (using numpy arrays)

        for i in range(len(self.m_signal)):

            envIn=np.abs(self.m_signal[i]**2)#square for energy

            if(self.envelope < envIn):

                self.envelope *= self.m_ga

                self.envelope +=(1-self.m_ga)*envIn

            else:

                self.envelope *= self.m_gr

                self.envelope +=(1-self.m_gr)*envIn

            self.sigEnv[i]=self.envelope


it runs but slowly as I am iterating through the whole signal which is
pretty slow in python (but super fast in C)

Can anyone think of a more efficient way to run this possibly as as a
filtering operation? I need the same result as I'm going to port back into C
at somepoint.

thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100917/858d353c/attachment.html 


More information about the SciPy-User mailing list