Abstract:
The length (or the number of taps) of an adaptive finite impulse response (AFIR) filter is continuously modified to produce optimal echo cancellation. In accordance with one illustrative embodiment, this modification is performed by increasing or decreasing the number of delayed samples which are used to generate an echo estimate. More specifically, the number of samples used to generate the echo estimate is determined by selecting a trial number of samples and operating the filter for a sufficient length of time to allow the tap weights in the filter to stabilize. The tap weights are then examined to determine whether the taps at the end on the filter contribute at least a first threshold amount to the echo estimate. If not, the number of samples used in the filter is reduced and the process repeated. If the taps at the end of the filter contribute more than a second threshold amount, the number of samples is increased and the process is repeated.

Description:
FIELD OF THE INVENTION 
     This in elates generally to speakerphones and, in particular, to speakerphones which operate in the full duplex mode of operation. 
     BACKGROUND OF THE INVENTION 
     One of the most popular pieces of telephone equipment presently on the market is the speakerphone, a device which allows &#34;handsfree&#34; operation by utilizing a microphone and a loudspeaker to receive and transmit voice information or other sounds. Although speakerphones have been in existence for many years, they typically suffer from certain drawbacks which often make their use difficult or inconvenient. More particularly, because its microphone and loudspeaker are located in close physical proximity (often together in a small unit), the speakerphone is highly susceptible to interference from echoes caused by sounds generated by the loudspeaker and received by the nearby microphone and other noise generated by both acoustic and electrical sources. In addition, speakerphone systems are susceptible to electrical echoes. An electrical echo is generated when a portion of the electrical signal which represents the acoustical information is &#34;reflected&#34; as the signal travels along the electrical circuit and the reflected portion of the signal travels back to its source. 
     Acoustic echoes occur because sounds generated by the loudspeaker are detected by the microphone and transmitted back over the telephone line. The sounds generated by the speaker reach the microphone either directly or by reflections from the walls of the room in which the phone is located. One method of eliminating acoustic echoes is to utilize a &#34;half-duplex&#34; system in which either the speaker or the microphone is active, but both devices are not active at the same time. In such an arrangement, a circuit monitors the microphone output and turns off the speaker for a predetermined period of time when the microphone has detected a sound. Similarly, if the speaker is active, the microphone is disabled for a predetermined period of time. 
     Half duplex systems suffer from a problem that only one person of a two-person conversation can speak at any given time and, even then, the first syllable or two of speech is often &#34;clipped&#34; or lost due to the &#34;dead&#34; time interval that occurs when the microphone switches from the inactive state to the active state. When a half-duplex speakerphone is connected to a conventional handset phone, the clipping problem is acceptable, but when two such speakerphones are connected together, it is often very difficult to converse without losing a significant amount of information. In order to overcome the problems associated with half-duplex speakerphones, &#34;full-duplex&#34; speakerphones have been used in which both the microphone and the speaker are operational at all times, but such systems are extremely susceptible to acoustic echoes. 
     FIG. 1 is a schematic block diagram which illustrates how both acoustic and electrical echoes are generated in a speakerphone system. In particular, FIG. 1 shows a schematic representation of a full-duplex speakerphone consisting of a speaker 104 and a microphone 120 connected to telephone circuitry 106. The speaker 104 and the microphone 120 are located in a room 102 and the telephone circuit 106 is, in turn, connected by means of a two- wire receiving leg 108 and a two-wire transmitting leg 122 to a hybrid circuit 124. The hybrid circuit 124 converts the four-wire circuit, comprising legs 108 and 122, to a two-wire line 125. At the other end of the telephone line, a similar hybrid circuit 114 converts the two-wire line 125 back into a four-wire circuit comprising a receiving leg 112 and a transmitting leg 128. 
     An acoustic echo is generated when a sound emanating from the speaker 104 is transmitted into the microphone 120 (for example, by reflection from the room walls 103) and is heard by the person at the other end of the phone line 125. Since there are typically a variety of paths by which a sound generated by speaker 104 can reach microphone 120, many acoustic echoes can be generated from the same initial sound. Three such echo paths (paths 100, 116 and 118) are illustrated in FIG. 1. The echoes are annoying to the person at the far end. 
     As previously mentioned, an electrical echo is generated in the speakerphone system when a portion of the electrical signal transmitted from the near end is reflected back by impedance discontinuities in the electrical circuit and the reflected portion of the signal travels back to its source. 
     Acoustic and electrical echoes are particularly annoying when two persons are conversing over speakerphones because the echoes from a previously uttered phrase often arrive as a person has begun speaking a new phrase. Consequently, in most speakerphone systems, and, in particular, full-duplex speakerphone systems, adaptive filters are used to reduce the echoes to an acceptable level. 
     Specifically, at the near end, the signal reaching the loudspeaker is also applied to an adaptive filter whose output is subtracted from the electrical output of the microphone. The filter is adjusted automatically to provide a transfer function close to identical with that of the path through the loudspeaker and microphone by way of the acoustical coupling between those components. The subtractive process thus eliminates, or greatly reduces, the acoustic feedback signal in the microphone output. The same arrangement is used to cancel electrical echoes by applying the electrical signal generated by the microphone to a second adaptive filter whose output is subtracted from the signal going out to the loudspeaker. A typical adaptive filter used in speakerphone systems is called an adaptive finite-impulse-response (AFIR) filter which is comprised of a tapped delay line that generates signals that are selectively combined to generate the filter output. 
     FIG. 2 shows the telephone circuitry in an illustrative speakerphone (corresponding to a portion of circuitry 106 in FIG. 1)in which two digital AFIR filters are used as echo cancelers to cancel both acoustic and electrical echoes. In the illustrated circuit, AFIR filter 212 is used as an acoustic echo canceler and AFIR filter 216 is used as an electrical echo canceler. The microphone input 200 is provided to an analog-to-digital converter 202 where it is sampled at the Nyquist rate to generate a plurality of digital samples over time. These samples are provided to a summer 204 where the correction signal output 213 of the AFIR filter 212 is subtracted to generate the echo-corrected signal. This latter signal is provided over bus 206 to digital-to-analog converter 210 and reconverted back to analog form for transmission over the telephone lines attached to line output 208. An error signal, derived from the corrected signal, is also fed back to the AFIR filter 212, via bus 214, in order to adaptively adjust the filter coefficients in a known manner to cause the filter to adapt to changes in the echo generating mechanisms as discussed above. 
     In a similar manner, signals received at the line input 230 are provided to an analog-to-digital converter 228 for conversion into digital form. The digital signals are, in turn, provided to a summer 226 which subtracts the correction signals generated by electrical echo corrector filter 216. The digital output samples (for line and speaker) are converted to analog signals using digital-to-analog converter 222. The corrected signal is also fed back to AFIR filter 216 via bus 218 in order to adaptively adjust the filter coefficients as explained above for AFIR filter 212. 
     More specifically, a typical finite-impulse-response (FIR)filter is a linear filter, preferably in the form of a tapped delay line. Each tap has associated with it a &#34;weight&#34; which modifies the characteristic of the filter. If the delay line has only feed-forward delays, its transfer function can be expressed as a single polynomial in Z -1  and the filter&#39;s impulse response is limited to a finite number of points; therefore, it has a finite impulse response. 
     An adaptive finite impulse response (AFIR) filter is an FIR filter with provision for automatic adjustment of its tap weights. FIG. 3 shows an AFIR filter with a least-mean-squared (LMS) algorithm used for adapting the tap weights which filter is used, in this example, as an echo canceler. A plurality of received digital signal samples, A(k), which are typically samples derived from an analog signal sampled at, or above, the Nyquist rate, is introduced to the filter at the input 310. This signal is used as a reference signal to develop an estimate of the echo to be canceled and the signal is applied to successive delay units 300, 302, etc. until the &#34;end&#34; of the filter at delay unit 308 is reached. 
     Each of the delays: 300, 302, 304, 306, 308 and any additional (but not illustrated) delays, produces a delayed version of the signal which is provided to it and the delayed signal version is passed on to the next delay unit. The delayed versions of the signal (illustrated as signals A 1  -A N ) are also fed to multipliers 312, 314, 316, 318, through 320 where they are multiplied by associated tap weights C1, C2, C3, C4, through C N . The multiplier outputs are fed into summer 322 where they are added to produce, in the case of an echo cancellation application, the filter output which is an estimate of the echo. 
     The echo estimate, S(k), is subtracted from the signal R(k), which is the desired (echo-free) signal corrupted by the echo, by adder 330. The output of adder 330, E(k), is used as an estimate of the desired signal 326 and comprises the actual desired signal plus whatever residual error exists between the estimate of the echo S(k), and the actual echo signal. 
     The desired signal estimate E(k)is also used to modify the tap weights, that is, adapt the FIR filter, generally by means of an algorithm as shown at 328. The particular algorithm illustrated in box 328 is a least mean squares (LMS) algorithm which computes the tap weight for a given sample (C i  (k+1)) using the tap weight used with the previous sample (C i  (k)) plus a correction factor which consists of a product of a convergence constant (β), the delayed signal from the previous sample (A i  (k)) and the estimated signal from the previous sample time (E(k)). This adaptation reduces the signal error attributable to echoes and adjusts to changing conditions which modify the echo characteristics. 
     FIG. 4 shows an illustrative flow chad for operating an AFIR filter such as that shown in FIG. 3. The process begins at step 400 and proceeds to step 402 where the next sample, corresponding to a sampled version of a reference signal 310 of FIG. 3, is retrieved. Then an echo estimate is generated at step 404 using an FIR filter. An input sample, corresponding to the desired output sample plus an echo contribution is then retrieved at step 406. The estimated output is calculated at step 408 and is used at step 410 to update the tap weights (C n ) associated with the AFIR. At step 412, the echo-canceled signal, E(t), is output. At this point, the routine is complete, as illustrated by step 414. 
     AFIR filters can be used as illustrated in FIGS. 2 and 3 to reduce both acoustic and electrical echoes in speakerphones, however, such filters cannot be designed to optimize echo reduction in every environment. In particular, in prior art designs, the length, or the number of taps in the AFIR filter is fixed by the circuit designer and this length directly affects the capacity of the filter to cancel echoes in selected environments. 
     For example, in environments where long-delayed echoes are present, a filter with a long delay line or many taps produces optimal echo reduction since it may be necessary to delay the reference signal by a long time delay in order to generate an accurate echo estimate. On the other hand, when a filter with a long delay line is used in environments where the echo delay time is shod, the taps at the end on the delay line contribute very little to the echo estimate and increase quantization noise in the output. Consequently, a circuit which is to operate in many different environments must necessarily be a compromise design and, therefore, may not be optimal in any given environment or in environments which change over time. 
     Accordingly, it is an object of the present invention to provide echo cancellation circuits which improve echo cancellation over prior art echo cancellation circuits. 
     It is another object of the present invention to provide echo cancellation circuits which automatically adjust the length of the AFIR filter delay line in order to cancel echoes optimally in most environments. 
     SUMMARY OF THE INVENTION 
     The foregoing problems are solved and the foregoing objects are achieved in one illustrative embodiment of the invention in which the length (or the number of taps) of an adaptive finite impulse response (AFIR) filter is continuously modified to produce optimal echo cancellation. 
     In accordance with one illustrative embodiment, this modification is performed by increasing or decreasing the number of delayed samples which are used to generate the echo estimate. More specifically, the number of samples used to generate the echo estimate is determined by selecting a trial number of samples and operating the filter for a sufficient length of time to allow the tap weights in the filter to stabilize. The tap weights are then examined to determine whether the taps at the end on the filter contribute at least a first threshold amount to the echo estimate. If not, the number of samples used in the filter is reduced and the process repeated. If the taps at the end of the filter contribute more than a second threshold amount, the number of samples is increased and the process is repeated. 
     Adding or subtracting delayed signals (or taps) at the end of the filter can be used to minimize both electrical and acoustic echoes under changing conditions. Additional advantages include a reduction in quantization errors in the output as only the necessary filter terms are summed in the filtering algorithm to generate the echo estimate. 
     Further, in accordance with another embodiment, a reduction in storage requirements for the data samples and the coefficients can be achieved by means of dynamic memory allocation. As the number of filter samples used in the calculations is reduced, thereby reducing the memory allocated to store the samples and coefficients, the unallocated memory can be used for other purposes. For example, in a system which uses two or more filters, the length of one filter can be extended as the length of another filter is reduced. This shifting of memory resources between filters makes it possible to reduce the overall memory requirements and leads to a more economical implementation. 
     In yet another embodiment, filter-length adaptation is performed by a controller which determines when, and in what direction, the filter length should be modified. The controller may be implemented along with filter itself and other signal processing functions by a digital signal processing chip (integrated circuit). Further, if a digital signal processing chip is employed to produce the filtering functions, both acoustic and electrical echo cancellation may be accomplished on a single chip, thereby providing additional performance and cost advantages. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     For a fuller understanding of the nature of the invention, reference should be made to the following detailed description taken in connection with the accompanying drawings, in which: 
     FIG. 1 is a block diagram of a prior art speaker phone system. 
     FIG. 2 is a block diagram of a portion of a prior art phone circuit illustrating the use of AFIR filters for acoustic and electrical echo cancelers. 
     FIG. 3 is a more detailed block diagram of a prior art adaptive finite impulse response filter (AFIR)illustrating the tapped delay line construction. 
     FIG. 4 is a flow chart which sets forth the operation of an adaptive process used to update the filter coefficients of a prior art AFIR. 
     FIG. 5 is a diagram which illustrates the range of allocation of memory locations to received signal reference samples, A 1  -A N , and filter coefficient weights, C 1  -C N , in an adaptive length adaptive finite-impulse-response (ALAFIR) filter. 
     FIG. 6 is a diagram which shows an illustrative arrangement of memory in a system which employs two ALAFIR filters implemented in accordance with the principles of the invention. 
     FIG. 7 is a flow chad which sets forth the sequence of steps employed by a two filter ALAFIR echo canceler. 
     FIG. 8 is a flow chart which shows an illustrative method of determining whether the length of an ALAFIR filter should be changed in accordance with one embodiment of the present invention. 
     FIG. 9 is a flow chart which illustrates the process of determining filter lengths for a two-filter application in accordance with another embodiment of the present invention. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT 
     The basic concept of an ALAFIR is illustrated in FIG. 5 where C 1  -C N  and A1-A N  represent the tap weights and delayed data samples, respectively, of an AFIR. FIG. 5 illustrates a portion of a memory in which the various samples and coefficients are stored. Each tap in the filter requires data storage for two data words: one word represents the delayed signal value and the other word represents the tap coefficient, or weighting, value. For example, the first filter tap 500 is represented by delayed sample value A 1  (502) and tap coefficient value C 1  (504). The last filter tap 506 is represented by delayed sample value A N  (508) and tap coefficient value C N  (510). 
     As the filter is lengthened or shortened, the number of taps and, therefore, the number of tap weights, C N , and delayed samples, A N , which must be stored varies accordingly between a minimum number 512 to a maximum number 514. The minimum number of taps, represented by line 512, is that number which satisfies the minimal filter performance criteria. The maximum filter length, represented by line 514, is generally limited by the size of the memory. In accordance with the principles of the present invention, and as will be discussed in detail below, a length adapting process automatically adjusts the filter length to optimize filter performance. 
     FIG. 6 shows an illustrative memory-allocation scheme for a system which uses two ALAFIRs. A data memory portion 600 is provided for storing the delayed samples and a separate memory portion 602 is provided for storing the tap coefficient values. Each of memory portions 600 and 602 illustratively have the same fixed memory length 603. Each of memory portions 600 and 602 is further divided into two segments with one segment corresponding to each of the two filters. For example data memory portion 600 is divided into a segment 604 for filter AFIR1 which stores the delayed data values AX 1  -AX N  and a segment 606 for a second filter AFIR2 which stores the delayed data values AY 1  -AY N . The memory segments are separated by a &#34;buffer&#34; space 612. 
     It should be noted that as filter AFIR1 becomes longer and the number of stored data samples increases, the additional stored samples are added starting at the beginning of the filter (the &#34;left&#34; end of memory segment 604) and increasing towards buffer space 612 (the filter &#34;grows&#34; to the right hand side of segment 604). In the same manner, as filter AFIR2 increases in length, the additional stored samples are added starting at the beginning of memory segment 606 (the &#34;right&#34; end of segment 606) and increasing towards the end of the filter next to the buffer space 612 (towards the &#34;left&#34; of memory segment 606). 
     In the same manner, the coefficient memory portion 602 is divided into a segment 608 for filter AFIR1 which stores the tap coefficient values CX 1  -CX N  and a segment 610 for a second filter AFIR2 which stores the tap coefficient values CY 1  -CY N . The latter two memory segments are separated by a &#34;buffer&#34; space 614. 
     As filter AFIR1 becomes longer and the number of stored coefficient values increases, the additional stored values are added starting at the beginning of the filter (the &#34;left&#34; end of memory segment 608) and increasing towards buffer space 614 (the filter &#34;grows&#34; to the right hand side of segment 608). In the same manner, as filter AFIR2 increases in length, the additional stored values are added starting at the beginning of memory segment 610 (the &#34;right&#34; end of segment 610) and increasing towards the end of the filter next to the buffer space 614 (towards the &#34;left&#34; of memory segment 610). 
     In accordance with the principles of the invention, the memory portions 600 and 602 are dynamically allocated between the filters AFIR1 and AFIR2; the memory &#34;freed up&#34; by one filter may be used by the other (all of the allocated memory elements are &#34;zeroed&#34; after they are released from one filter and before they are assigned to the other filter). 
     The lengths of the filters may be adapted dependently or independently however, in general, both the data memory segment and the corresponding coefficient memory segment are the same length for a given filter (for example, filter AFIR1 data memory segment 604 has the same length as filter AFIR1 coefficient memory segment 608). If the lengths are adapted dependently, an increase in the length of one filter (for example, filter AFIR1) automatically brings about a corresponding decrease in the length of the other filter (filter AFIR2), therefore, buffer spaces 612 and 614 may comprise a fixed number of memory locations. Alternatively, if the filter lengths are adapted independently, the size of buffer spaces 612 and 614 may be increased to a maximum size or decreased to a minimum size in order to accommodate the changes in combined length of the filters. 
     Filter length is changed by examining the coefficient values at the end of the filter (the &#34;trailing&#34; coefficients) and using the coefficient values to make a determination that the coefficient values are small and, thus, the trailing taps are not making a significant contribution to the output, in which case the filter length can be decreased. Alternatively, the coefficient values may be large indicating that delayed signal values have been discarded because the filter is too short, in which case the filter length in increased. 
     The examination of the trailing coefficient values and the decision as to whether the trailing taps are contributing too much or too little to the echo estimate may be based on a variety of criteria. For example, the examination may be based on the RMS value of the trailing coefficients or coefficient &#34;energy&#34; changes, or the sum of the coefficient absolute values. In addition, the length adjustment process of an ALAFIR may also take into account the return loss enhancement of the filter by adjusting the filter length to provide the same echo return loss enhancement (ERLE) as a comparable AFIR. According to conventional definitions the ERLE of a particular filter is given by: ##EQU1## 
     where 
     
         E[y(k).sup.2 ]=average power of the returned signal, and 
    
     
         E[e(k).sup.2 ]=average power of the uncanceled echo signal. 
    
     If length adjustment is performed on this basis, the ALAFIR will provide the same ERLE as the comparable AFIR while reducing the quantization error. The ALAFIR will exhibit lower quantization error because an ALAFIR will require fewer taps to provide the same ERLE as the comparable AFIR. 
     For example, the RMS value of the trailing coefficients can be used for filter length adaptation. More particularly, a predetermined number CX&#34;) of the trailing coefficients are selected for examination. The RMS value of these &#34;X&#34; coefficients is computed and this value is compared to predetermined upper and lower thresholds. Illustratively, the upper and lower thresholds may be based on the RMS value of all the filter coefficient values. The filter is lengthened if the RMS value of the last &#34;X&#34;coefficients exceed the upper threshold and the filter length is shortened if the RMS value of the last &#34;X&#34; coefficients is less than the lower threshold. The RMS value of the last &#34;X&#34; coefficients (RMS X ) may be computed according to the following equation: ##EQU2## 
     where the number of examined coefficient values X may be chosen according to either arbitrary or empirical criteria. Illustratively, the number of examined coefficient values ranges between 10 and N/20. 
     In another exemplary embodiment, the filters length may be adjusted in response to the coefficients &#34;energy&#34; change. This method entails computing a running average, E N , of the energy of all coefficients according to the equation: ##EQU3## 
     The energy content of the last &#34;X&#34; coefficients, E x , is then calculated by: ##EQU4## 
     If the energy E x  is, for example, less than 5% of total energy E N , then the last &#34;X&#34; taps are not needed and the filter is shortened by X taps. However, if, for example, E x  is greater than 10% of total energy E N , the filter is lengthened by X taps. In another exemplary embodiment, the filter length is adapted according to the coefficients&#39; absolute values. The average absolute value of the last &#34;X&#34; coefficients (A x ) is computed and compared to the average absolute value of all the coefficients (A N ): ##EQU5## 
     Filter length adjustment is then made according to the following criteria: 
     if A x  ≦A N  /20 then decrease filter length 
     if A x  ≧A N  /10 then increase filter length 
     where the predetermined thresholds 20 and 10 are chosen either arbitrarily or empirically. 
     However, regardless of which criterion is chosen, filter length is adjusted only after a time delay from a prior length adjustment. This adjustment delay, designated T A , allows sufficient time for the filter coefficients to converge and stabilize at their optimum values. In general, the adjustment delay is proportional to the length (total number of taps, N) of the AFIR and inversely proportional to β, the convergence constant for the tap weights and may be determined by the following relationship: 
     
         T.sub.A =k·N/62 
    
     where k is an adjustment constant. 
     The flow chart of FIG. 7 illustrates an exemplary implementation of a two-filter ALAFIR wherein the lengths of both filters, AFIR1 and AFIR2, are automatically adjusted. The implementation begins at step 700 and proceeds to step 702 where the system is initialized. The initialization may involve, for example, clearing or zeroing all memory spaces for the data samples and the coefficient segment for both filters and clearing all computation variables. 
     At step 704, an interrupt flag is checked to determine whether new reference input samples, AX i  and AY i , have been received for each of the filters AFIR1 and AFIR2. If no reference samples have been received, no interrupt flag is set and the filter proceeds to an off-line process illustrated by step 708. In this off-line process, as will hereinafter be discussed in detail, the routine determines whether the lengths of the filters AFIR1 and AFIR2 should be adjusted, and, if so, a Chg-Len flag is set. As previously mentioned, this determination is made only after a delay T A  from the previous filter length adjustment. Consequently, before checking the filter lengths, the routine checks to see whether the time interval from the last filter adjustment equals or exceeds the predetermined time delay, T A . This latter determination is made by comparing a variable Chg-Cnt to the predetermined delay number T A . The Chg-Cnt variable is incremented as discussed below and determines when the filter length will be changed. The program continues to loop through this off-line process until new reference samples, AX i  and AY i , are received and detected at step 704 by an examination of an interrupt flag. 
     When new reference samples are detected at step 704, the routine proceeds to step 706 where new reference input samples, AX i  and AY i , for filters AFIR1 and AFIR2 are read into the next available memory locations. Then, at step 710, the Chg-Len flag, which may have been set in step 708, is tested to determine whether the filter lengths should be adjusted and, if so, in step 714, they are adjusted to the lengths determined in the off-line process of step 708 and the Chg-Cnt variable is reset to zero thereby starting a new time interval between length adjustments. 
     If no change in length is called for (the Chg-Len flag is not set), the routine proceeds to step 712 where the Chg-Cnt variable that indicates the interval of time since a previous filter length adjustment, is incremented. From there the routine proceeds to step 716, where filter tap weights are adapted (for example, using the routine illustrated in FIG. 4) and, at step 718, echo-canceled samples are output in accordance with step 412 as set forth in FIG. 4. The process is then complete, as indicated at step 720. 
     In this exemplary embodiment, most of the code needed to adapt the lengths of the ALAFIR filters executes in the time between incoming data samples and, in that sense, it is &#34;off-line&#34;. FIG. 8 illustrates, in detail, an exemplary embodiment of off-line code which employs the aforementioned coefficient energy criterion to adapt the length of a single AFIR filter. The length determination process begins at step 800 and proceeds to step 802 where the Chg-Len flag, is initialized to indicate that the length of the filter should not be changed. 
     Next, at step 804, the variable Chg-Cnt is compared to the predetermined adjustment delay T A to determine whether the filter coefficients have had sufficient time since the last length change to converge to their steady-state values. If insufficient time has elapsed, the program proceeds to finish in step 818. 
     If, on the other hand, sufficient time has elapsed since the last length adjustment, the energy content of all the coefficients, E N , is computed in step 806 by summing the squares of all tap coefficient values for tap coefficients C 1  to C N . In step 808, the energy content of the last &#34;X&#34; coefficients, E x , is computed by summing the squares of tap coefficient values for tap coefficients C N-X  to C N . E x  and E N  are then compared in step 812. If the energy content of the trailing coefficients, E x , is greater than 10% of E N , then, at step 810, Chg-Len is modified to indicate that the filter length should be changed. The new length of the filter may also be determined at this point. In accordance with one embodiment, the new length would be the original length increased by X taps. The coefficient and data memory segments for the filter are then cleared in preparation for a change in filter length which actually set in step 714 (discussed previously). After this step, the routine proceeds to finish in step 818. 
     Alternatively, if the energy content of the trailing coefficients, E x , is less than 10% of E N , the program proceeds to step 816 where it determines whether E x  is less than 5% of E N . If so, the routine proceeds to step 814 where the Chg-Len flag is set to indicate that the filter length should be changed and the filter length is set (to a negative number) to cause a decrease in filter length. The coefficient and data memory segments for the filter are again cleared in preparation for a change in filter length. After this, the routine proceeds, as it would if E x  were greater than 5% of E N , to the finish, step 818. 
     The flowchart of FIG. 9 illustrates, in detail, an illustrative example of &#34;off-line&#34; code used to set the filter length for a two-filter ALAFIR. It is illustratively assumed that the filter lengths for filters AFIR1 and AFIR2 are changed dependently, that is, as one filter is increased in length, the other is decreased by the same amount. The illustrated process begins at step 900 and proceeds to step 902, where the Chg-Len flag is reset to indicate that the filter lengths should not be changed. Next, at step 904, the routine determines whether a sufficient time interval has elapsed since the previous filter-length adaptation to let the coefficients converge to their steady-state value. This latter determination is made by comparing the Chg-Cnt variable value to the adjustment delay value T A , as previously discussed. If the coefficients have not had time to converge, the program proceeds to step 924 and completes this &#34;off-line&#34; segment of the program. 
     If, on the other hand, the coefficients have had time to converge, the program proceeds from step 904 to step 906 where one of the two filters is selected for length adjustment. If AFIR1 is selected, the program proceeds to step 908 where the coefficient energy is computed for all of the AFIR1 tap coefficients as explained in relation to FIG. 8 at steps 806 and 808. 
     At step 912, the routine determines whether the length of the AFIR1 filter should be increased, based on whether the energy of the last &#34;X&#34; coefficients is greater than or equal to 10% of the energy of all the coefficients in a manner similar to that discussed in connection with steps 812 and 810 of FIG. 8. If, in step 912, a determination is made that the length should be increased, the routine proceeds to step 914, where variables AFIR1len and AFIR2len indicating the lengths of filters AFIR1 and AFIR2, respectively are adjusted. This adjustment is performed by increasing the length of filter AFIR1 (AFIR1len) by X taps as indicated schematically in step 914 and decreasing the length of filter AFIR2 (AFIR2len) by the same X taps. The Chg-Len flag is then set to cause the filter lengths to be reset. The routine then proceeds to finish in step 924. 
     If the length of filter AFIR1 need not be increased as determined in step 912, the routine proceeds to step 91 8 where it determines, based on whether the computed coefficient energy of the last &#34;X&#34; coefficients is less than 5% of the energy of all the coefficients, whether the length of the filter AFIR1 should be decreased. Again, this determination is made as outlined in steps 816 and 814 of FIG. 8. Returning to FIG. 9, if the length should be decreased, the routine proceeds to step 920 where the new lengths for filters AFIR1 and AFIR2, with the length of filter AFIR1 (AFIR1len) decreasing by the same X taps that the length of filter AFIR2 (AFIR2len) increases. The routine then progresses to step 924, the end of the routine. Alternatively, if the length of filter AFIR1 is not to be altered at step 918, the program proceeds to step 924, the end of the routine. 
     If, at step 906, filter AFIR2 is chosen, the program proceeds in analogous fashion calculating the energies for AFIR2 at step 910, determining if the length of AFIR2 should be shortened at step 916, and determining whether the length of AFIR2 should be increased at step 922. 
     Although FIG. 9 illustrates a routine for dependently adjusting the lengths of filters AFIR1 and AFIR2, each of the filters could also be adapted independently using the process illustrated by the flowchart of FIG. 8 and changing the filter lengths by independent amounts. Complementary length adjustment uses less code but the independent adaptation approach may produce higher quality output signals. The filter memory allocation may be prioritized before filter length adaptation so that, if both filters contend for limited memory, one filter will be allocated memory space in spite of the other&#39;s request. The prioritization may be made on a variety of criteria and it may be changed according to changing filter demands. 
     An ALAFIR-based echo-canceler may be implemented, for example, using a digital signal processing integrated circuit such as the DSP2105 manufactured and distributed by Analog Devices Corporation, Norwood, Mass. to effect the signal processing functions. This signal processing may be implemented according to the flow charts and figures set forth in this disclosure and might include filter-length adaptation in addition to basic AFIR implementation and operation. Illustratively, an ITT ASC02300 dual channel codec may be used to convert the analog signals used on the telephone line, the input microphone, and the output amplifier to and from 16-bit digital data samples used in the ALAFIR circuit. 
     Thus, it will be seen that we have provided a description of an invention which adapts the length of AFIR filters to enhance the performance of such filters. Furthermore, the terms and expressions which have been employed are used as terms of description and not of limitation, and there is no intention, in the use of such terms and expressions, of excluding any equivalents of the features shown and described or portions thereof, but it is recognized that various modifications are possible within the scope of the invention claimed.