Sie sind auf Seite 1von 4

A project to separate low and high frequencies of an

audio signal
Nurul Ain Syafiqah binti Mohamed Alias
EE0101332
Dept. of Electrical and Electronics,
College of Engineering, UNITEN
Kajang, Malaysia.
nurulainsyafiqah96@gmail.com

Faridhatul Aien binti Mohd Salleh


EE0101329
Dept. of Electrical and Electronics,
College of Engineering, UNITEN
Kajang, Malaysia.
fariaien@gmail.com

Abstract- The purpose of this paper is to separate the low


and high frequencies of an audio signal using FIR filtering II. METHODOLOGY
method with Hamming window, the results obtained are two MATLAB software is used to compile the coding needed to
audios in frequency domain. MATLAB is used to simulate the
execute the operation of the system. The audio signal which
filter to get desired output.
is the instrumental piano sound of song ‘Bad Guy by Billie
Keywords—lowpass, highpass, Hamming, convolute Eilish’ came in the form of “.mp3”, which is plotted in
MATLAB both its time and frequency domain. To plot it in
frequency domain, the audio signal is Fourier transformed
I. INTRODUCTION using Fast Fourier Transform (FFT) function in MATLAB.
Digital Signal Processing is an intention of filtering, To separate the left hand notes (low frequencies) and the
measuring, or compressing and producing of analogue right hand notes (high frequencies) of the audio signal, low
signals. Analogue signals can be transfer to electric signal pass and high pass filters are used respectively, both are of
by multiple sampling methods. This information can then be Finite Impulse Response (FIR) filters. In this work,
represented as discrete time, discrete frequency, or other Hamming window is used.
discrete forms so that the information can bedigitally
processed into digital signal which represent by zeroes and Finite Impulse Response (FIR) and Infinite Impulse
ones.[2] Response (IIR).
Two classes of digital filters are Finite Impulse
DSP filter have two mainly purpose which is signal Response (FIR) and Infinite Impulse Response (IIR). The
separation and signal restoration. Signal separation is to term ‘Impulse Response’ refers to the appearance of the
separate the signals when a signal is contaminated with filter in the time domain. Filters typically have broad
interference or noises. Signal restoration is used restore a frequency responses, which correspond to short duration
signal when it has been distorted. [1][2] pulses in the time domain.
DSP filter will compare the two systems with any filter IIR Filters
function and perform mathematical operation to reject the IIR filters have an infinite impulse response. This
unwanted signal. While an analogue filter would use means that the impulse response never becomes exactly 0
amplifiers, capacitors, inductors, or resistor to modify the but rather approaches it. This is controlled via a feed-back
filters.[2] loop with a defined gain a (or feed-forward loop with
defined gain b). Imagine if we have a feed-back loop of a 1
DSP filter's input and output signals are normally in time sample delay and a gain of 0.5 as portrayed below. This
domain. This is because signals are created by sampling at means that the sample is always halfway towards 0.
same time intervals. Other ways of sampling is to have
equal intervals in space.

The most straightforward way to implement a digital filter is


by convolving the input signal with the digital filter's
impulse response, which also called as FIR filter. Another
way to make filters is called recursion. When a filter is Figure 1: IIR Filter
implemented by convolution, each sample in the output is
calculated by weighting the samples in the input and adding
them together. [2]

XXX-X-XXXX-XXXX-X/XX/$XX.00 ©20XX IEEE


FIR Filters
FIR Filters have a finite impulse response. That is to MATLAB codes
say, that the impulse response only goes on for a set number %in freq domain
of samples. It will never have more or less samples than that [y,Fs]= audioread ('D:\BEEE\Digital Signal
number of samples. The following picture is an example of Processing\Project\bad_guy_piano.mp3');
the impulse response for a hypothetical FIR filter. sound (y,Fs) %: to play sound
clear sound % : to stop sound

%now to change to time domain


N=length (y); %to define N and to show length value
Tend = (1/Fs)*N;
t= 0:(1/Fs):Tend-(1/Fs);
subplot (4,2,1);
plot (t,y); %figure 2: graph of bad guy in time domain

Figure 2: FIR filter


%now to find the FFT of this signal
As shown in this picture, the filter (for the given Yk=fft(y); %declares that Yk is the FFT of y
settings of cutoff, q and gain) will always yield a linear gain freqScale = Fs * (0:N-1)/N; %creates frequency scale
of 1 at sample 1, -0.5 at sample 2 and so on and so forth. We subplot (4,2,2);
plot (freqScale, abs(Yk/max(Yk))); %plots normalized Yk
also know that this filter impulse response is 5 samples long.
The number of taps in an FIR filter is always N-1 where N is
the impulse response length in samples. This means that this
FIR filter is 4 taps long. This is equivalent to the following %let's design an FIR filter (lowpass)
diagram: fc = 261.63;
wc = 2 * pi * fc / Fs / pi;
order = 2000;

l = fir1(order, wc, 'high');


h = fir1(order, wc, 'low');
L = fft(l, N); %highpass filter
H = fft(h, N); %lowpass filter
Figure 3: Signal Diagram
r = conv(y,h);
q = conv(y,l);
This type of diagram above is known as a signal flow %frequency domain result
diagram (specifically known as direct form). There are a R = fft(r, N);
couple of different ways of drawing these diagrams but, the Q = fft(q, N);
essential point is that we can define a system this way. The
diagram shows which way a sample is travelling by the subplot (4,2,3)
arrows. The diagram shows that linear gain is denoted by plot( freqScale, abs( H )) %plots lowpass filter
multipliers a (or b) and delays of an amount of samples are subplot (4,2,4)
denoted by z^-t where t is time in samples. In this case every plot( freqScale, abs( L )) %plots highpass filter
delay is a delay of 1 sample. This is also known as a unit
subplot (4,2,5)
delay. A tap is outlined in red. Just remember that a single plot ( freqScale, abs(R)) %result1: low frequencies, freq dom
tap is the delay with corresponding gain. The diagram uses subplot (4,2,6)
+ to denote the points where signals are mixed (added) plot ( freqScale, abs(Q)) %result2: high frequencies,freq dom
together.
subplot (4,2,7)
In conclusion, FIR filters are more powerful than IIR plot (r) %result: low frequencies, time domain
filters, but also require more processing power and more subplot (4,2,8)
work to set up the filters. They are also less easy to change plot (q) %result2: high frequencies, time domain
"on the fly" as you can by tweaking (say) the frequency
setting of a parametric (IIR) filter.
Relevant Calculation
Inverse calculation method is used in this work to calculate
Transition Bandwidth (Δω) for Hamming window function.
In the beginning, order number N is chosen through trial and
error method to identify the suitable sharpness of the slope
in order to get the desired output. Suitable N is chosen to be
2000, and from there Transition Bandwidth (Δω) is Figure 9: Highpass filter without zooming
calculated.

N = 2M + 1
2000 = 2M + 1
M = 999.5 ≈ 1000

3.32𝜋 3.32𝜋
Δω = = = 0.01043 rad/s
𝑀 1000 Figure 10: Highpass filter zoomed in

IV. RESULTS & ANALYSIS

Figure 11: Convolution lowpass filter without zooming

Figure 4

Figure 12: Convolution lowpass filter zoomed in

Figure 5: Normalized Yk (input signal) without zooming

Figure 13: Convolution high pass without zooming

Figure 6: Normalized Yk (input signal) zoomed in

Figure 14: Convolution highpass filter zoomed in


Figure 7: Lowpass filter in frequency domain without zooming

Figure 15: Highpass filter result


Figure 8: Lowpass filter in frequency domain zoomed in
Figure 16: Lowpass filter result

V. DISCUSSION
The audio file that been analysed is “bad_guy_piano.mp3”.
Even though two FIR filters are used, the low and high
frequencies can be separated but not entirely, as there are
also low frequencies sound able to be heard at the result of
High pass filter. This is due to in piano, each note actually
contains various frequencies, thus for example in result of
high pass filter, even though low frequencies are separated,
some of the sound also contains the low notes.

Order number 2000 is chosen to make the filter nearly ideal


and which helps make the voice in the audio clearer as well.

VI. CONCLUSION
DSP filtering is the most easy and efficient way to do
separation and restoration of signals. By using MATLAB
simulation, it gives less error and able to correct the filter to
get the signals. We also learnt much knowledge and hand on
to construct the filter which will benefit our future.

VII. REFERENCES
[1] Steven W. Smith, ‘The Scientist and Engineer's Guide to
Digital Signal Processing’, [Online]. Available:
http://www.dspguide.com/pdfbook.htm.
[Accessed Aug. 24, 2019].

[2] Donald Krambeck, ‘An Introduction to Digital Signal


Processing’, allaboutcircuits.com, Sept.13, 2015. [Online].
Available: https://www.allaboutcircuits.com/technical-arti
cles/an-introduction-to-digital-signal-processin
g/. [Accessed Aug.24, 2019].

Das könnte Ihnen auch gefallen