Report for CIT Honors Research Project
Real-Time Active Noise Control Using TI „C54
Advisor: Prof. Tsuhan Chen
Real-Time Active Noise Control Using TI „C54 Ryanth Atmadja 2
Acoustical noise can sometimes disturb or even harm nearby people. Hence, it is necessary to find ways to reduce such unwanted noise. Traditionally, passive means (i.e., physical barriers) to attenuate the noises have been employed. Unfortunately, the barriers are not effective to isolate lower frequency noises; and to achieve significant reduction the barriers have to be rather bulky. In effect, the passive barrier is not a cost-effective solution to reducing low-frequency noises (for example, noises that come from industrial blowers, diesel engines, transformers, earth-moving machines, and propeller-driven aircraft.)
Because of that shortcoming of the physical barriers, active means to reduce low frequency noise (less than 500-1000 Hertz) have been investigated by researchers in the field of adaptive acoustic control. Active noise control (ANC) promises a good reduction of the noises in the form of a small package of a DSP controller, microphone(s), and loudspeaker(s). For the better or the worse, the ANC systems are effective only when the intended noise is periodic, and so random noises like the white noise will not be reduced.
There are different ANC schemes that have been developed. My project is involved with the implementation of one of the schemes that is called “single-channel
adaptive feedback ANC.” The implementation was on a Texas Instruments TMS320C54
evaluation module (EVM) board; in addition to this, I used a microphone and a loudspeaker.
2.1 Adaptive feedback ANC basics
The single-channel adaptive feedback ANC system works by processing the acoustical noise that we would like to reduce (the “target” noise), and then it produces an anti-noise
which is sent to the air, thus attenuating the target noise at a particular point in space (in our case this is the space adjacent to the error microphone). Therefore, the goal of the ANC system is to minimize the signal received by the error microphone.
Real-Time Active Noise Control Using TI „C54 Ryanth Atmadja 3
Figure 2.1 The Single-Channel Feedback ANC System; a generalized concept.
The anti-noise waveform is similar to that of the target noise, except that its phase is reversed by 180 degrees. If these waveforms are added together, they will result in a much weaker residual waveform (this waveform should be zero amplitude if the anti-noise matches perfectly with the target noise.) In Figure 2.1, the residual waveform is what is picked up by the microphone.
Figure 2.2 Physical description of active noise control
The feedback ANC system produces an anti-noise by predicting the incoming
target noise. This is not different from an adaptive system identification scheme; to achieve this, the system uses the Least-Mean Squares (LMS) algorithm to update an adaptive filter‟s coefficients which is the heart of ANC signal processing.
As shown in Figure 2.3, the target noise d[n] is not available because it is intended to be canceled by the anti-noise. Our goal is that we want to create an anti-noise y[n] which predicts the inaccessible d[n]. Therefore one task of the feedback ANC algorithm is to estimate d[n] and use it as the reference signal x[n] for the adaptive filter W(z). (Notice that y[n] is in the electrical domain, and in order to cancel d[n] it must go through the speaker and the air: this is modeled by secondary path filter S(z).)
Real-Time Active Noise Control Using TI „C54 Ryanth Atmadja 4
Figure 2.3 Simplified block diagram of single-channel feedback ANC system.
In Z-domain, the target signal can be expressed as
where E(z) is the error signal picked up by the microphone, and Y(z) is the anti-noise generated by the adaptive W(z) filter. If the secondary path S(z) is measurable (expressed
^as S(z)), then we can estimate the target noise d[n] (let us call this the synthesized x[n]).
，，. (2) X(z)！D(z)？E(z);S(z)Y(z)
Therefore, the algorithm achieves its first task, which is to regenerate the reference signal
^x[n] ！ d[n].
For completeness, in time domain (2) is expressed as
M；1，，x[n]！d[n]？e[n];sy[n；m] (3) (mm？0
where s^, m = 0, 1, … , M-1 are the secondary-path FIR filter coefficients. m
The next task is to create the anti-noise y[n] from x[n] such that the error signal e[n] is minimized. We employ the filtered-x LMS algorithm to do this, however in this paper I will not discuss why the FXLMS algorithm works.
Real-Time Active Noise Control Using TI „C54 Ryanth Atmadja 5
Figure 2.4 Adaptive feedback ANC system using the FXLMS algorithm
The anti-noise is generated as
y[n]？w[n]x[n；l] (4) (ll？0
where wl = 0, 1, … , L-1 are the coefficients of W(z). l,
These coefficients are updated according to the filtered-x LMS algorithm, which is expressed as
'w[n;1]？w[n];？x[n；l]e[n],l？0,1,...,L；1 (5) ll
where ？ is the step size, and
M；1'^x[n]？sx[n；m] (6) (mm？0
is the filtered x[n]. Note that only finite impulse response (FIR) filters are used in the ANC algorithm in order to guarantee linear phase – I used circular buffers to implement
the FIR filters.
Thus the adaptive ANC algorithm is now complete, except for one part, that is
^how we can model the secondary path filter S(z).
Real-Time Active Noise Control Using TI „C54 Ryanth Atmadja 6
2.2 Off-line secondary-path modeling
^(z), off-line and on-line. The on-line There are two distinctive techniques to model S
modeling technique should prove to be more flexible because it models the secondary path while the ANC is in operation. On the other hand, although the off-line modeling will make a functional system, it models the path only once before the ANC algorithm starts, hence any change in the path while the ANC algorithm is active will degrade its noise-reducing performance.
In my project I employed the off-line modeling because it will not add the computational complexity of the ANC algorithm – the TI „C54 is a low-powered, non-
superscalar processor, and so we want to avoid extra computational burden as much as possible in order to achieve the best performance (this is especially true since I used the „C54 C compiler to generate the ANC code, instead of doing low-level programming with the assembly language.) The block diagram of the off-line secondary-path modeling is shown as follows,
Figure 2.5 Off-line secondary-path modeling experimental setup.
(Figure taken from Kuo and Morgan (1996).)
As Kuo and Morgan (1996) says, the white noise is an ideal broadband training signal in system identification, because it has a constant spectral density at all frequencies. Using an internally-generated white noise to perform the modeling is desirable because
Real-Time Active Noise Control Using TI „C54 Ryanth Atmadja 7
the required measurement time can be quite short relative to the time required for repetitive measurements using other waveforms Kuo and Morgan (1996).
These are the steps in the off-line secondary-path modeling algorithm:
1. Pick a value in from the pre-generated random noise vector, and assign it as
2. Send x[n] to the speaker.
3. Get d[n] from the microphone
4. Apply the LMS algorithm as follows:
^(z) output ， Compute adaptive filter S
L；1，y[n]？s[n]x[n；l] (7) (ll？0
， Compute the error signal
， Update coefficients according to the LMS algorithm
，， (9) s[n;1]？s[n];？x[n；l]e[n],l？0,1,...,L；1.ll
5. Go to 1 until the algorithm converges (i.e., e[n] is minimized.)
^After convergence, S(z) is fixed and used in the single-channel adaptive feedback ANC algorithm described earlier.
3. ANC Implementation
3.1 Preliminary works
3.1.1 Creating the C framework
Before I could implement the ANC algorithm on the „C54 EVM board, I had to create a C-platform for the EVM board that acted as a framework for the algorithm. Additionally, the C-platform would be able to support the duplex communication between the EVM board and the host PC (the EVM board was attached in the PC‟s expansion slot.)
Real-Time Active Noise Control Using TI „C54 Ryanth Atmadja 8
I planned at the beginning of my project that the EVM board would do all of the signal processing, and the PC would only act as the user‟s interface and it would download the processed data from the EVM board after the ANC operation is done – this
data would then be processed with MATLAB to analyze the noise-reduction performance of the ANC system.
Figure 3.1 Hardware Setup
Moreover, it is necessary to mention that while the system operates, there are two programs running concurrently, the host PC side, and the EVM side, both of which could be coded in C language.
Now we discuss how I created the EVM C-platform: there was an assembly code provided by Texas Instruments that did sampling, playback, and simple delay. I determined that the C-platform should have similar sampling and playback functions that will be callable from C. So I learned the „C54 hardware and software in order to create these C-functions. It turned out that I had to understand how hardware interrupts work in „C54. Eventually, after going through many obstacles I managed to create the functions,
as well as the rest of the C-environment such as a run-time setup function. Furthermore, the „C54 low-level debugger helped me to create the „C54 C-programming environment.
3.1.2 MATLAB simulations
The second preliminary work was to simulate the single-channel adaptive feedback ANC described in Background. I implemented the algorithm as MATLAB scripts. I found that
Real-Time Active Noise Control Using TI „C54 Ryanth Atmadja 9
the algorithm could cancel a sinusoidal noise completely after algorithm convergence, however, it could only halve the amplitude of a recorded fan-noise though it “blended”
the noise so that it looked like a white-noise. Also, I tried many different adaptive filter lengths and step sizes, as well as different target noise strengths.
Although the MATLAB simulations could not simulate cancellation in the air, and also it was not a real-time system, they did give me a rough estimation of the performance that I should expect from a working ANC system using the EVM board.
3.1.3 ANC on PC
Just before I embarked on coding the ANC on the EVM board, my advisor suggested that I should first try to make the ANC work on the PC, because the PC had less constraints such as I could do floating-point computations with it. At this point the EVM served only as a data sampler. I determined that the PC-version of the ANC algorithm should be able to cancel noise to the air, but at this point I had a problem with sending data back to the EVM board and hence the speaker. The resulting system was not real-time, and just like the MATLAB simulations, I did the noise cancellation in software.
3.2 Implementing ANC on the ‘C54 EVM board
After the preliminary works were done, I started to modify the PC-version ANC code such that it would run on the EVM board. The biggest modification that I had to accomplish was how to do fractional number computations while the „C54 is a 16-bit
word processor, meaning that it is designed for fixed-point computation, as opposed to floating-point. My advisor gave me an idea on how to think about this, and I decided that it was also necessary to explore how the „C54 architecture handles multiplications (The feedback ANC algorithm does not require fractional-number division. Moreover, no extra operation needed after fixed-point addition/subtraction to get the correct results.) Due to the multiplication architecture of the „C54, I had to arithmetically shift right by fifteen positions after every fixed-point multiplication.
As a detour, I used a fixed-point implementation called Q15, meaning that the decimal point is placed on the right of the sign-bit (the leftmost bit of the word.) The Q15
Real-Time Active Noise Control Using TI „C54 Ryanth Atmadja 10
numerical representation gives the best fractional number resolution that is possible with 16-bit word processors like the „C54 [SPRA 480.]
I should mention that I did not implement the off-line secondary-path modeling (see Background) while I was doing the MATLAB simulations and PC-version of the ANC – I only coded this for the EVM board. From now on, we refer this modeling as ANC1, and the actual noise-reducing algorithm as ANC2.
I tested ANC1, but it seemed to have a problem with random-number (white noise) generation – I discovered the cause later on. Therefore I worked on making ANC2 to function, and then went back with ANC1 to solve the above problem.
After ANC1 and ANC2 were operational, my advisor pointed out that the performance of my ANC system should not degrade when the target noise had a small DC-bias. From Kuo and Morgan (1996) we inferred that in Figure 2.4 we should convolve the error signal e[n] with a high-pass filter before we added it with the filtered y[n], and so I did that.
Besides putting these filter in place, I determined that I should lower the sampling rate of the real-time system down to 2 kHz, previously it was 7.2 kHz. There is a huge benefit of using this low sampling rate: more computational time for each sample, and therefore I could use longer filter-length. In turn, longer filter-length combined with low sample rate should enable my system to reduce 25 Hz noises (2000 Hz / 80). However, by doing this I risked aliasing because the analog interface circuit‟s (AIC) low-pass filter
minimum bandwidth is 3.6 kHz. Therefore, for correct operation of my system, the frequency of the target noise must be between 25 Hz to 1000 Hz (half the sampling rate –
according to the sampling theorem.) But this range is what we should expect from an ANC system (see Introduction), although probably we want even lower figure than 25 Hz to handle very low-frequency noises such as a diesel engine at idle.
By this point, I had finished building the final real-time ANC system with the „C54 EVM board, except that I had not tested its performance. So this was the final step that I did – I had to test my system many times with different strengths and kinds of target noises, step-sizes, filter-lengths, and see how they relate with each other.