You are on page 1of 6

An Algorithm to Remove Noise from Audio Signal

by Noise Subtraction
Abdelshakour Abuzneid, Moeen Uddin, Shaid Ali Naz, Omar Abuzaghleh
Department of Computer Science
University of Bridgeport
abuzneid@bridgeport.edu, moeenu@bridgeport.edu, snaz@bridgeport.edu, oabuzagh@bridgeport.edu

Abstract- This paper proposes an algorithm for removing the


noise from the audio signal. Filtering is achieved through
recording the pattern of noise signal. In order to validate our
algorithm, we have implementation in MATLAB 7.0. We
investigated the effect of proposed algorithm on human voice and
compared the results with the existing related work, most of
which employ simple algorithm and effect the voice signal. The
results show that the proposed algorithm makes efficient use of
Voice over the IP communication with less noise in comparison to
similar existing algorithm.

I. INTRODUCTION
Whenever we speak in microphone, it does not catch only
the waves which come out from our mouth, but it also catches
the waves coming from other sources like fan, vacuum
cleaner, phone ringing, or other sources, and combines the
noise with the real voice signal. The input signal to the B. Frequency
microphone becomes noisy.
This is the rate of change the signal undergoes every
To remove this noise we have to know the characteristics of second, expressed in Hertz (Hz), or cycles per second. A 30Hz
the noise and the needed voice signal, so that we can separate signal changes thirty times a second. In speech, we also refer
noise from the original voice signal. The three main to it as the number of vibrations per second. As we speak, the
characteristics of signals are, air is forced out of our mouths, being vibrated by our voice
box. Men, on average, tend to vibrate the air at a lower rate
A. Amplitude than women, thus tend to have deeper voices. A cycle is one
complete movement of the wave, from its original start
This is the strength of the signal. It can be expressed in a position and back to the same point again. The number of
number of different ways (as volts, decibels). The higher the cycles (or waves) within one second time interval is called
amplitude, the stronger (louder) the signal. The decibel is a cycles-per-second, or Hertz [8].
popular measure of signal strength [8].
40db normal speech
90db lawn mowers
110db shotgun blast
120db jet engine taking off
120db rock concerts

It has been discovered that exposure to sounds greater than


90db for a period of time exceeding 15 minutes causes
permanent damage to hearing. Our ability to hear high notes is
affected. As young babies, we have the ability to hear quite
high frequencies. This ability reduces as we age. It can also be
affected by too much noise over sustained periods. Ringing in
the ears after being exposed to loud noise is an indication that
hearing loss may be occurring [8].

T. Sobh (ed.), Advances in Computer and Information Sciences and Engineering, 5–10.
© Springer Science+Business Media B.V. 2008
6 ABUZNEID ET AL.

C. Phase
This is the rate at which the signal changes its relationship
to time, expressed as degrees. One complete cycle of a wave
begins at a certain point, and continues till the same point is
reached again. Phase shift occurs when the cycle does not
complete, and a new cycle begins before the previous one has
fully completed [8].

Figure 1: Signal 1 recorded at home

Generating Noise in the Background

We need to generate background noise. Background noises


come in many different shapes and sizes (figuratively
speaking). In layman’s terms, Background noise is often
described as “office ventilation noise”, “car noise”, “street
noise”, “cocktail noise”, “background music”, etc. Although
this classification is practical for human understanding, the
algorithms that model and produce comfort noise see things in
more mathematical terms. The most basic and intuitive
property of Background noise is its loudness. This is referred Figure 2: Signal 2 recorded at computer lab
to as the signal’s energy level. Another less obvious property
is the frequency distribution of the signal. For example, the By magnifying a portion of the signal 1 we can see the
hum of a running car and that of a vacuum cleaner can have noise strip more clearly.
the same energy level, yet they do not sound the same: these
two signals have distinctly different spectrums. The third
property of BGN is the variability over time of the first two
properties. When a Background noise’s energy level and
spectrum are constant in time, it is said to be stationary. Some
environments are prone to contain non-stationary BGN. The
best example is street noise, in which cars come and go [10].
Good algorithms must cope well with all types of
background noises. The regenerated noise must match the
original signal as closely as possible.

II. SUGGESTED ALGORITHM


Step 1:

We recorded two voice signals in two distinct environments


and plotting the signal on graph, we examined that mostly the
continuous noise comes in the range between -1.5 to +1.5 as Figure 3: Magnified portion of the Signal in figure 1
you can see in the following snapshots.
AN ALGORITHM TO REMOVE NOISE FROM AUDIO SIGNAL BY NOISE SUBTRACTION 7

Recording this noise strip to a different variable and


drawing on graph as shown in the snapshot.

Figure 4: Recorded noise strip

This noise appears when there is no voice signal. If we


subtract this signal from the noise signal we get the output
signal shown in figure4.
Figure 7: Output signal after subtraction of noise from Signal 2.

We played these signals and examined that there was no


noise when there was no recorded voice but there was noise
during the voice signal. It is because of the recorded noise
empty spaces recorded during the voice where the range of
signal was not between -1.5 and +1.5.

Step 2:

We filled these empty spaces by copying the pattern of


noise, on those places where the noise is 0 or straight line.
And the recorded noise strip becomes:

Figure 5: Output signal after subtraction of noise from Signal 1.

Figure 8: Noise strip with filled spaces

This whole strip in the above figure is mostly similar to


actual noise. By subtracting this noise strip from the first
recorded signals we can get the noise free signal as shown in
the following snapshot.

Figure 6: Magnified portion of above Signal


8 ABUZNEID ET AL.

Figure 9: Output signal 1 after subtracting noise strip Figure 11: Output signal 1

Figure 10: Output signal 2 after subtracting noise strip Figure 12: Output signal 2

We played these signals and found that there was no noise We played these signals and examined that the final output
during the voice and without voice. But unfortunately the signals were mostly noise free signal. We have chosen the
voice signal is little bit effected it seems like the voice signal range +8 to -10. This is a critical point; since the clarity of
lost some of its characteristics. voice depends on the range we may choose.

Step 3:

We solved this problem by putting some specific ranges for


noise subtraction. We subtracted noise from the signal range
that appears between -1.5 and +1.5, the signal above the +8
and below the -10.
AN ALGORITHM TO REMOVE NOISE FROM AUDIO SIGNAL BY NOISE SUBTRACTION 9

III. FLOW CHART a = getaudiodata(micrecorder, ‘int8’);

[m,n] = size(a);
Input Voice
j=1;
k=1;

% Recording Noise
for i = 1 : m
if (a(i,1) <= 0) && ( a(i,1) >= -1.5 )
Add noise to Voice
b(i,1) = a(i,1);
else
b(i,1) = 0;
end
end

% Subtracting Noise
for i = 1 : m
Separate noise if ( a(i,1) < 0 )
from recorded
signal
r(i,1)=a(i,1)-b(i,1);
elseif ( a(i,1) > 0 )
r(i,1)=a(i,1)+b(i,1);
end
end

% Plotting Signals
Noise
Signal figure, plot(a);
figure, plot(b);
figure, plot(r);

x=audioplayer(a,22050,8);
y=audioplayer(b,22050,8);
z=audioplayer(r,22050,8);

% Playing Signals
Subtract noise play(x);
from Noisy signal
play(y);
play(z);

B. Module 2 code
% Recording Audio Signal
Noise free
signal
micrecorder = audiorecorder(22050,8,1);
record(micrecorder,3);

a = getaudiodata(micrecorder, ‘int8’);

[m,n] = size(a);
IV. MATLAB CODE
j=1;
The algorithm has three modules which are coded in Matlab k=1;
7.0. We used a microphone to record 3 seconds of 22-kHz, 8-
bit, mono data. % Recording Noise
for i = 1 : m
A. Module 1 code if (a(i,1) <= 0) && ( a(i,1) >= -1.5 )
% Recording Audio Signal b(i,1) = a(i,1);
micrecorder = audiorecorder(22050,8,1); c(j,1) = a(i,1);
record(micrecorder,3); j = j+1;
else
10 ABUZNEID ET AL.

b(i,1) = c(k,1); elseif ( (a(i,1) > 0 && a(i,1)<1.5) || a(i,1)>8 )


k = k+1; r(i,1)=a(i,1)+b(i,1);
end else
end r(i,1)=a(i,1);
end
% Subtracting Noise end
for i = 1 : m
if ( a(i,1) < 0 ) % Plotting Signals
r(i,1)=a(i,1)-b(i,1); figure, plot(a);
elseif ( a(i,1) > 0 ) figure, plot(b);
r(i,1)=a(i,1)+b(i,1); figure, plot(c);
end figure, plot(r);
end
x=audioplayer(a,22050,8);
% Plotting Signals y=audioplayer(b,22050,8);
figure, plot(a); z=audioplayer(r,22050,8);
figure, plot(b);
figure, plot(c); % Playing Signals
figure, plot(r); play(x);
play(y);
x=audioplayer(a,22050,8); play(z);
y=audioplayer(b,22050,8);
z=audioplayer(r,22050,8); V. CONCLUSION
We presented an algorithm for noise removal from a voice
% Playing Signals signal through stepwise study methodology. We notice
play(x); significant improvement in voice signal when it is filtered out
play(y); through this algorithm. The algorithm works great on uniform
play(z); noise. We are currently working on other techniques for
removing the noise from signal so that it does not affect the
C. Module 3 code characteristics of the original voice. We are extending our
% Recording Audio Signal work so that we can implement our algorithm in voice over IP,
micrecorder = audiorecorder(22050,8,1); messengers or cellular phones.
record(micrecorder,3);
REFERENCES
a = getaudiodata(micrecorder, ‘int8’); [1] Jaroslav Koton , Kamil Vrba, Pure Current-Mode Frequency Filter for
Signal Processing in High-Speed Data Communication, Issue Date:
[m,n] = size(a); April 2007 pp. 4
[2] Yu-Jen Chen , Chin- Chang Wang , Gwo-Jia Jong , Boi-Wei Wang, The
j=1; Separation System of the Speech Signals Using Kalman Filter with
k=1; Fuzzy Algorithm, Issue Date: August 2006 pp. 603-606
[3] Jafar Ramadhan Mohammed, “A New Simple Adaptive Noise
% Recording Noise Cancellation Scheme Based On ALE and NLMS Filter”, Issue Date:
May 2007 pp. 245-254
for i = 1 : m
[4] Jian Zhang , Qicong Peng , Huaizong Shao , Tiange Shao, “Nonlinear
if (a(i,1) <= 0) && ( a(i,1) >= -1.5 ) Noise Filtering with Support Vector Regression”, Issue Date: October
b(i,1) = a(i,1); 2006 pp. 172-176
c(j,1) = a(i,1); [5] Xingquan Zhu , Xindong Wu, “Class Noise Handling for Effective Cost-
j = j+1; Sensitive Learning by Cost-Guided Iterative Classification Filtering,”
Issue Date: October 2006 pp. 1435-1440.
else [6] Carlos Sanchez-Lopez , Esteban Tlelo-Cuautle, “Symbolic Noise
b(i,1) = c(k,1); Analysis in Gm-C Filters,” Issue Date: September 2006 pp. 49-53.
k = k+1; [7] DANIELE RIZZETTO AND CLAUDIO CATANIA, A VOICE OVER
end IP SERVICE ARCHITECTURE for Integrated Communications, MAY
- JUNE 1999
end [8] http://www.cs.ntu.edu.au/sit/resources/dc100www/dc1009.htm
[9] http://www.bcae1.com/sig2nois.htm
% Subtracting Noise [10] http://www.commsdesign.com/design_corner/OEG20030303S0036
for i = 1 : m
if ( (a(i,1) < 0 && a(i,1)>-1.5) || a(i,1)<-10)
r(i,1)=a(i,1)-b(i,1);

You might also like