# Difference in output between digital codec and analog filter

I'm working on a project which deals with filtering audio signals with a Low Pass Filter and amplifying the output. Currently, we are solving this using the TLV320AIC3111 audio codec by Texas Instruments, controlled by an STM32L476RG.

Using TI's proprietary software PurePath Studio, I've coded this filter below.

Our test setup is described below

Function Generator -> External Class D Amp -> External Speaker -> Microphone(codec input) -> Codec -> Speaker(codec output) -> External Microphone -> Oscilloscope


Using basic python code, we plotted the frequency response graph as below.

However, when we directly connect the frequency generator to the codec and the speaker output to the oscilloscope, we get a much better response as below.

When I connect the external speaker to the external microphone directly, (with no codec in between) we get a response as below.

Due to the similarity between images 2 and 3, I think the setup is not appropriate as external speaker and microphone are interfering with response.

However, when we use the same setup with an active analog filter with op-amps and similar filter specifications we get a proper response with none of the spikes observed in either of the aforementioned images.

I am having trouble figuring out why there would be such a difference between analog filter and codec filter. Can anyone guide me on this matter?

• The one thing that stares me in the face with your writing here is that you assume that a digital filter and an analog filter are somehow fundamentally the same thing. They are most decidedly not the same. I'm heading off and don't have time right now, but look up s-space vs z-space for starters. (I can't speak to the software you are using. I just want to make sure you understand what happens when you sample.) – jonk Nov 4 '19 at 6:45
• I'm not assuming them to be the same thing. I'm just wondering why there is such a huge difference in the output, with the same setup. – Souvik Saha Nov 4 '19 at 9:17
• The spikes (lobes) you see are inherent for a discrete time sampled filter (which would be clearer if amplitude was plotted in dB). There are lots of available resources for such things. – Peter Smith Nov 4 '19 at 11:08