Abstract:
A method, system and program for encoding and decoding speech according to a source-filter model whereby speech is modelled to comprise a source signal filtered by a time-varying filter. The method comprises: receiving a speech signal comprising successive frames. For each of a plurality of frames of the speech signal: adding a predetermined noise signal generated by a quantization gain multiplied by 0.5 times an inverse of a pitch correlation to the speech signal to generate a simulated signal, determining linear predictive coding coefficients based on the simulated signal frame, and determining a linear predictive coding residual signal based on the linear predictive coding coefficients and one of the speech signal and the simulated signal. Then forming an encoded signal representing said speech signal, based on the linear predictive coding coefficients and the linear predictive coding residual signal.

Description:
RELATED APPLICATION 
     This application claims priority under 35 U.S.C. §119 or 365 to Great Britain Application No. 0900141.3, filed Jan. 6, 2009. The entire teachings of the above application are incorporated herein by reference. 
     FIELD OF THE INVENTION 
     The present invention relates to the encoding of speech for transmission over a transmission medium, such as by means of an electronic signal over a wired connection or electro-magnetic signal over a wireless connection. 
     BACKGROUND 
     A source-filter model of speech is illustrated schematically in  FIG. 1 a   . As shown, speech can be modelled as comprising a signal from a source  102  passed through a time-varying filter  104 . The source signal represents the immediate vibration of the vocal chords, and the filter represents the acoustic effect of the vocal tract formed by the shape of the throat, mouth and tongue. The effect of the filter is to alter the frequency profile of the source signal so as to emphasise or diminish certain frequencies. Instead of trying to directly represent an actual waveform, speech encoding works by representing the speech using parameters of a source-filter model. 
     As illustrated schematically in  FIG. 1 b   , the encoded signal will be divided into a plurality of frames  106 , with each frame comprising a plurality of subframes  108 . For example, speech may be sampled at 16 kHz and processed in frames of 20 ms, with some of the processing done in subframes of 5 ms (four subframes per frame). Each frame comprises a flag  107  by which it is classed according to its respective type. Each frame is thus classed at least as either “voiced” or “unvoiced”, and unvoiced frames are encoded differently than voiced frames. Each subframe  108  then comprises a set of parameters of the source-filter model representative of the sound of the speech in that subframe. 
     For voiced sounds (e.g. vowel sounds), the source signal has a degree of long-term periodicity corresponding to the perceived pitch of the voice. In that case, the source signal can be modelled as comprising a quasi-periodic signal with each period comprising a series of pulses of differing amplitudes. The source signal is said to be “quasi” periodic in that on a timescale of at least one subframe it can be taken to have a single, meaningful period which is approximately constant; but over many subframes or frames then the period and form of the signal may change. The approximated period at any given point may be referred to as the pitch lag. An example of a modelled source signal  202  is shown schematically in  FIG. 2 a    with a gradually varying period P 1 , P 2 , P 3 , etc., each comprising four pulses which may vary gradually in form and amplitude from one period to the next. 
     According to many speech coding algorithms such as those using Linear Predictive Coding (LPC), a short-term filter is used to separate out the speech signal into two separate components: (i) a signal representative of the effect of the time-varying filter  104 ; and (ii) the remaining signal with the effect of the filter  104  removed, which is representative of the source signal. The signal representative of the effect of the filter  104  may be referred to as the spectral envelope signal, and typically comprises a series of sets of LPC parameters describing the spectral envelope at each stage.  FIG. 2 b    shows a schematic example of a sequence of spectral envelopes  204   1 ,  204   2 ,  204   3 , etc. varying over time. Once the varying spectral envelope is removed, the remaining signal representative of the source alone may be referred to as the LPC residual signal, as shown schematically in  FIG. 2   a.    
     The spectral envelope signal and the source signal are each encoded separately for transmission. In the illustrated example, each subframe  106  would contain: (i) a set of parameters representing the spectral envelope  204 ; and (ii) a set of parameters representing the pulses of the source signal  202 . 
     In the illustrated example, each subframe  106  would comprise: (i) a quantised set of LPC parameters representing the spectral envelope, (ii)(a) a quantised LTP vector related to the correlation between pitch-periods in the source signal, and (ii)(b) a quantised LTP residual signal representative of the source signal with the effects of both the inter-period correlation and the spectral envelope removed. 
     The residual signal comprises information present in the original input speech signal that is not represented by the quantized LPC parameters and LTP vector. This information must be encoded and sent with the LPC and LTP parameters in order to allow the encoded speech signal to be accurately synthesized at the decoder. In order to reduce the bit rate required for transmitting the encoded speech signal, it is preferable to minimize the energy of the residual signal, and therefore minimize the bit rate required to encode the residual signal. 
     It is an aim of some embodiments of the present invention to address, or at least mitigate, some of the above identified problems of the prior art. 
     SUMMARY 
     According to an aspect of the invention, there is provided a method of encoding a speech signal according to a source-filter model, whereby speech is modelled to comprise a source signal filtered by the time-varying filter, the method comprising receiving a speech signal comprising successive frames, for each of a plurality of frames of the input speech signal, adding a predetermined noise signal to the input speech signal to generate a simulated signal, determining linear predictive coding coefficients based on the simulated signal frame, and determining a linear predictive coding residual signal based on the speech input signal and the linear predictive coding coefficients, and forming an encoded signal representing said speech signal, based on the linear predictive coding coefficients and the linear predictive coding residual signal. 
     In embodiments, the method may further comprise generating a quantized residual signal based on the linear predictive coding residual signal. 
     Generating a quantized residual signal may further generate an associated quantization noise signal, and the predetermined noise signal comprises white noise may have a variance equal to a variance of the quantization noise. 
     The predetermined noise signal may be generated by combining a white noise signal with a quantization gain value. The quantization gain value may be generated in a noise shaping analysis. 
     Forming the encoded signal may comprise arithmetically encoding the quantized residual signal and the linear predictive coding coefficients. 
     According to a further aspect of the invention, there is provided an encoder for encoding speech according to a source-filter model whereby speech is modelled to comprise a source signal filtered by a time-varying filter, the encoder comprising an input arranged to receive a speech signal comprising successive frames, a first signal-processing module configured to generate, for each of a plurality of frames of the speech signal, a simulated signal frame by adding a predetermined noise signal to the input speech signal frame, a second signal-processing module configured to determine linear predictive coding coefficients based on the simulated signal frame, the second signal-processing module further configured to determine a linear predictive coding residual signal based on the input speech signal and the linear predictive coding coefficients, and a third signal-processing module configured to form an encoded signal representing the speech signal, based on the linear predictive coding coefficients and the linear predictive coding residual signal. 
     The encoder may further comprise a fourth signal-processing module configured to generate a quantized residual signal based on the linear predictive coding residual signal. 
     The second signal-processing module may comprise a linear predictive coding analysis module. The forth signal-processing module may comprise a noise shaping quantizer module. 
     According to further aspects of the present invention, there are provided corresponding computer program products and client application products arranged so as when executed on a processor they perform the methods described above. 
     According to another aspect of the present invention, there is provided a communication system comprising a plurality of end-user terminals each comprising a corresponding encoder and/or decoder. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       Embodiments of the present invention will now be described by way of example only, and with reference to the accompanying figures, in which: 
         FIG. 1 a    is a schematic representation of a source-filter model of speech, 
         FIG. 1 b    is a schematic representation of a frame, 
         FIG. 2 a    is a schematic representation of a source signal, 
         FIG. 2 b    is a schematic representation of variations in a spectral envelope, 
         FIG. 3  shows a linear predictive speech encoder, 
         FIG. 4  shows a more detailed representation of noise shaping interpolator of  FIG. 3 , 
         FIG. 5  shows a linear predictive speech decoder, 
         FIG. 6  shows an encoder according to an embodiment of the invention, 
         FIG. 7  shows a detailed view of the create simulated output block of  FIG. 6 , 
         FIG. 8  shows the noise shaping quanitizer of  FIG. 6 , 
         FIG. 9  shows a decoder suitable for decoding a signal encoded using the encoder of  FIG. 6 . 
     
    
    
     DETAILED DESCRIPTION OF EMBODIMENTS 
     Embodiments of the invention are described herein by way of particular examples and specifically with reference to exemplary embodiments. It will be understood by one skilled in the art that the invention is not limited to the details of the specific embodiments given herein. 
       FIG. 3  shows a speech encoder based on the linear prediction quantization paradigm. The encoder  300  of  FIG. 3  comprises a high-pass filter  302 , a linear predictive coding (LPC) analysis block  304 , a first vector quantizer  306 , an open-loop pitch analysis block  308 , a long-term prediction (LTP) analysis block  310 , a second vector quantizer  312 , a noise shaping analysis block  314 , a noise shaping quantizer  316 , and an arithmetic encoding block  318 . 
     The high pass filter  302  has an input arranged to receive an input speech signal from an input device such as a microphone, and an output coupled to inputs of the LPC analysis block  304 , noise shaping analysis block  314  and noise shaping quantizer  316 . The LPC analysis block  304  has an output coupled to an input of the first vector quantizer  306 . The first vector quantizer  306  has an output coupled to inputs of the arithmetic encoding block  318  and noise shaping quantizer  316 . 
     The LPC analysis block  304  has outputs coupled to inputs of the open-loop pitch analysis block  308  and the LTP analysis block  310 . The LTP analysis block  310  has an output coupled to an input of the third vector quantizer  312 , and the third vector quantizer  312  has outputs coupled to inputs of the arithmetic encoding block  318  and noise shaping quantizer  316 . The open-loop pitch analysis block  308  has outputs coupled to inputs of the LTP analysis block  310  and the noise shaping analysis block  314 . The noise shaping analysis block  314  has outputs coupled to inputs of the arithmetic encoding block  318  and the noise shaping quantizer  316 . The noise shaping quantizer  316  has an output coupled to an input of the arithmetic encoding block  318 . The arithmetic encoding block  318  is arranged to produce an output bitstream based on its inputs, for transmission from an output device such as a wired modem or wireless transceiver. 
     In operation, the encoder processes a speech input signal sampled at 16 kHz in frames of 20 milliseconds, with some of the processing done in subframes encoded parameters, and has a bitrate that varies depending on a quality setting provided to the encoder and on the complexity and perceptual importance of the input signal. 
     The speech signal is high-pass filtered by high-pass filter  302  and input to the linear predictive coding (LPC) analysis  304  which determines 16 LPC coefficients. The LPC analysis whitens the high-pass filtered input signal based on the 16 LPC coefficients thereby creating an LPC residual signal. The LPC residual signal is used by the open loop pitch analysis  308  which determines one or more pitch lags for the frame. For frames classified as voiced, the long-term prediction (LTP) analysis  310  uses the LPC residual to find one or more sets of LTP coefficients. The LPC and LTP coefficients together constitute the short-term and long-term prediction parameters, which are optimized to minimize the energy of the residual after removing the short-term and long-term predictive component from the filtered input signal. The prediction parameters are quantized and sent to a decoder  500 . The noise shaping analysis  314  on the high-pass filtered input signal determines noise shaping filter coefficients and quantization gains. The noise shaping filter parameters and quantization gains, together with the quantized prediction coefficients are used by the noise shaping quantizer  316  to create a quantized representation of the residual signal which can be used in the decoder together with the quantized prediction coefficients, pitch lags and quantization gains to construct a decoded speech signal. 
       FIG. 4  shows a noise shaping quantizer that combines short-term and long-term noise shaping and short-term and long-term prediction. 
     The noise shaping quantizer  316  comprises a first addition stage  402 , a first subtraction stage  404 , a scalar quantizer  408 , a second addition stage  410 , a shaping filter  412 , a prediction filter  414  and a second subtraction stage  416 . The shaping filter  412  comprises a third addition stage  418 , a long-term shaping block  420 , a third subtraction stage  422 , and a short-term shaping block  424 . The prediction filter  414  comprises a fourth addition stage  426 , a long-term prediction block  428 , a fourth subtraction stage  430 , and a short-term prediction block  432 . 
     The first addition stage  402  has an input arranged to receive the high-pass filtered input from the high-pass filter  302 , and another input coupled to an output of the third addition stage  418 . The first subtraction stage has inputs coupled to outputs of the first addition stage  402  and fourth addition stage  426 . An output of the first subtraction stage is coupled to an input of the scalar quantizer  408 . The scalar quantiser  408  has outputs coupled to inputs of the second addition stage  410  and the arithmetic encoding block  318 . The other input of the second addition stage  410  is coupled to an output of the fourth addition stage  426 . An output of the second addition stage is coupled back to the input of the first addition stage  402 , and to an input of the short-term prediction block  432  and the fourth subtraction stage  430 . An output of the short-term prediction block  432  is coupled to the other input of the fourth subtraction stage  430 . The fourth addition stage  426  has inputs coupled to outputs of the long-term prediction block  428  and short-term prediction block  432 . The output of the second addition stage  410  is further coupled to an input of the second subtraction stage  416 , and the other input of the second subtraction stage  416  is coupled to the input from the high-pass filter  302 . An output of the second subtraction stage  416  is coupled to inputs of the short-term shaping block  424  and the third subtraction stage  422 . An output of the short-term shaping block  424  is coupled to the other input of the third subtraction stage  422 . The third addition stage  418  has inputs coupled to outputs of the long-term shaping block  420  and short-term prediction block  424 . 
     The purpose of the noise shaping quantizer  316  is to quantize the LTP residual signal in a manner that weights the distortion noise created by the quantisation into parts of the frequency spectrum where the human ear is more tolerant to noise. 
     In operation, all gains and filter coefficients and gains are updated for every subframe, except for the LPC coefficients, which are updated once per frame. 
     The noise shaping quantizer  316  generates a quantized output signal that is identical to the output signal ultimately generated in the decoder. The input signal is subtracted from this quantized output signal at the second subtraction stage  616  to obtain the quantization error signal d(n). The quantization error signal is input to a shaping filter  412 , described in detail later. The output of the shaping filter  412  is added to the input signal at the first addition stage  402  in order to effect the spectral shaping of the quantization noise. From the resulting signal, the output of the prediction filter  414 , described in detail below, is subtracted at the first subtraction stage  404  to create a residual signal. The residual signal is input to the scalar quantizer  408 . The quantization indices of the scalar quantizer  408  represent an excitation signal that is input to the arithmetically encoder  318 . The scalar quantizer  408  also outputs a quantization signal. The output of the prediction filter  414  is added at the second addition stage to the quantization signal to form the quantized output signal. The quantized output signal is input to the prediction filter  414 . 
     The prediction filter  414  combines the outputs of a short-term (LPC) predictor and a long-term (LTP) predictor. The difference between quantized output signal and input signal is the coding noise signal, which is input to the shaping filter  412 . The shaping filter combines the outputs of short-term and long-term shaping filters. 
     The LPC and LTP coefficients determined in the LPC and LTP analyses of  FIG. 3  are optimized to minimize the energy of residual signal after filtering the input signal first with an LPC analysis filter  304  and then with an LTP analysis filter  310 . 
     The energy of the residual signal is minimized by removing correlations between samples of the residual signal; or in other words, the residual signal is a whitened version of the input signal. In  FIG. 4 , in order to minimize the bitrate for the encoded signal, the quantization indices should be maximally uncorrelated. 
     However, this is not guaranteed by the way the LPC and LTP analyses are performed. This is because for the quantization indices to be uncorrelated, the LPC and LTP analysis filters should whiten the quantized output signal, rather than the speech input signal. The quantized output signal may differ significantly from the input signal, especially when coding at low bitrates, as is often the case in order to ensure efficient use of network resources. 
     According to an embodiment of the invention, a signal is generated in the encoder that matches the spectral characteristics of the output signal. By performing short-term and long-term prediction analysis on this simulated signal instead of on the input signal, the prediction gain of the prediction filters is improved. This results in a lower entropy of the quantization indices, thus reducing the bitrate. 
     The predictive noise shaping quantizer  316  of  FIG. 4  generates a quantized output signal y(n) that can be described in the z-domain as 
                 Y   ⁡     (   z   )       =       X   ⁡     (   z   )       +       Q   ⁡     (   z   )         1   -     F   ⁡     (   z   )               ,         
where X(z), Q(z) and F(z) are the z-transforms of the input signal, the quantization noise (i.e., quantizer output minus quantizer input) and the shaping filter, respectively. The prediction filter  414  has little impact on the output signal, because the output of the prediction filter  414  is first subtracted (before quantization) and then added again (after quantization). Therefore, a simulated output signal can be generated that has spectral characteristics similar to the final quantized output signal, by adding to the input signal a filtered noise signal. The noise signal may be chosen such as to have spectral properties similar to the quantization noise signal, and can be a white noise with variance equal to the expected quantization noise variance. Performing LPC and LTP analysis on the simulated output signal leads to prediction coefficients that correspond to a whiter quantizer output signal, thus reducing the bitrate.
 
       FIG. 5  shows a linear predictive speech decoder  500  suitable for decoding a speech signal encoded using the encoder of  FIG. 3 . The speech decoder  500  of  FIG. 5  comprises an Excitation Generator  502 , a long term prediction synthesis filter  504  and a linear predictive coding synthesis filter  506 . Long term analysis synthesis filter  504  comprises long term predictor  508  and first summing stage  510 . Linear predictive coding synthesis filter  506  comprises short-term predictor  512  and second summing stage  514 . 
     Quantization indices are input to the excitation generator  502  which generates an excitation signal. The output of a long term predictor  508  is added to the excitation signal in first summing stage  510 , which creates the LPC excitation signal. The LPC excitation signal is input to the long-term predictor  508 , which is a strictly causal MA filter controlled by the pitch lag and quantized LTP coefficients. The output of a short term predictor  512  is added to the LPC excitation signal in the second summing stage  514 , which creates the quantized output signal. The quantized output signal is input to the short-term predictor  512 , which is a strictly causal MA filter controlled by the quantized LPC coefficients. 
       FIG. 6  shows an encoder  600  according to an embodiment of the invention. The encoder  600  is similar to the encoder of  FIG. 3 , and further comprises a output signal simulation block  602 , and modified noise shaping analysis block  604  and open loop pitch analysis block  606 . 
     The high pass filter  302  has an input arranged to receive an input speech signal from an input device such as a microphone, and an output coupled to inputs of the output signal simulation block  602 , noise shaping analysis block  604  and open loop pitch analysis block  606 . Open loop pitch analysis block  606  has an output connected to inputs of the noise shaping analysis block  604  and the noise shaping quantizer  616 . The noise shaping analysis block  604  has an output. connected to inputs of the output signal simulation block  606 , and the noise shaping quantizer  616 . The output signal simulation block  602  has an output connected to an input of the LPC analysis block  304 . 
     The LPC analysis block  304  has outputs coupled to inputs of the first vector quantizer  306  and the LTP analysis block  610 . The first vector quantizer  306  has an output coupled to an input of the arithmetic encoding block  318  and noise shaping quantizer  616 . 
     The LPC analysis block  304  has an output coupled to input of the LTP analysis block  310 . The LTP analysis block  310  has an output coupled to an input of the second vector quantizer  312 , and the second vector quantizer  312  has outputs coupled to inputs of the arithmetic encoding block  318  and noise shaping quantizer  616   
     The noise shaping quantizer  616  has an output coupled to an input of the arithmetic encoding block  618 . The arithmetic encoding block  618  is arranged to produce an output bitstream based on its inputs, for transmission from an output device such as a wired modem or wireless transceiver. 
     In operation, the encoder processes a speech input signal sampled at 16 kHz in frames of 20 milliseconds, with some of the processing done in subframes encoded parameters, and has a bitrate that varies depending on a quality setting provided to the encoder and on the complexity and perceptual importance of the input signal. 
     The speech input signal is input to the high-pass filter  302  to remove frequencies below 80 Hz which contain almost no speech energy and may contain noise that can be detrimental to the coding efficiency and cause artifacts in the decoded output signal. The high-pass filter  302  is preferably a second order auto-regressive moving average (ARMA) filter. 
     The high-pass filtered input signal is input to the open loop pitch analysis  606  producing one pitch lag for every 5 millisecond sub frame, i.e., four pitch lags per frame. The pitch lags are chosen between 32 and 288 samples, corresponding to pitch frequencies from 56 to 500 Hz, which covers the range found in typical speech signals. Also, the pitch analysis produces a pitch correlation value which is the normalized correlation of the signal in the current frame and the signal delayed by the pitch lag values. Frames for which the correlation value is below a threshold of 0.5 are classified as unvoiced, i.e., containing no periodic signal, whereas all other frames are classified as voiced. The pitch lags are input to the arithmetic coder  318  and noise shaping quantizer  616 . 
     The high-pass filtered input is analyzed by the noise shaping analysis block  604  to find the filter coefficients and quantization gains used in the noise shaping quantizer  616 . The filter coefficients determine the distribution over the quantization noise over the spectrum, and are chosen such that the quantization is least audible. The quantization gains determine the step size of the residual quantizer and as such govern the balance between bitrate and quantization noise level. 
     All noise shaping parameters are computed and applied per subframes of 5 milliseconds. First, a 16 th  order noise shaping LPC analysis is performed on a windowed signal block of 16 milliseconds. The signal block has a look-ahead of 5 milliseconds relative to the current subframe, and the window is an asymmetric sine window. The noise shaping LPC analysis is done with the autocorrelation method. The quantization gain is found as the square-root of the residual energy from the noise shaping LPC analysis, multiplied by a constant to set the average bitrate to the desired level. For voiced frames, the quantization gain is further multiplied by 0.5 times the inverse of the pitch correlation determined by the pitch analyses, to reduce the level of quantization noise which is more easily audible for voiced signals. The quantization gain for each subframe is quantized, and the quantization indices are input to the arithmetically encoder. The quantized quantization gains are input to the noise shaping quantizer  616 . 
     A set of short-term noise shaping coefficients a shape (i) is determined by applying bandwidth expansion to the coefficients found in the noise shaping LPC analysis. This bandwidth expansion moves the roots of the noise shaping LPC polynomial towards the origin, according to the formula
 
 a   shape ( i )= a   autocorr ( i )  gi  
 
where a autocorr (i) is the i th  coefficient from the noise shaping LPC analysis and for the bandwidth expansion factor g a value of 0.94 was found to give good results.
 
     For voiced frames, the noise shaping quantizer  616  also applies long-term noise shaping. It uses three filter taps, described by:
 
 b shape=0.5 sqrt(PitchCorrelation) [0.25, 0.5, 0.25].
 
     The short-term and long-term noise shaping coefficients are input to the noise shaping quantizer  616 . 
     The high-pass filtered input is input to a module that creates a simulated output signal  602 . The output signal simulation block  602  is shown in  FIG. 7 , and comprises amplifier  702 , first summing stage  704 , second summing stage  706 , first subtraction stage  718  and shaping filter  710 . Shaping filter  710  comprises third summing stage  708 , long-term shaping filter  714  and short-term shaping filter  712 . 
     An input signal is input to a first input of second summing stage  706 , and an output of shaping filter  710  is coupled to a second input of summing stage  706 . The output of second summing stage  706  comprises a first input to first summing stage  704 . A white noise signal is applied to an input of amplifier  702 . The quantization gain is applied to a control input of the amplifier  702  and the output of the amplifier comprises a second input to first summing stage  704 , to form the simulated output signal. The simulated output signal is applied to first subtraction stage  718 , where the input signal is subtracted, and the output of the first subtraction stage  718  is applied to shaping filter  710 . 
     In operation, the output of the shaping filter  710  is added to the input signal in second summing stage  706 . Then a white noise signal is added after being multiplied in the amplifier  702  by the quantization gain pertaining to the subframe. The white noise signal has a variance equal to the expected variance of the quantization noise in the noise shaping quantizer  616 . 
     For a uniform scalar quantizer with quantization step size D, the variance of the quantization noise is D 2 /12. The result after adding the white noise signal constitutes the simulated output signal. The high-pass filtered input signal is subtracted from the simulated output signal to create a simulated coding noise signal d sim (n), which is input to the shaping filter  710 . 
     The shaping filter  710  inputs the simulated coding noise signal to a short-term shaping filter  712 , which uses the short-term shaping coefficients a shape  to create a short-term shaping signal s short (n), according to the formula: 
     
       
         
           
             
               
                 s 
                 short 
               
               ⁡ 
               
                 ( 
                 n 
                 ) 
               
             
             = 
             
               
                 ∑ 
                 
                   i 
                   = 
                   1 
                 
                 16 
               
               ⁢ 
               
                 
                   
                     d 
                     sim 
                   
                   ⁡ 
                   
                     ( 
                     
                       n 
                       - 
                       i 
                     
                     ) 
                   
                 
                 ⁢ 
                 
                   
                     
                       a 
                       shape 
                     
                     ⁡ 
                     
                       ( 
                       i 
                       ) 
                     
                   
                   . 
                 
               
             
           
         
       
     
     The short-term shaping signal is subtracted from the simulated coding noise signal to create a shaping residual signal f(n). The shaping residual signal is input to a long-term shaping filter  714  which uses the long-term shaping coefficients b shape  to create a long-term shaping signal s long (n), according to the formula: 
     
       
         
           
             
               
                 s 
                 long 
               
               ⁡ 
               
                 ( 
                 n 
                 ) 
               
             
             = 
             
               
                 ∑ 
                 
                   i 
                   = 
                   
                     - 
                     2 
                   
                 
                 2 
               
               ⁢ 
               
                 
                   f 
                   ⁡ 
                   
                     ( 
                     
                       n 
                       - 
                       lag 
                       + 
                       i 
                     
                     ) 
                   
                 
                 ⁢ 
                 
                   
                     
                       b 
                       shape 
                     
                     ⁡ 
                     
                       ( 
                       i 
                       ) 
                     
                   
                   . 
                 
               
             
           
         
       
     
     The short-term and long-term shaping signals are added together to create the shaping filter output signal. 
     The simulated output signal is input to the linear prediction coding (LPC) analysis block  704 , which calculates 16 LPC coefficients a i  using the covariance method which minimizes the energy of the LPC residual r LPC : 
                   r   LPC     ⁡     (   n   )       =         x   HP     ⁡     (   n   )       -       ∑     i   =   1     16     ⁢         x   HP     ⁡     (     n   -   i     )       ⁢     a   i             ,         
where n is the sample number. The LPC coefficients are used with an LPC analysis filter to create the LPC residual.
 
     The LPC coefficients are transformed to a line spectral frequency (LSF) vector. The LSFs are quantized using a multi-stage vector quantizer (MSVQ) with 10 stages, producing 10 LSF indices that together represent the quantized LSFs. The quantized LSFs are transformed back to produce the quantized LPC coefficients aQ for use in the noise shaping quantizer  616 . 
     For voiced frames, a long-term prediction analysis is performed on the LPC residual. The LPC residual r LPC  is supplied from the LPC analysis block  304  to the LTP analysis block  310 . For each subframe, the LTP analysis block  310  solves normal equations to find five linear prediction filter coefficients b i  such that the energy in the LTP residual r LTP  for that subframe: 
                 r   LTP     ⁡     (   n   )       =         r   LPC     ⁡     (   n   )       -       ∑     i   =     -   2       2     ⁢         r   LPC     ⁡     (     n   -   lag   -   i     )       ⁢     b   i                 
is minimized.
 
     The LTP coefficients for each frame are quantized using a vector quantizer (VQ). The resulting VQ codebook index is input to the arithmetic coder, and the quantized LTP coefficients b Q  are input to the noise shaping quantizer. 
     An example of the noise shaping quantizer  616  is now discussed in relation to  FIG. 8 . 
     The noise shaping quantizer  616  is similar to the noise shaping quantizer shown in  FIG. 4 , but further comprises a first amplifier  806  and a second amplifier  809 . 
     The first addition stage  402  has an input arranged to receive the high-pass filtered input from the high-pass filter  302 , and another input coupled to an output of the third addition stage  418 . The first subtraction stage has inputs coupled to outputs of the first addition stage  402  and fourth addition stage  426 . The first amplifier has a signal input coupled to an output of the first subtraction stage and an output coupled to an input of the scalar quantizer  8408 . The first amplifier  406  also has a control input coupled to the output of the noise shaping analysis block  604 . The scalar quantizer  408  has outputs coupled to inputs of the second amplifier  809  and the arithmetic encoding block  318 . The second amplifier  809  also has a control input coupled to the output of the noise shaping analysis block  604 , and an output coupled to the an input of the second addition stage  410 . The other input of the second addition stage  410  is coupled to an output of the fourth addition stage  426 . An output of the second addition stage is coupled back to the input of the first addition stage  402 , and to an input of the short-term prediction block  432  and the fourth subtraction stage  430 . An output of the short-term prediction block  432  is coupled to the other input of the fourth subtraction stage  430 . The fourth addition stage  426  has inputs coupled to outputs of the long-term prediction block  428  and short-term prediction block  432 . The output of the second addition stage  410  is further coupled to an input of the second subtraction stage  416 , and the other input of the second subtraction stage  416  is coupled to the input from the high-pass filter  302 . An output of the second subtraction stage  416  is coupled to inputs of the short-term shaping block  424  and the third subtraction stage  422 . An output of the short-term shaping block  424  is coupled to the other input of the third subtraction stage  422 . The third addition stage  818  has inputs coupled to outputs of the long-term shaping block  820  and short-term prediction block  424 . 
     In operation, all gains and filter coefficients and gains are updated for every subframe, except for the LPC coefficients, which are updated once per frame. 
     The noise shaping quantizer  616  generates a quantized output signal that is identical to the output signal ultimately generated in the decoder. The input signal is subtracted from this quantized output signal at the second subtraction stage  416  to obtain the quantization error signal d(n). The quantization error signal is input to a shaping filter  412 , described in detail later. The output of the shaping filter  412  is added to the input signal at the first addition stage  402  in order to effect the spectral shaping of the quantization noise. From the resulting signal, the output of the prediction filter  414 , described in detail below, is subtracted at the first subtraction stage  404  to create a residual signal. The residual signal is multiplied at the first amplifier  806  by the inverse quantized quantization gain from the noise shaping analysis block  604 , and input to the scalar quantizer  408 . The quantization indices of the scalar quantizer  408  represent an excitation signal that is input to the arithmetically encoder  318 . The scalar quantizer  408  also outputs a quantization signal, which is multiplied at the second amplifier  809  by the quantized quantization gain from the noise shaping analysis block  604  to create an excitation signal. The output of the prediction filter  414  is added at the second addition stage to the excitation signal to form the quantized output signal. The quantized output signal is input to the prediction filter  414 . 
     On a point of terminology, note that there is a small difference between the terms “residual” and “excitation”. A residual is obtained by subtracting a prediction from the input speech signal. An excitation is based on only the quantizer output. Often, the residual is simply the quantizer input and the excitation is the output. 
     The shaping filter  412  inputs the quantization error signal d(n) to a short-term shaping filter  424 , which uses the short-term shaping coefficients a shape,i  to create a short-term shaping signal s short (n), according to the formula: 
     
       
         
           
             
               
                 s 
                 short 
               
               ⁡ 
               
                 ( 
                 n 
                 ) 
               
             
             = 
             
               
                 ∑ 
                 
                   i 
                   = 
                   1 
                 
                 16 
               
               ⁢ 
               
                 
                   d 
                   ⁡ 
                   
                     ( 
                     
                       n 
                       - 
                       i 
                     
                     ) 
                   
                 
                 ⁢ 
                 
                   
                     a 
                     
                       shape 
                       , 
                       i 
                     
                   
                   . 
                 
               
             
           
         
       
     
     The short-term shaping signal is subtracted at the third addition stage  422  from the quantization error signal to create a shaping residual signal f(n). The shaping residual signal is input to a long-term shaping filter  420  which uses the long-term shaping coefficients b shape,i  to create a long-term shaping signal s long (n), according to the formula: 
     
       
         
           
             
               
                 s 
                 long 
               
               ⁡ 
               
                 ( 
                 n 
                 ) 
               
             
             = 
             
               
                 ∑ 
                 
                   i 
                   = 
                   
                     - 
                     2 
                   
                 
                 2 
               
               ⁢ 
               
                 
                   f 
                   ⁡ 
                   
                     ( 
                     
                       n 
                       - 
                       lag 
                       - 
                       i 
                     
                     ) 
                   
                 
                 ⁢ 
                 
                   
                     b 
                     
                       shape 
                       , 
                       i 
                     
                   
                   . 
                 
               
             
           
         
       
     
     The short-term and long-term shaping signals are added together at the third addition stage  418  to create the shaping filter output signal. 
     The prediction filter  414  inputs the quantized output signal y(n) to a short-term prediction filter  432 , which uses the quantized LPC coefficients a Q  to create a short-term prediction signal p short (n), according to the formula: 
     
       
         
           
             
               
                 p 
                 short 
               
               ⁡ 
               
                 ( 
                 n 
                 ) 
               
             
             = 
             
               
                 ∑ 
                 
                   i 
                   = 
                   1 
                 
                 16 
               
               ⁢ 
               
                 
                   y 
                   ⁡ 
                   
                     ( 
                     
                       n 
                       - 
                       i 
                     
                     ) 
                   
                 
                 ⁢ 
                 
                   
                     
                       a 
                       Q 
                     
                     ⁡ 
                     
                       ( 
                       i 
                       ) 
                     
                   
                   . 
                 
               
             
           
         
       
     
     The short-term prediction signal is subtracted at the fourth subtraction stage  430  from the quantized output signal to create an LPC excitation signal e LPC (n). The LPC excitation signal is input to a long-term prediction filter  428  which uses the quantized long-term prediction coefficients b Q  to create a long-term prediction signal p long (n), according to the formula: 
     
       
         
           
             
               
                 p 
                 long 
               
               ⁡ 
               
                 ( 
                 n 
                 ) 
               
             
             = 
             
               
                 ∑ 
                 
                   i 
                   = 
                   
                     - 
                     2 
                   
                 
                 2 
               
               ⁢ 
               
                 
                   
                     e 
                     LPC 
                   
                   ⁡ 
                   
                     ( 
                     
                       n 
                       - 
                       lag 
                       - 
                       i 
                     
                     ) 
                   
                 
                 ⁢ 
                 
                   
                     
                       b 
                       Q 
                     
                     ⁡ 
                     
                       ( 
                       i 
                       ) 
                     
                   
                   . 
                 
               
             
           
         
       
     
     The short-term and long-term prediction signals are added together at the fourth addition stage  426  to create the prediction filter output signal. 
     The LPC indices, LTP indices, quantization gains indices, pitch lags and the excitation quantization indices are each arithmetically encoded and multiplexed by the arithmetic encoder  318  to create the payload bitstream. The arithmetic encoder  318  uses a look-up table with probability values for each index. The look-up tables are created by running a database of speech training signals and measuring frequencies of each of the index values. The frequencies are translated into probabilities through a normalization step. 
     An example decoder  900  for use in decoding a signal encoded according to embodiments of the present invention is now described in relation to  FIG. 9 . 
     The decoder  900  comprises an arithmetic decoding and dequantizing block  902 , an excitation generation block  502 , an LTP synthesis filter  504 , and an LPC synthesis filter  506 . The arithmetic decoding and dequantizing block  902  has an input arranged to receive an encoded bitstream from an input device such as a wired modem or wireless transceiver, and has outputs coupled to inputs of each of the excitation generation block  502 , LTP synthesis filter  504  and LPC synthesis filter  506 . The excitation generation block  502  has an output coupled to an input of the LTP synthesis filter  504 , and the LTP synthesis block  504  has an output connected to an input of the LPC synthesis filter  506 . The LPC synthesis filter has an output arranged to provide a decoded output for supply to an output device such as a speaker or headphones. 
     At the arithmetic decoding and dequantizing block  902 , the arithmetically encoded bitstream is demultiplexed and decoded to create LSF indices, LSF interpolation factor, LTP codebook index and LTP indices, quantization gains indices, pitch lags and a signal of excitation quantization indices. The LSF indices are converted to quantized LSFs by adding the codebook vectors of the ten stages of the MSVQ. Using the interpolation factor and the transmitted The LTP codebook index is used to select an LTP codebook, which is then used to convert the LTP indices to quantized LTP coefficients. The gains indices are converted to quantization gains, through look ups in the gain quantization codebook. The LTP indices and gains indices are converted to quantized LTP coefficients and quantization gains, through look ups in the quantization codebooks. 
     At the excitation generation block, the excitation quantization indices signal is multiplied by the quantization gain to create an excitation signal e(n). 
     The excitation signal is input to the LTP synthesis filter  504  to create the LPC excitation signal e ltp (n) according to: 
                   e   LTP     ⁡     (   n   )       =       e   ⁡     (   n   )       +       ∑     i   =     -   2       2     ⁢       e   ⁡     (     n   -   lag   -   i     )       ⁢       b   Q     ⁡     (   i   )               ,         
using the pitch lag and quantized LTP coefficients b Q .
 
     The long term excitation signal is input to the LPC synthesis filter to create the decoded speech signal y(n) according to: 
                 y   ⁡     (   n   )       =         e   LPC     ⁡     (   n   )       +       ∑     i   =   1     16     ⁢         e   LPC     ⁡     (     n   -   i     )       ⁢       a   Q     ⁡     (   i   )               ,         
using the quantized LPC coefficients a Q .
 
     The encoder  600  and decoder  900  are preferably implemented in software, such that each of the components  302  to  318 , and  602  to  606 , and  902 ,  502  to  506  comprise modules of software stored on one or more memory devices and executed on a processor. A preferred application of the present invention is to encode speech for transmission over a packet-based network such as the Internet, preferably using a peer-to-peer (P2P) system implemented over the Internet, for example as part of a live call such as a Voice over IP (VoIP) call. In this case, the encoder  600  and decoder  900  are preferably implemented in client application software executed on end-user terminals of two users communicating over the P2P system. 
     Thus, according to some embodiments of the present invention, a signal is generated in the encoder  600  that matches the spectral characteristics of the output signal. By performing short-term and long-term prediction analysis on that simulated signal, instead of on the input signal, the prediction gain of the prediction filters is improved. This results in a lower entropy of the quantization indices, thus reducing the bitrate required to transmit the encoded speech signal. Therefore, embodiments of the invention allow coding efficiency to be increased. 
     The foregoing description has provided by way of exemplary and non-limiting examples a full and informative description of the exemplary embodiment of this invention. However, various modifications and adaptations may become apparent to those skilled in the relevant arts in view of the foregoing description, when read in conjunction with the accompanying drawings and the appended claims. However, all such and similar modifications of the teachings of this invention will still fall within the scope of this invention as defined in the appended claims.