{"id":567,"date":"2022-02-19T22:49:58","date_gmt":"2022-02-20T03:49:58","guid":{"rendered":"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/?post_type=chapter&#038;p=567"},"modified":"2022-02-19T23:28:33","modified_gmt":"2022-02-20T04:28:33","slug":"filtering-voice-signal","status":"publish","type":"chapter","link":"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/chapter\/filtering-voice-signal\/","title":{"raw":"Filtering voice signal","rendered":"Filtering voice signal"},"content":{"raw":"<strong>Background<\/strong>\r\n\r\nThe behaviour of a system can be analyzed in both time and frequency domains with time response and bode plots, respectively. Since these behaviours may not suit our needs, we can alter them with different filters. A transfer function contains some zeros and poles which their positions can be analyzed to design a suitable filter.\r\n\r\nGenerally, filters could be discussed in analog and digital domains. Analog filters are mostly used in electronic circuits while digital filters are used in digital systems such as computers. However, we can design analog filters in a digital environment such a computer software. One of the most popular applications of filters is audio filtering which is utilized in noise removal, audio separation and even encoding\/decoding of audio signals.\r\n\r\nThere are 4 commonly used types of filters:\r\n\r\n<strong>1) <\/strong><strong>Low-pass filter:<\/strong>\r\n\r\nA Low-pass filter has a gain above zero in low frequencies which allows them to pass the low frequency signals effectively. This gain significantly drops after a certain frequency to values close to zero. That frequency is called the \u201cCut-off Frequency\u201d. In real world situations, filters are not ideal.\r\n\r\nWe can see the frequency response of an ideal filter versus a real world filter in Figure 12.1.\r\n\r\n[caption id=\"attachment_574\" align=\"aligncenter\" width=\"368\"]<img class=\" wp-image-574\" src=\"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig-12.1.jpg\" alt=\"\" width=\"368\" height=\"245\" \/> Figure 1\u2013Ideal and real Low-pass filter frequency response[\/caption]\r\n\r\n&nbsp;\r\n\r\nA low-pass filter of order N has a transfer function like (a\/(s+b))<sup>N<\/sup> . In low frequencies, <em>s<\/em> is close to zero so the gain is approximately (a\/b)<sup>N<\/sup>\u00a0 . Poles (or pole) of this transfer function are on <em>-b<\/em>. This filter is mostly used to remove noise, a high frequency sound wave, from audio signals.\r\n\r\n&nbsp;\r\n\r\n<strong>2) <\/strong><strong>High-pass filters:<\/strong>\r\n\r\nIn contrast to low-pass filters, high-pass filters have a gain close to zero in low frequencies. This gain starts to rapidly increase from cut-off frequency before reaching a constant value. A high-pass filter of order N has a transfer function like (as\/(s+b))<sup>N<\/sup> . In very high frequencies with infinite s, gain is approximately a<sup>N<\/sup> . Similar to low-pass filters, we have a gain of\u00a0 (1\/\u221a2) at cut off frequency.\r\n\r\nYou can see the frequency response of an ideal high-pass filter alongside with its non-ideal kind in Figure 12.2.\r\n\r\n&nbsp;\r\n\r\n[caption id=\"attachment_575\" align=\"aligncenter\" width=\"303\"]<img class=\" wp-image-575\" src=\"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig12.2.jpg\" alt=\"\" width=\"303\" height=\"228\" \/> Figure 12.2\u2013Ideal and real High-pass filter frequency response[\/caption]\r\n\r\n&nbsp;\r\n\r\n<strong>3) <\/strong><strong>Band-pass filters:<\/strong>\r\n\r\nCombining a low-pass filter with cut-off f<sub>1<\/sub> and a high-pass filter with cut-off f<sub>2<\/sub>, results in a filter which passes frequencies only in a specific range. From frequency f<sub>1<\/sub> to f<sub>2<\/sub>, signals are passed with some values of gain and outside of this range, gain is close to zero. Midpoint of this frequency is called \u201cCenter Frequency\u201d f<sub>m<\/sub> where f<sub>m<\/sub> = SQRT( f<sub>1<\/sub> f<sub>2<\/sub> ).\r\n\r\nIn general , the transfer function of this filter is\r\n\r\n<img class=\"wp-image-579 aligncenter\" src=\"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Formula-300x150.jpg\" alt=\"\" width=\"182\" height=\"91\" \/>\r\n\r\nGain of the filter at points f<sub>1<\/sub> and f<sub>2<\/sub> equals (1\/sqrt(2)) \u00d7f<sub>m<\/sub>. Just like above filters, there are ideal and non-ideal forms of this filter shown in Figure 12.3.\r\n\r\n&nbsp;\r\n\r\n[caption id=\"attachment_576\" align=\"aligncenter\" width=\"562\"]<img class=\"size-full wp-image-576\" src=\"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig12.3.jpg\" alt=\"\" width=\"562\" height=\"236\" \/> Figure 12.3\u2013Ideal and real Band-pass filter frequency response[\/caption]\r\n\r\n&nbsp;\r\n\r\n<strong>4) <\/strong><strong>Band-stop filter:<\/strong>\r\n\r\nThese filters\u2019 operation opposes the operation of band-pass filters. There is a range of frequencies from \u00a0to \u00a0where the filter has a gain close to zero. The gain increases while moving out of this range to reach a nearly constant value. We can say that this filter is comprised of two high-pass and two low-pass filters in parallel. There is also a center frequency, f<sub>m<\/sub>, where f<sub>m<\/sub> = SQRT( f<sub>1<\/sub> f<sub>2<\/sub> ). The general Transfer Function of a band-stop filter is:\r\n\r\n<img class=\"wp-image-578 aligncenter\" src=\"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Formula4-1024x403.jpg\" alt=\"\" width=\"221\" height=\"87\" \/>\r\n\r\nFrequency response of an ideal and non-ideal band-stop filter is depicted in Figure 12.4.\r\n\r\n&nbsp;\r\n\r\n[caption id=\"attachment_577\" align=\"aligncenter\" width=\"437\"]<img class=\"size-full wp-image-577\" src=\"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig12.4.jpg\" alt=\"\" width=\"437\" height=\"194\" \/> Figure 12.4\u2013Ideal and real Band-stop filter frequency response[\/caption]\r\n\r\n&nbsp;\r\n\r\n<strong>Objectives<\/strong>\r\n\r\nThe following objectives will be covered as you go through the experiment procedure.\r\n<ul>\r\n \t<li>Design analog filters in MATLAB with specific pass and stop frequencies<\/li>\r\n \t<li>Explain the impact of modifying the location of poles and zeros and changing the order of filters<\/li>\r\n \t<li>Remove the noise from a digital audio file using a low-pass filter<\/li>\r\n \t<li>Remove a sound with specific range of frequency from a digital audio file using a band-stop filter<\/li>\r\n \t<li>Split the sounds from a digital audio file using high-pass and band-pass filters<\/li>\r\n<\/ul>\r\n<strong>Procedure<\/strong>\r\n<ol>\r\n \t<li>Open the audio file number one using the <strong>audioread<\/strong> command. It contains high frequency components that we want to filter out.<\/li>\r\n<\/ol>\r\n<p style=\"padding-left: 40px\">a) What kind of filter should we use?<\/p>\r\n<p style=\"padding-left: 40px\">b) Design a filter using <strong>zpk(zeros,poles,gain)<\/strong>. Plot the bode diagram using bode command. Is the filter correctly designed?<\/p>\r\n<p style=\"padding-left: 40px\">c) Apply your filter to the audio file using the <strong>lsim<\/strong> Describe the changes.<\/p>\r\n<p style=\"padding-left: 40px\">d) Change the gain of your filter. How does the output change?<\/p>\r\n<p style=\"padding-left: 40px\">e) Increase the order of your filter. How does the output change?<\/p>\r\n<p style=\"padding-left: 40px\">f) Try to move the poles of your filter. How does it affect the output?<\/p>\r\n<p style=\"padding-left: 40px\">g) What is the optimum order and gain to remove the noise?<\/p>\r\n2. Open the second audio file. This file has an unwanted element in low frequencies.\r\n<p style=\"padding-left: 40px\">a) What is the best filter to use?<\/p>\r\n<p style=\"padding-left: 40px\">b) Design a filter using <strong>zpk<\/strong> and plot the bode diagram using bode command. Is the filter correctly designed?<\/p>\r\n<p style=\"padding-left: 40px\">c) Apply your filter to the audio file using <strong>lsim<\/strong>. Describe the changes.<\/p>\r\n<p style=\"padding-left: 40px\">d) Change the gain of your filter. How does the output change?<\/p>\r\n<p style=\"padding-left: 40px\">e) Increase the order of your filter. How does the output change?<\/p>\r\n<p style=\"padding-left: 40px\">f) Try moving the poles of your filter. How does it affect the output?<\/p>\r\n<p style=\"padding-left: 40px\">g) What is the optimum order and gain to remove the noise?<\/p>\r\n3. Use <strong>audioread<\/strong> command to load the third audio file. In this file, there is a redundant piece of music interfering the speaker\u2019s voice. Frequency range of the speaker\u2019s sound is 450 to 2600 hertz.\r\n<p style=\"padding-left: 40px\">a) What filter do you propose to extract the speaker\u2019s voice?<\/p>\r\n<p style=\"padding-left: 40px\">b) Design the filter and plot the bode diagram. Is the filter correctly designed?<\/p>\r\n<p style=\"padding-left: 40px\">c) Apply your filter to the audio file. Describe the changes.<\/p>\r\n<p style=\"padding-left: 40px\">d) Change the gain of your filter. How does the output change?<\/p>\r\n<p style=\"padding-left: 40px\">e) Try moving the poles of your filter. How does it affect the output?<\/p>\r\n<p style=\"padding-left: 40px\">f) What is the optimum position of poles and gain to remove the noise?<\/p>\r\n4. Open the file number four. This file contains annoying phone beeps interfering with the speaker\u2019s voice. The frequency band of this beeping is roughly between 700 to 900 hertz. We would like to remove this beep sound.\r\n<p style=\"padding-left: 40px\">a) What is the suitable filter for this task?<\/p>\r\n<p style=\"padding-left: 40px\">b) Design your filter and plot the bode diagram. Is the filter correctly designed?<\/p>\r\n<p style=\"padding-left: 40px\">c) Apply your filter to the audio file. Describe the changes.<\/p>\r\n<p style=\"padding-left: 40px\">d) Change the gain of your filter. How does the output change?<\/p>\r\n<p style=\"padding-left: 40px\">e) Try moving the poles of your filter. How does it affect the output?<\/p>\r\n<p style=\"padding-left: 40px\">f) Try moving the zeros of your filter. Describe the effects on the filtered output.<\/p>\r\n<p style=\"padding-left: 40px\">g) What is the optimum gain and position of poles and zeros to remove the noise?<\/p>\r\n&nbsp;","rendered":"<p><strong>Background<\/strong><\/p>\n<p>The behaviour of a system can be analyzed in both time and frequency domains with time response and bode plots, respectively. Since these behaviours may not suit our needs, we can alter them with different filters. A transfer function contains some zeros and poles which their positions can be analyzed to design a suitable filter.<\/p>\n<p>Generally, filters could be discussed in analog and digital domains. Analog filters are mostly used in electronic circuits while digital filters are used in digital systems such as computers. However, we can design analog filters in a digital environment such a computer software. One of the most popular applications of filters is audio filtering which is utilized in noise removal, audio separation and even encoding\/decoding of audio signals.<\/p>\n<p>There are 4 commonly used types of filters:<\/p>\n<p><strong>1) <\/strong><strong>Low-pass filter:<\/strong><\/p>\n<p>A Low-pass filter has a gain above zero in low frequencies which allows them to pass the low frequency signals effectively. This gain significantly drops after a certain frequency to values close to zero. That frequency is called the \u201cCut-off Frequency\u201d. In real world situations, filters are not ideal.<\/p>\n<p>We can see the frequency response of an ideal filter versus a real world filter in Figure 12.1.<\/p>\n<figure id=\"attachment_574\" aria-describedby=\"caption-attachment-574\" style=\"width: 368px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-574\" src=\"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig-12.1.jpg\" alt=\"\" width=\"368\" height=\"245\" srcset=\"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig-12.1.jpg 361w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig-12.1-300x199.jpg 300w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig-12.1-65x43.jpg 65w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig-12.1-225x150.jpg 225w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig-12.1-350x233.jpg 350w\" sizes=\"auto, (max-width: 368px) 100vw, 368px\" \/><figcaption id=\"caption-attachment-574\" class=\"wp-caption-text\">Figure 1\u2013Ideal and real Low-pass filter frequency response<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>A low-pass filter of order N has a transfer function like (a\/(s+b))<sup>N<\/sup> . In low frequencies, <em>s<\/em> is close to zero so the gain is approximately (a\/b)<sup>N<\/sup>\u00a0 . Poles (or pole) of this transfer function are on <em>-b<\/em>. This filter is mostly used to remove noise, a high frequency sound wave, from audio signals.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>2) <\/strong><strong>High-pass filters:<\/strong><\/p>\n<p>In contrast to low-pass filters, high-pass filters have a gain close to zero in low frequencies. This gain starts to rapidly increase from cut-off frequency before reaching a constant value. A high-pass filter of order N has a transfer function like (as\/(s+b))<sup>N<\/sup> . In very high frequencies with infinite s, gain is approximately a<sup>N<\/sup> . Similar to low-pass filters, we have a gain of\u00a0 (1\/\u221a2) at cut off frequency.<\/p>\n<p>You can see the frequency response of an ideal high-pass filter alongside with its non-ideal kind in Figure 12.2.<\/p>\n<p>&nbsp;<\/p>\n<figure id=\"attachment_575\" aria-describedby=\"caption-attachment-575\" style=\"width: 303px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-575\" src=\"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig12.2.jpg\" alt=\"\" width=\"303\" height=\"228\" srcset=\"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig12.2.jpg 280w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig12.2-65x49.jpg 65w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig12.2-225x170.jpg 225w\" sizes=\"auto, (max-width: 303px) 100vw, 303px\" \/><figcaption id=\"caption-attachment-575\" class=\"wp-caption-text\">Figure 12.2\u2013Ideal and real High-pass filter frequency response<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p><strong>3) <\/strong><strong>Band-pass filters:<\/strong><\/p>\n<p>Combining a low-pass filter with cut-off f<sub>1<\/sub> and a high-pass filter with cut-off f<sub>2<\/sub>, results in a filter which passes frequencies only in a specific range. From frequency f<sub>1<\/sub> to f<sub>2<\/sub>, signals are passed with some values of gain and outside of this range, gain is close to zero. Midpoint of this frequency is called \u201cCenter Frequency\u201d f<sub>m<\/sub> where f<sub>m<\/sub> = SQRT( f<sub>1<\/sub> f<sub>2<\/sub> ).<\/p>\n<p>In general , the transfer function of this filter is<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-579 aligncenter\" src=\"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Formula-300x150.jpg\" alt=\"\" width=\"182\" height=\"91\" srcset=\"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Formula-300x150.jpg 300w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Formula-1024x513.jpg 1024w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Formula-768x385.jpg 768w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Formula-65x33.jpg 65w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Formula-225x113.jpg 225w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Formula-350x175.jpg 350w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Formula.jpg 1454w\" sizes=\"auto, (max-width: 182px) 100vw, 182px\" \/><\/p>\n<p>Gain of the filter at points f<sub>1<\/sub> and f<sub>2<\/sub> equals (1\/sqrt(2)) \u00d7f<sub>m<\/sub>. Just like above filters, there are ideal and non-ideal forms of this filter shown in Figure 12.3.<\/p>\n<p>&nbsp;<\/p>\n<figure id=\"attachment_576\" aria-describedby=\"caption-attachment-576\" style=\"width: 562px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-576\" src=\"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig12.3.jpg\" alt=\"\" width=\"562\" height=\"236\" srcset=\"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig12.3.jpg 562w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig12.3-300x126.jpg 300w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig12.3-65x27.jpg 65w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig12.3-225x94.jpg 225w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig12.3-350x147.jpg 350w\" sizes=\"auto, (max-width: 562px) 100vw, 562px\" \/><figcaption id=\"caption-attachment-576\" class=\"wp-caption-text\">Figure 12.3\u2013Ideal and real Band-pass filter frequency response<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p><strong>4) <\/strong><strong>Band-stop filter:<\/strong><\/p>\n<p>These filters\u2019 operation opposes the operation of band-pass filters. There is a range of frequencies from \u00a0to \u00a0where the filter has a gain close to zero. The gain increases while moving out of this range to reach a nearly constant value. We can say that this filter is comprised of two high-pass and two low-pass filters in parallel. There is also a center frequency, f<sub>m<\/sub>, where f<sub>m<\/sub> = SQRT( f<sub>1<\/sub> f<sub>2<\/sub> ). The general Transfer Function of a band-stop filter is:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-578 aligncenter\" src=\"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Formula4-1024x403.jpg\" alt=\"\" width=\"221\" height=\"87\" srcset=\"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Formula4-1024x403.jpg 1024w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Formula4-300x118.jpg 300w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Formula4-768x302.jpg 768w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Formula4-1536x604.jpg 1536w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Formula4-65x26.jpg 65w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Formula4-225x89.jpg 225w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Formula4-350x138.jpg 350w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Formula4.jpg 1995w\" sizes=\"auto, (max-width: 221px) 100vw, 221px\" \/><\/p>\n<p>Frequency response of an ideal and non-ideal band-stop filter is depicted in Figure 12.4.<\/p>\n<p>&nbsp;<\/p>\n<figure id=\"attachment_577\" aria-describedby=\"caption-attachment-577\" style=\"width: 437px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-577\" src=\"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig12.4.jpg\" alt=\"\" width=\"437\" height=\"194\" srcset=\"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig12.4.jpg 437w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig12.4-300x133.jpg 300w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig12.4-65x29.jpg 65w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig12.4-225x100.jpg 225w, https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-content\/uploads\/sites\/1435\/2022\/02\/Fig12.4-350x155.jpg 350w\" sizes=\"auto, (max-width: 437px) 100vw, 437px\" \/><figcaption id=\"caption-attachment-577\" class=\"wp-caption-text\">Figure 12.4\u2013Ideal and real Band-stop filter frequency response<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p><strong>Objectives<\/strong><\/p>\n<p>The following objectives will be covered as you go through the experiment procedure.<\/p>\n<ul>\n<li>Design analog filters in MATLAB with specific pass and stop frequencies<\/li>\n<li>Explain the impact of modifying the location of poles and zeros and changing the order of filters<\/li>\n<li>Remove the noise from a digital audio file using a low-pass filter<\/li>\n<li>Remove a sound with specific range of frequency from a digital audio file using a band-stop filter<\/li>\n<li>Split the sounds from a digital audio file using high-pass and band-pass filters<\/li>\n<\/ul>\n<p><strong>Procedure<\/strong><\/p>\n<ol>\n<li>Open the audio file number one using the <strong>audioread<\/strong> command. It contains high frequency components that we want to filter out.<\/li>\n<\/ol>\n<p style=\"padding-left: 40px\">a) What kind of filter should we use?<\/p>\n<p style=\"padding-left: 40px\">b) Design a filter using <strong>zpk(zeros,poles,gain)<\/strong>. Plot the bode diagram using bode command. Is the filter correctly designed?<\/p>\n<p style=\"padding-left: 40px\">c) Apply your filter to the audio file using the <strong>lsim<\/strong> Describe the changes.<\/p>\n<p style=\"padding-left: 40px\">d) Change the gain of your filter. How does the output change?<\/p>\n<p style=\"padding-left: 40px\">e) Increase the order of your filter. How does the output change?<\/p>\n<p style=\"padding-left: 40px\">f) Try to move the poles of your filter. How does it affect the output?<\/p>\n<p style=\"padding-left: 40px\">g) What is the optimum order and gain to remove the noise?<\/p>\n<p>2. Open the second audio file. This file has an unwanted element in low frequencies.<\/p>\n<p style=\"padding-left: 40px\">a) What is the best filter to use?<\/p>\n<p style=\"padding-left: 40px\">b) Design a filter using <strong>zpk<\/strong> and plot the bode diagram using bode command. Is the filter correctly designed?<\/p>\n<p style=\"padding-left: 40px\">c) Apply your filter to the audio file using <strong>lsim<\/strong>. Describe the changes.<\/p>\n<p style=\"padding-left: 40px\">d) Change the gain of your filter. How does the output change?<\/p>\n<p style=\"padding-left: 40px\">e) Increase the order of your filter. How does the output change?<\/p>\n<p style=\"padding-left: 40px\">f) Try moving the poles of your filter. How does it affect the output?<\/p>\n<p style=\"padding-left: 40px\">g) What is the optimum order and gain to remove the noise?<\/p>\n<p>3. Use <strong>audioread<\/strong> command to load the third audio file. In this file, there is a redundant piece of music interfering the speaker\u2019s voice. Frequency range of the speaker\u2019s sound is 450 to 2600 hertz.<\/p>\n<p style=\"padding-left: 40px\">a) What filter do you propose to extract the speaker\u2019s voice?<\/p>\n<p style=\"padding-left: 40px\">b) Design the filter and plot the bode diagram. Is the filter correctly designed?<\/p>\n<p style=\"padding-left: 40px\">c) Apply your filter to the audio file. Describe the changes.<\/p>\n<p style=\"padding-left: 40px\">d) Change the gain of your filter. How does the output change?<\/p>\n<p style=\"padding-left: 40px\">e) Try moving the poles of your filter. How does it affect the output?<\/p>\n<p style=\"padding-left: 40px\">f) What is the optimum position of poles and gain to remove the noise?<\/p>\n<p>4. Open the file number four. This file contains annoying phone beeps interfering with the speaker\u2019s voice. The frequency band of this beeping is roughly between 700 to 900 hertz. We would like to remove this beep sound.<\/p>\n<p style=\"padding-left: 40px\">a) What is the suitable filter for this task?<\/p>\n<p style=\"padding-left: 40px\">b) Design your filter and plot the bode diagram. Is the filter correctly designed?<\/p>\n<p style=\"padding-left: 40px\">c) Apply your filter to the audio file. Describe the changes.<\/p>\n<p style=\"padding-left: 40px\">d) Change the gain of your filter. How does the output change?<\/p>\n<p style=\"padding-left: 40px\">e) Try moving the poles of your filter. How does it affect the output?<\/p>\n<p style=\"padding-left: 40px\">f) Try moving the zeros of your filter. Describe the effects on the filtered output.<\/p>\n<p style=\"padding-left: 40px\">g) What is the optimum gain and position of poles and zeros to remove the noise?<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"author":197,"menu_order":23,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[],"contributor":[],"license":[],"class_list":["post-567","chapter","type-chapter","status-publish","hentry"],"part":3,"_links":{"self":[{"href":"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-json\/pressbooks\/v2\/chapters\/567","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-json\/wp\/v2\/users\/197"}],"version-history":[{"count":5,"href":"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-json\/pressbooks\/v2\/chapters\/567\/revisions"}],"predecessor-version":[{"id":581,"href":"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-json\/pressbooks\/v2\/chapters\/567\/revisions\/581"}],"part":[{"href":"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-json\/pressbooks\/v2\/parts\/3"}],"metadata":[{"href":"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-json\/pressbooks\/v2\/chapters\/567\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-json\/wp\/v2\/media?parent=567"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-json\/pressbooks\/v2\/chapter-type?post=567"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-json\/wp\/v2\/contributor?post=567"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/sysmodeling\/wp-json\/wp\/v2\/license?post=567"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}