Filtering low frequencies by using lfilter_zi and resample

4 views
Skip to first unread message

William Tordjman

unread,
May 2, 2019, 4:39:41 PM5/2/19
to SciPy-user
Hi everyone, 

I'm working on the real time equalizer which uses pyaudio, scipy, numpy modules. 

I built a third octave band filter which split my initial signal into N bands and then apply a IIR band pass filter for each band. 

When I played a sound with pyaudio in real time (so mys signal is buffering) and applied my third octave band filter, I had some clic between each buffer. I make some researches and I found my problem (https://stackoverflow.com/questions/52468563/continuity-issue-when-applying-an-iir-filter-on-successive-time-frames) : because I was using an IIR filter, i would need to persist the state of my filter from one block to the next. 

So, I'm using now the function lfilter_zi (I used filtfilt before) to keep continuity between each block. 

My question is : It works well for high frequencies but not at all for low frequencies because I need to follow these steps :

1) downsampling input signal (to keep a good definition's filter);

2) filtering with lfilter_zi to keep continuity between each block (for streaming);

3) upsampling the filtered signal.

My problem is the upsampling because that breaks the continuity between each block and I don't know how to figure it out. 


Thanks for your help !

Reply all
Reply to author
Forward
0 new messages