The Basics of Filters and Phase Relationships

Publisher:脑电狂潮Latest update time:2023-08-03 Source: elecfansKeywords:Filters Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

To understand why some filters sound good and others sound terrible, you need to understand how filters work. Unfortunately, filters are the most misunderstood modules in all synthesizers. It is a common misconception that filters simply attenuate a portion of the signal. In reality, filters do much more than simply attenuate a signal, whether in the analog or digital world.


In order to see exactly what happens to an audio signal as it passes through a filter, you need to understand some basic phase relationships. Let's go back a bit and start with the sine wave we introduced in the first article in this series.


First, imagine what would happen if you used a mixer to mix two sine waves together. You might have guessed it: two identical waveforms added together still give the same waveform, but louder (see Figure 1).

picture

Figure 1: Two sine waves in phase add to produce a louder sine wave

But what if you wait until the upper waveform is halfway through its cycle before introducing the lower waveform? This is shown in Figure 2. If you add these two waveforms together, they will cancel each other out, so you won't hear any sound. In other words, although the two waveforms sound exactly the same when heard individually, mixing them together will produce silence.

picture

Figure 2: Two sine waves offset by 1/2 cycle cancel each other out when added together

This is an important result because it tells us that while you only need frequency and loudness to define a single sine wave, if you want to mix two sine waves together, you also need to consider how much the two waveforms are offset from each other. This offset is often called the "phase" of one waveform from the other. Phase is measured in degrees, just like the degrees on a protractor (if you want to know why phase is expressed in degrees, you can read the "Phase in Degrees" extension at the end of this article, but if you don't want to think about the boring math, you can just continue reading the article below).

Of course, you can mix any two sine waves with any offset (i.e. phase difference) and the loudness of the mixed waveform will be somewhere between twice as loud as in Figure 1 and zero loudness as in Figure 2. (But if you mix the two signals in stereo instead of mono, you will get a very different effect. But that’s a topic for another day. I won’t discuss it in this article for the time being.)

Let's look at phase difference from the perspective of time difference. Let's say you have a 100Hz sine wave, which means it oscillates 100 cycles per second, so it takes 0.01 seconds to complete one cycle. For this signal, the half-cycle offset (if you have read the extended knowledge at the end of the article, you will know that the half-cycle offset is equal to 180 degrees of phase difference, but if you haven't read it, don't worry) is 0.005 seconds, or 5 milliseconds. Figure 3 can help you understand this process.

picture

Figure 3: Two sine waves offset by half a cycle (5 ms) cancel each other out when added together

Now imagine two sine waves with a frequency of 200Hz. For a 200Hz waveform, 5 milliseconds is enough to complete a full cycle. As shown in Figure 4, if one of the sine waves is offset by 5 milliseconds, the other sine wave has completed a full cycle. At this time, the two sine waves are back in phase. If these two sine waves are added together, the resulting sine wave will be twice as loud as the original waveform.

picture

Figure 4: Two 200 Hz sine waves offset by 5 milliseconds add up to double the loudness

Let's take a deep breath and think about what happens if we apply this concept to more complex waveforms. Take a sawtooth wave, for example. You may remember from the first article in this series that every harmonic of a sawtooth wave exists, so if a sawtooth wave has a fundamental frequency (i.e., the first harmonic) of 100Hz, then the second harmonic will be at 200Hz, the third at 300Hz... and so on. If you add two sawtooth waves of the same frequency but offset by half a cycle, the fundamental frequency will cancel, but the second harmonic at 200Hz will be twice as loud. The third harmonic, at three times the fundamental frequency, will cancel, but the fourth harmonic will be twice as loud, the fifth harmonic will cancel, and so on. What we get is a waveform with harmonics at 200Hz, 400Hz, 600Hz... and so on. In effect, this waveform is a sawtooth wave that is the same loudness as the original waveform, but at twice the frequency.

This counterintuitive result is our first conclusion today:

Mixing out-of-phase signals together does not necessarily cancel them out. In fact, complete cancellation almost never occurs in the real world.

But this is just one of the simplest cases of phase shift. Think about what happens if you apply this rule to complex waveforms in the real world: the amplitude of some harmonics will decrease, the amplitude of other harmonics will increase, some harmonics will be completely canceled, and the remaining harmonics will completely overlap and double in amplitude. Fourier analysis tells us that any complex waveform - whether it is a person's voice or the sound of an instrument can be regarded as a spectrum composed of countless sine waves. So, assuming that there is only a certain phase shift for two waveforms that are exactly the same in other aspects, there will be different amplitudes of phase shift between each harmonic that makes up these two waveforms. If you observe this result on a spectrum analyzer, you will see a pattern similar to a comb placed horizontally, and the distance between the "comb teeth" (that is, the harmonics that are canceled) is determined by the time difference (see Figure 5).

picture

Figure 5: Filtering resulting from the superposition of two waveforms that are offset by 5 milliseconds but are otherwise identical

In other words, when you mix two waveforms that are identical except for the phase shift, the phase difference between the harmonics of the two waveforms causes filtering. Because the shape of this filtering is very similar to a comb, the filter using this technique is called a comb filter. Comb filters are widely used in synthesizers, from the classic analog modular synthesizer Analogue Systems RS Integrator to the DSP-based Waldorf Q.

After understanding the knowledge about phase, it is not difficult to see the close relationship between phase and audio filtering. But think about it, if phase changes can cause filtering, then can filtering cause phase changes? The answer is: of course it can.

picture

Figure 6: A simple RC low-pass filter circuit

Looking at the circuit diagram in Figure 6, this circuit is very simple, using only two electronic components: a resistor and a capacitor, but this simple circuit forms a perfectly usable filter, called an RC low-pass filter. As any novice synthesizer user knows, a low-pass filter allows all harmonics below the "cutoff frequency" to pass, while all harmonics above the cutoff frequency are attenuated. For this simple filter, its cutoff frequency is determined by the parameters of its components, and the rate at which signals above the cutoff frequency are attenuated is determined by the construction of the circuit.

We will not consider the rate at which the signal is attenuated for the moment, as that will be discussed in the next article. In this article, we will focus on how this filter affects the phase of the input signal.

picture

Figure 7: Phase response of the above RC filter

Observe Figure 7, which is the "Phase Response" property of the simple LPF above. This figure shows the degree to which any frequency input into the filter and its phase will be shifted. It is not difficult to see that the filter has almost no significant effect on the phase of low-frequency signals, but the higher the signal frequency, the greater the phase shift. The signal at the cutoff frequency is shifted by one-eighth of a cycle (-45 degrees), and the highest frequency position of the signal is shifted by a full -90 degrees.

Since these concepts are a bit confusing, let's take a 100Hz square wave as an example to see what role this RC filter plays in an actual analog synthesizer.

As we introduced in the first article of this series: any traditional waveform can be decomposed into a series of harmonics, which are called the fundamental frequency and its overtones. In this case, our input signal (square wave) has a fundamental frequency of 100Hz, its second harmonic (200Hz) does not exist, but it has a third harmonic located at 300Hz, and its amplitude is one-third of the amplitude of the fundamental frequency. Then, the fourth harmonic does not exist, and the fifth harmonic is located at 500Hz with one-fifth of the amplitude, and so on... When all its harmonics are in phase, the waveform is shown in Figure 8.

picture

Figure 8: Ideal 100Hz square wave

Now, suppose our simple RC filter has a cutoff frequency of 400Hz, and the phase response of the filter below the cutoff frequency is 0. The result in this case should be easy to imagine: the fundamental frequency and the first overtone (100Hz and 300Hz) of the waveform will not be attenuated, but all overtones above 500Hz will be attenuated by the corresponding amplitude according to the phase response. The waveform after this treatment (which may be a little different from what you expected) is shown in Figure 9.

picture

Figure 9: Ideally, a 100Hz square wave is processed by an RC filter with a cutoff frequency of 400Hz.

Now let's take into account the phase shift of each harmonic during the filtering process, and we will now get a waveform with a very different shape. It can be seen that the real waveform after filtering has obvious distortion compared to the original square wave (as shown in Figure 10).

picture

Figure 10: Actual waveform produced by filtering

From this we can get the most important rule of this article:

The filter not only attenuates the harmonics of a waveform, it can also distort the waveform by changing the phase shift of the harmonics.

[1] [2]
Keywords:Filters Reference address:The Basics of Filters and Phase Relationships

Previous article:Understanding Phase Response Curves from Different Perspectives
Next article:Application of Deep Learning in Speech Enhancement

Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号