Method and system for automatic gain control of a speech signal

A method and system for automatic gain control of a speech signal in a communication system are disclosed. The gain of the speech signal can be controlled, based on a calculated gain value. This gain value is calculated on the basis of energy calculation and speech activity identification in the speech signal which is done by means of the encoder. Encoding the gain controlled speech signal for transmission follows the step of gain control.

CLAIM OF PRIORITY

This Application Claims Priority of Indian Patent Application No. 468/CHE/2006 Filed Mar. 15, 2006

BACKGROUND

The present invention relates generally to processing speech signals in a communication system. More specifically, the present invention relates to automatic gain control (AGC) of speech signals in the communication system.

In communication systems, a speech signal from a transmitting microphone is highly sensitive to the relative position of a user with respect to the microphone. The AGC circuit maintains the speech signal at a desired audible level by correcting the gain of the speech signal. The gain corrected speech signal is then converted into the digital format by an Analog-to-Digital converter. This digital speech signal is then encoded based on the bandwidth allocation of the transmission medium. The Analog-to-Digital converter can be either an integrated part of the encoder or a separate unit before the encoder.

A conventional method is disclosed in the U.S. Pat. No. 6,604,071 titled ‘Speech Enhancement With Gain Limitations Based On Speech Activity’. According to the method, a speech signal is divided into data frames that represent background noise as well as articulated speech activity. Gain for data frames is determined individually, both in case of background noise as well as speech activity. A limitation is applied to the determined gain of the data frames by making the gain equal to the Signal-to-Noise Ratio (SNR) and the data frames are integrated back to obtain a gain controlled speech signal. The AGC circuit uses a first order recursive filter to determine the SNR. The gain controlled speech signal is then provided at the encoder's input stage.

Another conventional method is disclosed in the U.S. Pat. No. 6,314,396 titled ‘Automatic Gain Control In A Speech Recognition System’. The method aims at differentiating a speech activity with static noise present in a speech signal. According to the method, the speech signal is divided into data frames with each data frame of a fixed time interval. An energy tracker calculates the levels of energy as high energy, low energy, and the mid energy track of the speech signal, based on high-biased running mean, low-biased running mean, and a nominally-unbiased running mean. The value of normalized energy is calculated from the high energy tracks and provided to a speech recognition system. The output of the speech recognition system is fed back to achieve optimum speech recognition.

Yet another conventional method is disclosed in the U.S. Pat. No. 5,146,504 titled ‘Speech Selective Automatic Gain Control’. This method aims to achieve AGC by converting an analog speech signal to a digital speech signal. The digital speech signal is further converted from a linear form to a logarithmic form and peak energy of the logarithmic digital speech signal is detected. The invention implements a speech recognizer to detect the speech signal. Variations in the peak energy of the speech signal are removed by a smoothing circuit. The smooth speech signal is subtracted from a reference signal and an error signal is obtained in the form of a logarithmic gain signal. The logarithmic gain signal is converted back into a linear gain signal and the linear gain signal is multiplied to the speech signal. As a consequence, AGC is used only in those cases where a speech activity is present in the speech signal. The method aims at controlling the gain of the speech signal prior to encoding.

In view of the above discussion, these conventional methods provide AGC by identifying speech activities in a speech signal and computing the energy of the speech signal. Further, the peak energy in the speech signal is detected. The detected peak energy is incremented or decremented depending on the desired audible output of speech signal.

The AGC methods discussed above use the AGC circuit as an independent module for gain correction. The gain corrected speech signal is then fed to an encoder circuit for encoding. The encoder circuit detects the energy and the speech activity in the gain corrected speech signal and thereafter converts the gain corrected speech signal from analog to digital format before encoding. This increases the time and the required rate of average Million Instructions Per Second (MIPS) for controlling the gain and encoding the gain corrected speech signal.

Therefore, there exists a need for an AGC system that aims at reducing the time, and consequently the MIPS rate, required for controlling the gain of the speech signal and encoding the gain corrected speech signal.

SUMMARY

An object of the invention is to provide an AGC system for processing speech signals in a communication system.

Another object of the invention is controlling the gain of speech signals in the communication system.

Yet another object of the invention is to provide an AGC system that reduces the time required for an independent calculation of energy of speech signals and detection of speech activity in the speech signals.

Still another object of the invention is to provide an AGC system that reduces the Million instructions Per Second (MIPS) rate while correcting the gain of the speech signal and encoding the gain corrected speech signal.

The invention comprises a system and a method for achieving the above mentioned objectives. The system comprises a gain block, a feedback gain block, and an encoder. The method comprises the steps of receiving a speech signal at the gain block and applying gain correction on the received speech signal by the gain block. The gain correction is applied on the basis of a correction value that is received as a feedback from the feedback gain block. The feedback gain block, in turn, receives energy values of speech signal from the encoder that performs energy computations and speech activity estimation of the speech signal. The encoder also encodes the gain corrected speech signal for transmission. As the functions of energy calculation and speech activity estimation are performed by the encoder in the present invention as compared to a separate unit as shown in the prior art, the consumed time and the MIPS rate can be reduced substantially.

DESCRIPTION OF PREFERRED EMBODIMENTS

Embodiments of the present invention relate generally to speech signals in a communication system. More specifically, embodiments of the present invention relate to gain correction of a speech signal that serves as the input to the communication system. The speech signal may be divided into one or more speech segments. The gain correction may be performed on the one or more speech segments. The communication system can either be a hands-free communication system or a handheld communication system. A typical communication system comprises an encoder, a transmitter, a channel, a receiver, and a decoder. The gain correction of speech segments can be applied before the speech segments are being encoded for transmission.

FIG. 1is a block diagram of communication system100including one or more communication devices102, in accordance with the exemplary embodiment of the present invention. Communication devices102can be connected to each other through communication channels104over a network106. Communication devices102can be selected from a group of wired or wireless telephone devices, which can, for example, operate on 2G, 2.5G, 3G, TDMA, CDMA, GSM and any other suitable technologies. Communication channel104can be a wireless channel, a wired channel or a combination thereof.

FIG. 2is a block diagram of a prior art for AGC system200in communication device102. AGC system200includes a high pass filter202, a gain block204, an energy computation and silence estimation block206, a feedback gain block208, and an encoder210. High pass filter202, gain block204, energy computation and silence estimation block206, and feedback gain block208together form a gain correction block. An incoming speech segment is provided to high pass filter202. High pass filter202filters out low frequency components and the direct current offset from the incoming speech segment. Gain block204applies a gain correction to the filtered speech segment. The gain corrected speech segment from gain block204can be expressed by the following formula:
Sg=gain*Sftr(1)
where:

‘Sftr’ is the filtered speech segment, and

‘Sg’ is the gain corrected speech segment.

Energy computation and silence estimation block206computes the energy of the gain corrected speech segment and indicates the speech activity in the gain corrected speech segment. The energy of the gain corrected speech segment can be expressed by the following formula:

‘E’ is the energy of the gain corrected speech segment, and

‘n’ is the number of speech samples into which each gain corrected speech segment is divided.

The speech activity is indicated by a silence indication (SID) value. The SID value can be 0 if speech activity is indicated in the gain corrected speech segment, whereas the SID value can be 1 if speech inactivity (silence) is indicated in the gain corrected speech segment.

The energy, E, and the silence indication value, SID, are provided to feedback gain block208for computing the gain value. Feedback gain block208detects the peak active energy of the gain corrected speech segment and computes the gain value for correction. Feedback gain block208provides the gain value to gain block204as a feedback.

Encoder210encodes the gain corrected speech segment for transmission. The gain corrected speech signal is converted into the digital format in an Analog-to-Digital converter before it is encoded by encoder210. Encoder210encodes the digital speech signal based on the bandwidth allocation of the transmission medium. Encoder210again computes the energy, E, and the silence indication value, SID, for encoding the gain corrected speech segment. Thus, according to the prior art, the instructions required for energy computation and speech activity detection are repeated as encoder210again performs the same computations. Therefore, the MIPS for gain correction is substantially higher in the prior art.

FIG. 3is a block diagram of AGC system300in communication device102, in accordance with an exemplary embodiment of the present invention. AGC system300includes a gain block304, a feedback gain block308, and an encoder310. Gain block304receives an incoming speech segment and applies gain correction on the incoming speech segment. Feedback gain block308detects the peak active energy of the gain corrected speech segment and calculates a gain value. The calculated gain value is provided to gain block304as a feedback. Encoder310encodes the gain corrected speech segment for transmission. Encoder310also computes the energy (E) and the SID value of the gain corrected speech segment. Encoder310may be any suitable codec block such as a Code Excited Linear Prediction (CELP) coder. The CLEP coder may be an adaptive multi rate speech (AMR) coder. The energy, E, and the SID value of the gain corrected speech segment may be computed using the auto-correlation prediction approach. The value of E and SID computed by encoder310are provided to feedback gain block308for peak active energy detection and gain value calculation.

FIG. 4is a block diagram of encoder310, in accordance with an exemplary embodiment of the present invention. Encoder310includes a high pass filter402, an energy calculator404and a silence indication estimator406. High pass filter402removes the unwanted low frequency components and the direct current offset from the gain corrected speech segment. Energy calculator404computes the energy of the gain corrected speech segment. Silence indication estimator406determines speech activity or inactivity in the gain corrected speech segment. The output of silence indication estimator406is a SID value.

FIG. 5is a block diagram of feedback gain block308, in accordance with an exemplary embodiment of the present invention. Feedback gain block308includes a peak detector502and a gain value calculator504. Peak detector502detects the peak active energy of the gain corrected speech segment. The peak active energy is detected on comparing the gain corrected speech segment energy with a pre-defined energy value. Gain value calculator504calculates the gain value depending on the detected peak active energy. The calculated gain value is provided to gain block304as a feedback.

FIG. 6is a flowchart, illustrating a method for gain control of a speech segment in AGC system300, in accordance with an embodiment of the present invention. At step602, a current incoming speech segment is received by gain block304. At step604, the gain of the current incoming speech segment is corrected by a gain value. The gain value is based on the computed energy and SID values of the previous speech segment. The energy and the SID values are computed by encoder310and are provided to feedback gain block308. Then, at step606, encoder310encodes the gain corrected speech segment for transmission.

FIG. 7is a flowchart, illustrating a detailed method for gain control of a speech segment in AGC system300, in accordance with an embodiment of the present invention. At step702, a current incoming speech segment is received by gain block304. At step704, energy calculator404calculates the energy of the previous speech segment. Energy calculator404may divide the previous speech segment into samples of fixed intervals for calculating the energy of the previous speech segment. Next, at step706, silence indication estimator406computes a SID value for the previous speech segment. Silence indication estimator406can classify the previous speech segment as a segment that has speech activity or speech inactivity (silence) depending on the energy of the previous speech segment. SID value from silence indication estimator406can be a binary value. The binary SID value can be 0 if silence indication estimator406classifies speech activity in the previous speech segment whereas the binary SID value can be 1 if silence indication estimator406classifies speech inactivity in the previous speech segment. The binary SID value of the previous speech segment is forwarded to feedback gain block308.

At step708, the peak active energy of the previous speech segment is detected by peak detector502in feedback gain block308. The peak active energy is detected on the basis of comparison of actual peak energy of the previous speech segment with an average level of energy at which communication system100should be operated. An algorithm for the peak active energy detection is explained in detail in conjunction withFIG. 8. At step710, the detected peak active energy is then used by gain value calculator504to calculate the gain value with which a correction is applied to the current incoming speech segment. Gain value calculator504attempts to keep the sum of detected peak active energy of the previous speech segment and the gain value within a pre-defined minimum energy level and a pre-defined maximum energy level. A correction to the gain value is applied to bring the detected peak active energy between the pre-defined minimum energy level and the pre-defined maximum energy level. The gain value obtained during this process is the calculated gain value. An algorithm for gain value calculation is explained in detail in conjunction withFIG. 9. The calculated gain value is provided to gain block304as a feedback.

At step712, it is checked whether the SID value of the current incoming speech segment is equal to 1. If the SID value of the speech segment is not equal to 1, step714is performed. At step714, a correction of the gain value is applied to the current incoming speech segment by gain block304. At step712, if the SID value of speech segment is equal to 1, step716is performed. At step716, a correction of the gain value is not applied to the current incoming speech segment.

Then, at step718, the gain corrected speech segment is filtered to remove low frequency components and the direct current offset components present in it. The gain corrected speech segment is filtered by encoder310. At step720, the filtered speech segment is encoded by encoder310for transmission.

FIG. 8is a flowchart illustrating an algorithm for peak active energy detection of a previous speech segment in AGC system300, in accordance with an exemplary embodiment of the present invention. At step802, the values of an observation counter (Obs) and an idle-time counter (Idl) are made zero. The observation counter can be used for tracking speech activities in the previous speech segment and the idle-time counter can be used for tracking speech inactivity in the previous speech segment. At step804, it is determined whether the peak active energy, P, of the previous speech segment is greater than the average level of energy, E, at which communication system100should be operated. The peak active energy of the previous speech segment can be determined by one of the following methods:a) By taking the average energy of the previous speech segment; orb) By calculating the active peak energy of each sample within the previous speech segment and computing the background noise floor of each sample.

If the peak active energy of the previous speech segment is less than the average level of energy, step806is performed. At step806, the peak active energy is changed in accordance with the following formula:
P=P+Attack constant*(E−P)  (3)
where:

‘P’ is peak active energy of the previous speech segment,

‘E’ is average energy level at which communication system100should be operated, and

‘Attack constant’ is a first constant in the peak active energy detection system and is defined as the rate at which the peak active energy should be increased. The value of attack constant is defined on the basis of the requirements of communication system100. For experimental purposes, the value of attack constant is taken as 0.27. The formula mentioned above can be interpreted as the peak active energy that is updated up to 27 percent of the difference of the average energy and peak active energy of the previous speech segment.

If the peak active energy of the previous speech segment is greater than or equal to the average energy level, step808is performed. At step808, it is determined whether the SID value of the previous speech segment is equal to 1. If the SID value of the previous speech segment is 1, step810is performed. At step810, the idle-time counter is incremented by 1.

Whereas, at step808, if the SID value of the previous speech segment is not equal to 1, step812is performed. At step812, the observation counter is incremented by 1 and the idle-time counter is reset. Here, the peak active energy of the speech segment can be computed, using the following formula:
P=P−Fading Slope  (4)
where:

‘fading slope’ is a second constant in the peak active energy detection system and is defined as the value at which the peak active energy can be decreased. The typical value of the fading slope for experimental purposes can be taken as: 0.032 decibels (dB) per speech segment.

At step814, it is determined whether the value of idle-time counter is greater than the value of speech inactivity threshold. The speech inactivity threshold can include nonactive previous speech segments, with each speech segment carrying 70 samples. If idle-time counter is greater than speech inactivity threshold, step818is performed. At step818, observation counter is reset and peak active energy remains unchanged.

At step814, if the idle counter is less than or equal to speech inactivity threshold, step816is performed. At step816, it is determined whether the observation counter is greater than or less than speech activity threshold. If observation counter is greater than the speech activity threshold, as shown in step820, peak active energy can be computed using the following formula:
P=Maximum energy (past ‘PK’ window length)  (5)
where:

‘PK’ window length can be, by way of example only a window length of 25 samples. Further, at step822, the observation counter and the idle-time counter are both reset. At step816, if the observation counter value is less than or equal to speech activity threshold, step824is performed. At step824, the peak active energy remains unchanged. The value of peak active energy at this stage becomes the detected peak active energy for the previous speech segment.

FIG. 9is a flowchart illustrating an algorithm for gain value calculation in AGC system300, in accordance with an exemplary embodiment of the present invention. Gain value calculator504calculates the gain value. Gain value calculator504attempts to keep the sum of detected peak active energy of the previous speech segment and a gain value within pre-defined minimum and maximum energy levels. At step902, gain value calculator504checks whether the sum of peak active energy and the gain value (in dB) is less than the pre-defined minimum energy level. If the sum of peak active energy and the gain value is less than the pre-defined minimum energy level, step904is performed. At step904, the gain value is incremented by 1 dB or any other suitable incremental amount.

At step902, if the sum of peak active energy and the gain value is greater than or equal to the pre-defined minimum energy level, step906is performed. Further, at step906, gain value calculator504checks whether the sum of peak active energy and the gain value is greater than the pre-defined maximum energy level. At step906, if it is determined that the sum of peak active energy and the gain value is greater than the pre-defined maximum energy level, step908is performed. At step908, the gain value is decremented by 1 dB or any other suitable incremental amount. At step906, if it is determined that the sum of peak active energy and the gain value is less than or equal to the pre-defined maximum energy level, the gain value remains unchanged.

At step910, the final gain value becomes the gain correction value that is to be applied to the speech segment. Gain value calculator504forwards the gain value to gain block304.

The method for gain correction can be applied to communication system100in one or more situations involving speech.FIG. 10ais a waveform of speech samples before gain correction is initiated when a speaker speaks with speech signals of varying speech levels, in accordance with an exemplary embodiment of the present invention. The soft speech levels may arise due to some distance between the position of the microphone and the speaker. It is expected that the gain controlled and encoded speech samples should be obtained as sustained speech samples at the decoder output. Points1002and1004in the waveform denote the soft speech samples of the speaker.

When the AGC is applied and the speech samples are encoded, the speech samples obtained at the decoder output are shown by the waveform inFIG. 10b. Points1006and1008inFIG. 10bare the gain corrected soft speech samples. AGC System300in the present embodiment works in two phases, namely an observation phase and a correction phase. In the observation phase, AGC system300observes the energy of the speech samples and calculates the gain value. As shown inFIG. 10a, point1004occurs immediately after the high energy speech samples.FIG. 10bshows that AGC system300did not over-boost the speech samples with high energy as the speech samples were in the observation phase for this time period. However, as soon as AGC system300detects the occurrence of soft speech samples at point1004, it enters into a correction phase and applies gain correction to the soft speech samples. This is shown by points1006and1008inFIG. 10b.

FIG. 11aand11bshows a waveform of speech samples before gain correction when two speakers are in conversation, in accordance with an exemplary embodiment of the present invention. Both the speakers have varying speech levels. The present embodiment denotes soft speech samples in situations where the second speaker is intentionally speaking softly, and is at a substantial distance from the microphone while responding to the first speaker who is speaking at close proximity to the microphone. Points1102and1106inFIG. 11adenote appropriate speech samples from the first speaker, whereas points1104and1108inFIG. 11adenote soft speech samples from the second speaker. Point1110inFIG. 11bdenotes that AGC system300is not fully trained, but by the time AGC system300encounters point1112, it becomes fully trained and applies the gain correction on the soft speech samples.

FIG. 12is a tabular representation showing a comparison of MIPS values between AGC system200used in prior art and AGC system300used in the present invention. As shown inFIG. 12when AGC system200is independent of encoder210, the MIPS values are 2.3145 whereas in situations where AGC system300is used in conjunction with encoder310, the MIPS values are 0.1. The MIPS values are substantially reduced as the steps of filtering, computing energy and determining SID value that were being performed twice in the prior art, first time independent of encoder210and second time by encoder210, are performed just once by encoder310in the present invention. The MIPS values for prior art are shown by row numbers1202to1210and the corresponding column number1212whereas the MIPS values for the present invention are shown by row numbers1202to1210and the corresponding column number1214.