Abstract:
A digital signal processing algorithm to cancel howling in a telephone circuit, the telephone circuit being characterized by a receive path and a transmit path in an effective closed loop configuration. The algorithm monitors input samples taken from the receive path and, if a howling signal is detected, controlled amounts of attenuation are introduced to the loop until howling is cancelled. In a preferred embodiment a prediction logic is included in the algorithm to verify the howling signal.

Description:
FIELD OF THE INVENTION 
     This invention relates to telephone networks including four-wire circuits forming closed loops which are prone to howling and more particularly to a howling controller, implementing a DSP algorithm, for detecting the presence of howling and canceling the same by introducing an appropriate attenuation to the closed loop. 
     BACKGROUND OF THE INVENTION 
     A positive feedback exists in a closed loop (see FIG. 1) when the following relation (Barkhausen) sets up: 
     
       
         β* G =1,  1) 
       
     
     where β=transfer function on the feedback path, in open loop; and 
     G=transfer function on the direct path, in open loop. 
     This relation is equivalent to the following simultaneous conditions: 
     
       
         |β|*| G |=1  (2) 
       
     
     
       
         arg(β)+arg( G )=2*π, in radians  (3) 
       
     
     Such positive feedback usually appears when the closed loop gain is higher than a certain value. The effects of the positive feedback in the baseband (i.e., 300 Hz-3400 Hz) of the telephone circuits are the well-known phenomena of “singing” and “howling”. Both of these drastically impair the useful signals, and should, therefore, be under strict control. 
     A possible definition of howling is the result of a positive feedback developed on telephone network four-wire circuits as a consequence of an imperfect echo cancellation. Analyzing the above noted relation in (1) or the relations in (2) and (3), two possibilities to cancel the positive feedback can be derived: 
     a) by introduction of an attenuation on the feedback path; or 
     b) by changing the phase characteristic of the feedback path. 
     PRIOR ART 
     Based on the two above mentioned approaches, the following main methods were used previously: 
     Phase methods: i) All pass filter with variable group delay characteristics; 
     ii) Random phase shifting; 
     iii) Constant frequency shifting with signal re-sampling; and 
     iv). Two, directional microphones method. 
     Attenuation methods: i) Variable loss circuit. 
     A howling signal spectrum changes dynamically, having one or several dominant and non-constant frequencies that can exist practically anywhere in the bandwidth of the useful signal. 
     The above noted phase methods are based on a characteristic of the human ear of not being sensitive to phase distortions of the audio signal. In the phase methods, the phase of the incoming signal is permanently changed so as the relation in (3) become false. 
     Method i), as illustrated in the U.S. Pat. No. 5,307,417, dated Apr. 26, 1994, and granted to Takamura et al., is extremely complex and, consequently, makes use of a large number of instructions per second and needs a large amount of memory. Method ii), as illustrated in U.S. Pat. No. 4,449,237, dated May 15, 1984, granted to Stepp et al., and method iii) change the phase characteristic of the feedback path either randomly or deterministically, in an attempt to algebraically compensate the unwanted components of the howling spectrum. The stability margin of the closed loop is slowly increased thus the howling possibility is not completely eliminated. In addition, methods ii) and iii) introduce signal distortion. At least one drawback of method iv), see U.S. Pat. No. 5,323,458, dated Jun. 21, 1994 and granted to Park et al., is that this method assumes a spatial and electrical symmetry, which is not always true; also, the portability of this solution is restricted to only special telephone sets. A general drawback of methods i), ii), iii), and iv) is that all can handle only a limited amount of the original loop gain. 
     In the attenuation methods, the incoming signal is attenuated so that the relation in (2) become false. 
     The previous attenuation methods, as illustrated in U.S. Pat. No. 5,379,450, dated Jan. 3, 1995, granted to Hirasawa et al., depend on the signal level, and on the specific mechanical and electrical characteristics of the telephone sets as well. Also, these methods make use of absolute reference levels other than 0 volts, and are characterized by increased complexity and high computational effort. Regarding the actual full-duplex voice switches, as illustrated in the U.S. Pat. No. 5,099,472, dated Mar. 24, 1992, granted to Townsend et al., the attenuation is introduced on the two speech paths permanently, disregarding the presence or absence of howling. 
     The solution proposed in this patent application involves the introduction of attenuation only when howling is recognized from other signals existing on telephone networks. 
     SUMMARY OF THE INVENTION 
     Therefore, in accordance with a first aspect of the present invention there is provided a controller for use in a telephone circuit to control howling signals created by positive feedback between receive and transmit paths in the circuit. The controller comprises: detection means to detect an initiation of a howling signal in the circuit; attenuation means to introduce attenuation into one of the receive and transmit paths; and processing means to control the attenuation level as a function of the howling signal. 
     In accordance with a second aspect of the present invention there is provided a method of controlling a howling signal in a telephone circuit having a receive path and a transmit path, the howling signal being generating by a positive feedback between the paths. The method comprises detecting the onset of a howling signal and introducing attenuation to at least one of the paths to cancel the howling signal. 
     In accordance with a third aspect of the present invention there is provided an algorithm for controlling a digital signal processor (DSP) howling controller to cancel howling in a telephone circuit having a receive path and a transmit path, the algorithm comprising: detecting the onset of howling by monitoring input samples from the receive path; controllably introducing attenuation to at least one of the receive or transmit paths to thereby reduce the howling signal; and stopping the introduction of attenuation when the howling signal reaches zero. 
     In a preferred embodiment there is a maximum level of attenuation that can be introduced. 
     In a further preferred embodiment the algorithm includes prediction logic to verify that the detected signal is in fact a howling signal. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     The invention will now be described in greater detail with reference to the attached drawings wherein: 
     FIG. 1 shows the basic positive feedback mechanisms; 
     FIG. 2 illustrates the howling controller principle; 
     FIG. 3 shows a typical loop configuration with howling controller; 
     FIG. 4 illustrates a typical loop configuration with howling controller for full duplex voice switch configuration; 
     FIG. 5 is an equivalent hardware schematic of the basic howling detection algorithm; 
     FIG. 6 is a flow chart of the prediction logic algorithm; and 
     FIGS. 7A,  7 B and  7 C illustrate the complete algorithm flow chart of the howling controller. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     The howling controller principle is shown in block  20  of FIG. 2, in which its two main functions are represented: the howling detection function  22  and the attenuation a function  24 . The first one has.the ability to distinguish a howling signal from other input signals, including speech, music, and DTMF (dual-tone multi-frequency). Based on this, the attenuation function lowers the initial loop gain  26  up to that particular level where howling disappears. 
     FIG. 3 shows a typical loop configuration in which are represented, for clarity, the howling controller elements. These include initial loop gain  26 ; PCM codes  30 ; linear/μ/A law  32 ; μ/A law/linear conversion blocks  34 ; howling detector  36 ; attenuation α 1   38  and attenuation α 2   40 . In FIG. 3 PCM codes  30  are pulse code modulation codes, in conformity with the G.711 CCITT recommendation; μ/A law/linear blocks  34  are voltage level expanding blocks, in conformance with the G.711 CCITT recommendation; and Linear/μ/A law  32  are voltage level compression blocks, in conformance with the G.711 CCITT recommendation. Also in FIG. 3 input 1  samples are taken at point  42 ; input 2  samples are taken at point  44 ; output 1  samples are taken at  46  and output 2  samples at  48 . 
     Although the howling detection is conceived as a DSP software algorithm, in order to ease its understanding, the explanation thereof will be done in this paragraph with reference to the hardware schematic shown in FIG.  5 . The sampling frequency is assumed to be 8 kHz. 
     The incoming signal (INPUT SAMPLE) is analyzed continuously, sample by sample. One counter  50 , (COUNTER_P), starts its operation at the first incoming positive sample furnished by the comparator  52  (COMP_P), and stops at the last contiguous positive sample. A second counter  54 , (COUNTER_N), is then activated by the comparator  56  (COMP_N), to count all the incoming, contiguous negative samples. FIG. 5 does not show the equivalent hardware circuit, that finds in the incoming signal, the first found positive sample to be offered to COUNTER_P  50 ; in the original software, this is done by a loop that waits for negative samples. The exit from the loop is permitted at the first positive sample only. A difference between the contents of the two counters is then performed by an absolute value differentiator Δ 58 , followed by the counters setting to zero (RESET  60 ). These steps just described (i.e., counting the positive samples, counting the negative samples, performing the absolute difference, resetting to zero the two counters) are permanently repeated, forming iterations. Before the counters&#39; setting to zero, the sum of their contents at a first adder  62  (ADDER_ 1 ) is added to a second adder  64  (ADDER_ 2 ), if the absolute values of the above-mentioned differences are contiguous by being smaller or equal than a specific threshold  66  (THRESHOLD_ 1 ). This last condition is checked through comparison comparator  68  (COMP_ 1 ), and its result drives the Enabling input  70  (EN) of ADDER_ 2  ( 64 ). If there is at least one difference that does not respect this condition, ADDER_ 2  is reset to zero. When the content of ADDER_ 2  is bigger than a second threshold  72  (THRESHOLD_ 2 ), the output HOWLING  74  of the comparator  76  COMP_ 2  signalizes the presence of howling, and ADDER_ 2  ( 64 ) is reset to zero. Also, if there is at least one difference that is bigger than the-first threshold, the second adder is reset to zero. THRESHOLD_ 1  is set to 1, and THRESHOLD_ 2  is set preferably to 256, corresponding to a time interval of 32 msec (the sampling frequency is 8 kHz, thus 256 samples*1/8 kHz per sample=32 msec). The correspondence between the equivalent digital circuit and the actual variables used in the flowchart of FIGS. 7A to  7 C are as follows: 
     INPUT SAMPLE - - - input 2  sample 
     START - - - start 
     COUNTER_P - - - p 
     COUNTER_N - - - n 
     ADDER_ 2  - - - sum 
     THRESHOLD_ 1  - - - 1 
     THRESHOLD_ 2  - - - 256 
     Every time the attenuation block receives a howling indication, the loop gain is lowered by a constant amount of decibels such that the attenuation is introduced in equal steps, preferably of about 6 dB. Consequently, the stability margin has a maximum of 6 dB. The whole amount of attenuation can be equally or unequally distributed on the two speech circuit paths (see FIG.  3 ); using a full-duplex attenuation switch (the switch is also known as a voice switch) could be a good approach (see FIG.  4 ). If the total attenuation to be introduced is equally distributed on the two speech circuit paths, then the path attenuation steps will be of 6 dB/2=3 dB. If the total attenuation has to be introduced unequally, then the path attenuation steps will be of q dB, and respectively, of (6−q)dB. The case shown in FIG. 4, in which the total attenuation is introduced using a full-duplex voice switch  80  controlled by the samples&#39; energies S 1  and S 2  ( 82  and  84 ), is not covered in detail herein. The total amount of attenuation introduced by the howling controller may be limited to a maximum permissible attenuation value. In this case, every time a new attenuation is introduced, the total amount of attenuation introduced is compared to that maximal value. A new attenuation step is allowed only if the maximum permissible value is higher than the current total attenuation introduced by the howling controller. 
     This is the basic algorithm of the howling controller. 
     To increase the resistance of the basic algorithm to the practically very.rare situations, in which signals resembling howling could be misinterpreted as howling, prediction logic is added to the basic algorithm; the basic algorithm and the prediction logic work in parallel. 
     Because howling carries no information, the probability of accurately predicting the next value of a howling signal sigma 0  (see below) is higher than that of accurately predicting a sigma 0  that characterizes an information signal. This is the principle which relies upon the above-mentioned prediction logic. 
     The flowchart of this logic is shown in FIG. 6, and is explained separately in this paragraph. The sampling frequency is assumed to be 8 kHz. After the initialization of the variables: flag, counter, sigma 0 , sigma 1 , sigma 2 , sigma 3  and sigma  4 , one sample is taken of each of the two speech circuit paths: input 1  sample and input 2  sample. The absolute values of the input samples are added continuously to sigma 0 , until the counter reaches a certain value, preferably set to 256 (equivalent to 32 msec elapsed time interval). Then the content of sigma 0  is memorized in sigma 1 , the counter is reset to zero, and the process continues for another 32 msec. After that the contents of sigma 1  is memorized in sigma 2 , and the new value of sigma 0  is loaded into sigma 1 . Again the counter is reset to zero and the same routine is performed two more times. From now on, the process will make use of four memorized values of sigma 4 , sigma 3 , sigma 2  and sigma 1 , and the current value of sigma 0 , to predict the next value of sigma 0 . Its predicted value is obtained by imposing preferably a constant third order differential over the 32 msec time interval; the mentioned preference refers to the order of the differential. The predicted value of sigma 0  is given by the following formula: 
     
       
         predictsigma=4*sigma 1 −6*sigma 2 +4*sigma 3 −sigma 4   (4) 
       
     
     Then the absolute value of the difference between sigma 0  and predictsigma is compared to a small fraction K of sigma 0 ; the preferred value of K is 0.01. Depending on the result of the comparison, a flag is or is not raised to a logic “high”. The value of this flag will logically “and” condition the signal. HOWLING from the basic algorithm (see FIG.  5 ). Finally, the counter is reset to zero, and the memories of sigma 4 , sigma 3 , sigma 2 , and sigma 1  are updated by the rule: 
     
       
         sigmaX=sigmaY, where  X=Y +1, and  X =0,1,2 and 3.  (5) 
       
     
     However, the final form of the prediction logic also offers information used to distinguish pure sinusoidal tones from other signals present on telephone circuits. Compared to howling, sinusoidal waves are more predictable. Hence, a sinusoidal signal should check the following inequality with a high accuracy: 
      |sigma 0 −sigma 1 |&lt; K *sigma 0 ,  (6) 
     where K has, preferably, the same value of 0.01. Accordingly, the former comparison in which predictsigma was involved becomes a double-condition comparison; these two conditions are logically “or” tied: 
     
       
         |sigma 0 −predictsigma|&gt; K *sigma 0  or |sigma 0 −sigma 1 |&lt;K*sigma 0 .  (7) 
       
     
     So, if at least one of these conditions is fulfilled, the flag is raised to a logical “high”; otherwise it remains logically “low”. 
     The following lines describe the complete howling controller algorithm; its flowchart is shown in FIGS. 7A to  7 C. Not discussed here is the variant that makes use of a full-duplex attenuation switch. The sampling frequency is assumed to be 8 kHz. 
     The first step is the initialization of the following variables: flag, counter, sigma 0 , sigma 1 , sigma 2 , sigma 3 , and sigma 4 , for the prediction logic; sum, start, neg, begin, db 1 , and db 2 , for the basic algorithm. The next step is represented by the prediction logic, explained previously. Point B is the beginning of the basic algorithm. All analysis is based on samples taken from only one speech circuit path. These are the input 2  samples in FIG.  3 . start is a variable that records if the algorithm entered or not the iterative state. As long as the algorithm does not enter the iterative state, the input samples will not be affected, i.e. the output 1  and output 2  samples (see FIG. 3) will be replicas of the input samples. The iterative state begins as soon as the first positive sample of input 2  is detected. A logical loop finds this first positive sample by looking for negative samples. Let us suppose that the input 2  sample is positive. Because this is not a negative sample, the logical loop mentioned above will not permit the algorithm to enter the iterative state. In this case the value of the variable neg is checked. Here, the variable neg has the role of recording if at least one negative input sample was detected. Hence, because no negative sample was yet found, neg remains 0. Now, let us suppose that after several positive input samples, a negative input sample has arrived. In this case, the variable neg changes its status to 1. The next negative input samples will be followed by a positive sample of a new series of positive input samples. This time, because neg is 1, new actions are taken: start changes to 1 and neg to 0. So, neg will be reused further with a similar purpose, and the new value of start will place the algorithm in the iterative state. A similar explanation addresses the case in which the first input sample that starts the operation of the logical loop is negative. In the iterative state of the algorithm, the following steps are performed. When a second positive input sample arrives, and because the variable begin is 0, the variable p that counts the positive samples becomes 1. This 1 represents the previous positive sample that placed the algorithm in the iterative state; the actual positive sample will be taken.into consideration further. At this stage (point D on the flowchart,) the variable n, that counts the negative input samples, is still 0, and the variable begin changes its status to 0. Because the last input sample is positive, p is incremented. The variable n records if at least one negative input sample was detected during an iteration (for the meaning of iteration, see the paragraph referring to the equivalent hardware schematic, or below). Hence, because no negative sample was found yet, neg remains 0. The number of the positive input samples will be counted by the variable p. Now, let us suppose that a negative input sample arrives. Because begin was previously set to 0, there is a jump to point D in the flowchart of FIG.  7 C. Then the variable n that counts the negative samples is incremented, and variable neg is assigned to 1. Up to this moment, the output 1  and output 2  samples are only replicas of the input 1  and input 2  samples. The next negative input samples will be followed by a positive sample of a new series of positive input samples. This time, because neg is 1, new actions are taken: neg becomes 0 again and begin is set to 1, to prepare for a new iteration, and the counter p is decremented, because this new positive sample belongs to a new iteration. The next step is checking the absolute value of the difference between p and n. If this absolute value is smaller than 1, then the variable sum, which is an adder, is increased with the result of the addition between p and n. Then, sum is compared to a certain threshold, preferably set to 256. If sum is not bigger than 256, then a new iteration will be processed and the output samples will not be affected. If sum is bigger than 256 sum shall be reset to zero. Then, the value of flag is checked. If flag is not equal to zero, then a new iteration will be processed and the output samples will not be affected. If flag is equal to zero, then the algorithm considers the input as howling, and, for the first time, the output samples will no longer be replicas of input samples. The variable db 2 , that corresponds to the level of attenuation introduced on the speech circuit path where the input 2  samples appear, is compared to a third threshold, called M; this M is the maximum permissible attenuation on that particular path, and is expressed as the decimal number corresponding to a certain amount of decibels (dB). For example, if the maximum attenuation allowed on that speech circuit path is set to −12 dB, then M is 10{circumflex over ( )}(−12/20)=0.25. If db 2  is bigger than M, then the value of db 2  is changed to db 2 *q 2 ; similarly, the value of db 1 , that corresponds to the level of attenuation introduced on the speech circuit path where the input 1  samples appear is changed to db 1 *q 1 . The sum q 1 +q 2  corresponds to an attenuation step preferably set to 6 dB. q 1  and q 2  are decimal numbers corresponding to certain amounts of decibels (dB). For example, if the amount of attenuation, set up for the speech circuit path where the input 2  samples appear, is −4 dB per attenuation step, then q 2  is 10{circumflex over ( )}(−4/20)=0.63. q 1  can be calculated in the same way, considering for this example an attenuation of 6 dB−4 dB=2 dB per attenuation step. Then output 1  and output 2  samples are calculated. Their values are obtained by multiplying the original input 1  and input 2  samples with the attenuation factors db 1  and db 2 . If db 2  is smaller than M, then no additional attenuation will be introduced. In this case, the attenuation factors db 1  and db 2  will remain permanently constant. 
     In summary, a new approach to howling prevention has been developed. Its corresponding DSP howling prevention algorithm has the ability to recognize howling from other signals that travel on the telephone network subscriber loops including speech, music and DTMF signals. After detecting the howling signal, the algorithm cancels it by attenuating the original loop gain with a similar amount of decibels that, if added to a stable loop that was placed in its stability margin, would cause the loop to become unstable. In other words, the value of this attenuation depends on the gain loop only, and is minimal in the sense that the loop becomes stable in a controlled stability range. The algorithm starts attenuating when howling condition exists and ceases to attenuate when howling conditions no longer exist. The algorithm does not depend on the signals amplitudes, phases, shapes, spectra, etc. Additionally, the algorithm does not depend on the telephone set or speaker-phone mechanical and electrical characteristics. The algorithm introduces neither non-linear amplitude distortion nor phase distortions. Due to its simplicity this DSP algorithm can be implemented more easily than previous algorithms. The requirements are low, in terms of computational effort, speed and memory; few dozens of lines of high level code are sufficient to implement the algorithm. 
     While preferred embodiments of the invention have been described and illustrated it will be apparent to one skilled in the art that numerous alterations and variations can be made to the basic concept. It is to be understood that such alterations and variations will fall within the intended scope of the invention as defined by the appended claims.