Attenuation of Environmental Noise through Digital Filtering

This chapter proposes the implementation of an environmental noise cancelation system using the least mean squares algorithm with noise amplitude modulation (NAMLMS). The system was implemented in a dsPIC3020F10 digital processor. The results obtained demonstrate that low- and high-frequency signals are attenuated allowing the passage of an audible range between 5 kHz and 18.9 kHz, the above using real-time processing.


Introduction
It is important to consider that, after vision, the ear is the most important sensory organ of the human body. The ear is an alarm sensor; that is, it is always active to perceive sounds. The sound consists in the change of air pressure that produces waves with a certain periodic frequency. However, within these there are also sound signals that are inarticulate to the human ear and also unpleasant, even damaging human health. Any sound pressure in the air is measured in decibels. A decibel is a logarithmic value (not linear, but exponential) that represents the relationship between a measured value and a reference value. In any environment there are audible signals that we need to perceive (talks, alarms, etc.) and other unwanted signals that cause the so-called noise pollution. The said contamination is defined as the presence of noise caused by an acoustic emitter that implies discomfort or harm to the health of people.
Some of the noises to which the human auditory system is exposed and that are part of the noise pollution are the following: 1. Noises due to the use of musical instruments 2. Use of household appliances such as washing machines, vacuum cleaners, etc.
3. Noises of air conditioning equipment 4. Discomfort caused by infrastructure 5. Dogs barking in the absence of their master 6. Alarms and sirens caused by fixed sources and mobile sources Noise pollution significantly interferes with interpersonal communication and increases workplace accidents and traffic accidents. Table 1 shows the noise levels  and their effects on the human ear. A filter may consist of hardware or software applied to a set of noisy or contaminated data in order to extract information of interest. Noise can be generated by any source. In this chapter, a digital solution is proposed that allows the attenuation of noise attached to audible signals that are perceived by the human ear. An adaptive filter is a device that is useful for processing an input signal by blocking and/or allowing some parts of it (unwanted noise or vibration).
On the other hand, the adaptive filter [1] has a feedback loop that has the ability to minimize the error produced by the comparison between the output signal (after processing) and a reference signal (expected signal). The above allows to guarantee that the human ear is not contaminated with the unwanted signals and only to rescue the information that needs to be received. Figure 1 shows the structure of an adaptive filter.
The signal d(n) is the expected audio signal to be perceived by the human ear, x (n) is the input signal to the filter (what is perceived from the environment), y(n) is the response signal that grants the filter, and e(n) is the error required to adapt the filter parameters by comparing the desired signal with that obtained. This comparison is the difference between the desired (reference) signal with respect to the signal obtained at the filter output. The operation of the algorithm that will represent the filter [2] is as follows: 1. The input signal will be picked up (in the scheme it is labeled as x(n)). This signal is the one that is in the environment and that contains what you want to be perceived and the adhered noise.
2. There is a reference signal labeled with d(n). This signal is what is expected to be perceived by the human ear, for example, the conversation you have with the person with whom you are talking.
3. The signal x(n) is processed in order to attenuate unwanted signals (noises that may be high or low frequencies) in order to obtain y(n).
4. The output signal y(n) and the desired d(y) are compared in order to obtain an error that should be the minimum possible.
5. Based on the error generated, the process will be carried out again to ensure that the signal obtained after the filter is as close as possible to the reference signal.
In general, the filter [3] will be used to inhibit signals that are not desired (technically this process is known as attenuating the amplitude of the noise signal) to "clean" the signal that must be perceived by the human ear. The proposed technique adapts to the conditions of the environment in which it is being implemented. Section 2 shows the development of the proposal; the equipment required for its implementation and its constituent parts are defined.

Design of the proposed algorithm and scheme
The design of the proposal will be partitioned in stages. Each stage involves material and equipment required for the tests, measurements, and results obtained. Figure 2 shows the process diagram that will follow the treatment of the signal captured from the environment.
The general processing diagram shown in Figure 2 consists of five stages which will be explained below: Stage A. It consists of the acquisition of the audible signal that is recovered from the environment. The use of an omnidirectional microphone is feasible here, the foregoing because the audio signal can be obtained from any point but not from a specific one. A microphone is a transducer device that converts sound waves into electrical voltage changes. In simple words, the microphone will record all the signals captured from any side from where they are received since the entire microphone structure is sensitive to sound. Next, Figure 3 shows the pickup pattern of an omnidirectional microphone. It should be mentioned that an omnidirectional pickup pattern captures the sound obtained from any direction.
It is important to capture all the sounds of the environment. For example, if a person is going to cross the street, it is important that he consider the sounds of fenced cars and be attentive to all perceived sounds in order to avoid an accident. The proposal to be designed will minimize the sound intensity of these noises but not completely mitigate them.
The proposal will capture all the random noises in the environment and process them, and when it detects that there is one that exceeds the threshold of intensity allowed, it will multiply it by a reduction factor and thus decrease its volume. The process described above is purely adaptive, which means that "n" number of repetitions will be performed until it approaches the expected result.
Stage B. The signal captured in Stage A is of analog format since it was captured in its natural form. However, for this stage, it is necessary to convert the captured signal into digital format since the computer and the processor require scanning to  perform its function. The original signal has to be subjected to three basic operations to digitize it: sampling, quantization, and coding.
Sound, by nature, is an analog signal. It is produced by vibrations in the air that force the union of nearby molecules in the air by slightly raising its pressure. Such pressure changes reach the ear by vibrating the receptors and decoding to produce the sound. Some of the characteristics of the vibrations (in waveforms) are the following: a. Amplitude: reflects the change in pressure from the highest peak to the minimum. A waveform with large amplitude has a volume of equal magnitude; otherwise, the volume is quieter.
b. Cycle: describes a single repeated sequence of pressure changes.
c. Frequency: describes the number of cycles produced in a second. If the frequency is high, the tone of the sound will be higher. Figure 4 shows the representation of two analog signals of different frequencies each.
If the frequency of a sound signals increases, the sound will be perceived as more acute because the wavelength decreases. Otherwise, when the frequency is low, the repetitions decrease, the wavelength increases, and, therefore, the sound tends to be a high-pitched tone.
The first step to digitize the original signal consists of the sampling operation. The sampling of a sound signal consists of taking small representative pieces of the signal so that they are then encoded in binary digits to digitize them. The condition that the signal has to remain representative of the original must be considered. To cover the previous condition, the following equation known as Nyquist's theorem must be followed: It is worth mentioning that if the sampling frequency is high, that is, if more samples are taken from the original signal in a certain time, the collection of significant parts for later digitization will allow a better fidelity of the original signal but now in a digital format and ready for computational processing. Figure 5 represents the two signals shown in Figure 4 but now applying the sampling theorem; that is, small samples (pieces) representative of the signal are taken to be the "objects" to which binary codes will be assigned and thus digitized.
The quantization is the second step. It consists in assigning amplitude values to each sample obtained in the previous step, the foregoing in order to identify each sample that will be encoded.
Finally, and based on the amplitude assigned to each sample, a binary combination is correlated to each of them to be identified. Samples that have the same amplitude will have the same binary code.
Stage C. In this step the adaptive filter algorithm will be implemented in the dsPIC3020F10 in order to perform the tests in real time. The processor will receive the signal in digital format (under previous scanning in Stage B) in order to process it to block the noise and allow the desired signal to pass through.
A DsPIC is a type of microprocessor known as a digital signal processor. It is responsible for real-time processing, a feature that is essential when non-tolerance of delays is required. Basically, a DsPIC [4] acquires a digital signal and processes it to improve it (in the case of audio, a clearer and sharper sound).
The algorithm to be implemented is the noise amplitude modulation least mean square (NAMLMS) which consists in a modification of the LMS algorithm, the foregoing because the noise will have a modulation in its amplitude in order to eradicate it as well as possible.
There is a wide variety of algorithms that can be classified into algorithms of low computational complexity with low convergence speed and high convergence speed algorithms with high computational cost. Some of the most used algorithms due to their low computational complexity are the averaged least squares algorithm (LMS, least mean square) and its normalization (NLMS). These algorithms have been successfully implemented in different systems. However, the convergence speed of these algorithms is slow. This means that the processing turns out to be so slow that it reduces the tests in real time, which would be not feasible for noise reduction applications especially in people suffering from hearing loss.
The proposed scheme of Figure 6 consists of the following stages for the process: 1. Detection of the desired signal mixed with the ambient noise.
2. Attenuation of the environmental noise signal at a rate of 1/x, in order to reduce its amplitude and thus mitigate it. The above will happen only if the signal amplitude exceeds the allowed threshold. The frequency of it is not a factor to consider because we do not intend to distort the noise, only adaptively manipulate its sound intensity.
3. The desired signal is subtracted from the amplitude-modulated noise signal.
4. The signal obtained after the process is compared with respect to the desired one in order to obtain an error.
5. Based on the error obtained, the system is adapted to decide whether to reperform the process or has already converged to the permissible and minimum tolerated error.
Next, the process to follow for the mathematical analysis of the system is shown: 1. The desired signal with the adhered noise is picked up by the system. It is worth mentioning that the desired sound signal is contaminated by the noise prevailing in the environment: The blue graph shows the desired audio signal and used as a reference to compare what you want the system to throw at the output. The green signal is a type of noise captured in the environment, it could be said to be a random signal since it does not have a defined pattern. Finally, the red signal is the mixture of the previous ones.
The objective is to submit the mixed signal (red) to the proposed adaptive system in order to attenuate the noise signal and allow the sound signal to pass through.
The designed filter adapts to the conditions of the environment in which it is implemented. Next, the following figures will show, in parts, the analysis obtained for the proposed algorithm and its comparison with others established in the existing literature related to the subject. Figure 8 shows the frequency response obtained for the passage of frequencies above the 10 kHz frequency which, on average, is the frequency at which a desirable sound oscillates. It is worth mentioning that, as a result of the adaptation, there is a slope that could establish a tolerance margin at lower frequencies.
As can be seen in Figure 8, the response of the NAMLMS algorithm shows a slight hesitation in stability but achieves greater convergence with respect to the responses of the other algorithms. The proposed algorithm was based on the LMS algorithm that results in obvious instability and convergence, concluded, but showing latency. Figure 9 shows the response for the part of the filter that allows low frequencies to pass through. The comparison with the responses of other filtering algorithms is    visualized, and the rapid convergence and adaptation of the response offered by the proposed system stands out. Figure 10 shows the response of the system in general. It can be seen that the union of the two previous frequency responses generates the response of a frequency range through the filter. The objective is to suppress very low frequencies and very high frequencies that can be considered as noise and distortions that affect the human ear causing hearing loss. Figure 11 shows the signal obtained as a response from the system. When compared with the reference signal, a correlation value of 0.912 is calculated which, according to the theory, indicates that there is a strong correlation between both signals and that, although the noise is slightly perceived, the desired signal is clearly perceived.

Conclusion
This chapter proposes an ambient noise cancelation system that allows to attenuate the noise that is mixed with the desired audible signals. Based on the results obtained, it is verified that the convergence of the algorithm is rapid relative to other existing ones, so it can be useful for use in new-generation cochlear implants or as treatments against symptoms of hearing loss.
Subjectively, the algorithm has a slight perception of adhered noise but does not affect its acoustic apparatus or the decoding of the messages of the desired sound signal.
Objectively, the correlation between the signal obtained after the respective system was calculated to the reference signal (desired), and an almost perfect result was achieved. Obviously a 100% correlation is not possible because the noise adhered to the desired sound and it is impossible not to modify some samples of said signal.
On the other hand, we also thank the Instituto Politécnico Nacional that has provided us with its facilities for experimentation and subject to real tests of the system I proposed. Without this valuable help, the development of this work would have been practically impossible.

Author details
Juan Ríos 1 * and Celedonio Aguilar 2 1 Universidad del Valle de México, Mexico City, Mexico 2 Instituto Politécnico Nacional ESIME, Mexico City, Mexico *Address all correspondence to: juan.riosc@uvmnet.edu © 2020 The Author(s). Licensee IntechOpen. This chapter is distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/ by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.