def initImpulseResponse(self, window):
if self.bandType == 'allpass':
self.impulseResponse = windows.kroneckerDelta(self.order+1)
elif self.bandType == 'allstop':
self.impulseResponse = np.zeros_like(window)
elif self.bandType == 'lowpass':
hightaps = self.high*self.taps
self.impulseResponse = self.high*np.sinc(hightaps) * window
elif self.bandType == 'highpass':
lowtaps = self.low*self.taps
self.impulseResponse = (-self.low*np.sinc(lowtaps) * window +
windows.kroneckerDelta(self.order+1))
elif self.bandType == 'bandpass':
lowtaps = self.low*self.taps
hightaps = self.high*self.taps
self.impulseResponse = (self.high*np.sinc(hightaps) -
self.low*np.sinc(lowtaps)) * window
elif self.bandType == 'bandstop':
lowtaps = self.low*self.taps
hightaps = self.high*self.taps
self.impulseResponse = ((self.high*np.sinc(hightaps) -
self.low*np.sinc(lowtaps)) * window +
windows.kroneckerDelta(self.order+1))
else:
raise Exception('Invalid bandType: ' + str(self.bandType))
self.impulseResponse = self.impulseResponse.astype(self.dtype, copy=False)
评论列表
文章目录