Abstract:
The invention concerns a method for detecting voice activity in a digital speech signal, in at least a frequency band, for example by means of a detecting automaton whereof the status is controlled on the basis of an energy analysis of the signal. The control of said automaton, or more generally the determination of voice activity, comprises a comparison, in the frequency band, of two different versions of the speech signal one of which at least is a noise-corrected version.

Description:
BACKGROUND OF THE INVENTION 
     The present invention relates to digital techniques for processing speech signals. It relates more particularly to the techniques utilizing voice activity detection so as to perform different processings depending on whether the signal does or does not carry voice activity. 
     The digital techniques in question come under varied domains: coding of speech for transmission or storage, speech recognition, noise reduction, echo cancellation, etc. 
     The main difficulty with processes for detecting voice activity is that of distinguishing between voice activity and the noise which accompanies the speech signal. 
     The document WO99/14737 describes a method of detecting voice activity in a digital speech signal processed on the basis of successive frames and in which an a priori denoising of the speech signal of each frame is carried out on the basis of noise estimates obtained during the processing of one or more previous frames, and the variations in the energy of the a priori denoised signal are analyzed so as to detect a degree of voice activity of the frame. By carrying out the detection of voice activity on the basis of an a priori denoised signal, the performance of this detection is substantially improved when the surrounding noise is relatively strong. 
     In the methods customarily used to detect voice activity, the energy variations of the (direct or denoised) signal are analyzed with respect to a long-term average of the energy of this signal, a relative increase in the instantaneous energy suggesting the appearance of voice activity. 
     An aim of the present invention is to propose another type of analysis allowing voice activity detection which is robust to the noise which may accompany the speech signal. 
     SUMMARY OF THE INVENTION 
     According to the invention, there is proposed a method for detecting voice activity in a digital speech signal in at least one frequency band, whereby the voice activity is detected on the basis of an analysis comprising a comparison, in the said frequency band, of two different versions of the speech signal, one at least of which is a denoised version obtained by taking account of estimates of the noise included in the signal. 
     This method can be executed over the entire frequency band of the signal, or on a subband basis, as a function of the requirements of the application using voice activity detection. 
     Voice activity can be detected in a binary manner for each band, or measured by a continuously varying parameter which may result from the comparison between the two different versions of the speech signal. 
     The comparison typically pertains to respective energies, evaluated in the said frequency band, of the two different versions of the speech signal, or to a monotonic function of these energies. 
     Another aspect of the present invention relates to a device for detecting voice activity in a speech signal, comprising signal processing means designed to implement a method as defined hereinabove. 
     The invention further relates to a computer program, loadable into a memory associated with a processor, and comprising portions of code for implementing a method as defined hereinabove upon the execution of the said program by the processor, as well as to a computer medium, on which such a program is recorded. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         FIG. 1  is a schematic diagram of a signal processing chain using a voice activity detector according to the invention; 
         FIG. 2  is a schematic diagram of an exemplary voice activity detector according to the invention; 
         FIGS. 3 and 4  are flow charts of signal processing operations performed in the detector of  FIG. 2 ; 
         FIG. 5  is a graphic showing an exemplary profile of energies calculated in the detector of  FIG. 2  and illustrating the principle of voice activity detection; 
         FIG. 6  is a diagram of a detection automaton implemented in the detector of  FIG. 2 ; 
         FIG. 7  is a schematic diagram of another embodiment of a voice activity detector according to the invention; 
         FIG. 8  is a flow chart of signal processing operations performed in the detector of  FIG. 7 ; 
         FIG. 9  is a graphic of a function used in the operations of  FIG. 8 . 
     
    
    
     DETAILED DESCRIPTION 
     The device of  FIG. 1  processes a digital speech signal s. The signal processing chain represented produces voice activity decisions δ n,j  which are usable in a manner known per se by application units, not represented, affording functions such as speech coding, speech recognition, noise reduction, echo cancellation, etc. The decisions δ n,j  can comprise a frequency resolution (index j), this making it possible to enhance applications operating in the frequency domain. 
     A windowing module  10  puts the signal s into the form of successive windows or frames of index n, each consisting of a number N of samples of digital signal. In a conventional manner, these frames may exhibit mutual overlaps. In the remainder of the present description, the frames will be regarded, without this being in any way limiting, as consisting of N=256 samples at a sampling frequency F e  of 8 kHz, with a Hamming weighting in each window, and overlaps of 50% between consecutive windows. 
     The signal frame is transformed into the frequency domain by a module  11  applying a conventional fast Fourier transform algorithm (FFT) for calculating the modulus of the spectrum of the signal. The module  11  then delivers a set of N=256 frequency components of the speech signal, which are denoted S n,f , where n designates the current frame number, and f a frequency of the discrete spectrum. Owing to the properties of digital signals in the frequency domain, only the first N/2=128 samples are used. 
     To calculate the estimates of the noise contained in the signal s, we do not use the frequency resolution available at the output of the fast Fourier transform, but a lower resolution, determined by a number I of frequency subbands covering the [0,F e /2] band of the signal. Each subband i (1≦i≦I) extends between a lower frequency f(i−1) and an upper frequency f(i), with f(0)=0, and f(I)=F e /2. This chopping into subbands can be uniform (f(i)−f(i−1)=F e /2I). It may also be non-uniform (for example according to a barks scale). A module  12  calculates the respective averages of the spectral components S n,f  of the speech signal on a subband basis, for example through a uniform weighting such as: 
         S     n   ,   i       =       1       f   ⁡     (   i   )       -     f   ⁡     (     i   -   1     )           ⁢       ∑     f   ∈     [       f   ⁡     (     i   -   1     )       ,     f   ⁡     (   i   )         ]         ⁢     S     n   ,   f               
 
     This averaging reduces the fluctuations between the subbands by averaging the contributions of the noise in these subbands, and this will reduce the variance of the noise estimator. Furthermore, this averaging makes it possible to reduce the complexity of the system. 
     The averaged spectral components S n,i  are addressed to a voice activity detection module  15  and to a noise estimation module  16 .  {circumflex over (B)}   n,i  denotes the long-term estimate of the noise component produced by the module  16  in relation to frame n and to subband i. 
     These long-term estimates  {circumflex over (B)}   n,i  may for example be obtained in the manner described in WO99/14737. It is also possible to use simple smoothing by means of an exponential window defined by a forget factor λ B :
 
 {circumflex over (B)}   n,i =λ B   .{circumflex over (B)}   n−1,i +(1−λ B ). S   n,i  
 
with λ B  equal to 1 if the voice activity detector  15  indicates that subband i bears voice activity, and equal to a value lying between 0 and 1 otherwise.
 
     Of course, it is possible to use other long-term estimates representative of the noise component included in the speech signal, these estimates may represent a long-term average, or else a minimum of the component S n,j  over a sufficiently long sliding window. 
       FIGS. 2 to 6  illustrate a first embodiment of the voice activity detector  15 . A denoising module  18  executes, for each frame n and each subband i, the operations corresponding to steps  180  to  187  of  FIG. 3 , so as to produce two denoised versions {circumflex over ( E )}p 1,n,i , {circumflex over ( E )}p 2,n,i  of the speech signal. This denoising is done by non-linear spectral subtraction. The first version {circumflex over ( E )}p 1,n,i , is denoised in such a way as not to be less, in the spectral domain, than a fraction β1 i  of the long-term estimate {circumflex over ( B )} n−τ,i . The second version {circumflex over ( E )}p 2,n,i  is denoised in such a way as not to be less, in the spectral domain, than a fraction β2 j  of the long-term estimate {circumflex over ( B )} n−τ1,i . The quantity τ1 is a delay expressed as a number of frames, which may be fixed (for example τ1=1) or variable. The more confident one is in the voice activity detection, the smaller the delay will be. The fractions β1 i  and β2 i  (such that β1 i &gt;β 2   i ) may be dependent on or independent of subband i. Preferred values correspond for β1 i  to an attenuation of 10 dB, and for β2 i  to an attenuation of 60 dB, i.e. β1 i ≈0.3 and β2 i ≈0.001. 
     In step  180 , the module  18  calculates, with the resolution of the subbands i, the frequency response Hp n,i  of the a priori denoising-filter, according to: 
         Hp     n   ,   j       =         S     n   ,   i       -       α       n   -   τ1     ,   i     ′     ·       B   ^         n   -   τ1     ,   i             S       n   -   τ2     ,   i             
 
where τ2 is a positive or zero integer delay and α′ n,i  is a noise overestimation coefficient. This overestimation coefficient α′ n,i  may be dependent on or independent of the frame index n and/or the subband index i. In a preferred embodiment, it depends both on n and i, and it is determined as described in document WO99/14737. A first denoising is performed in step  181 : {circumflex over ( E )}p n,i =Hp n,i .S n,i . In steps  182  to  184 , the spectral components {circumflex over ( E )}p 1,n,i  are calculated according {circumflex over ( E )}p 1,n,i =max ({circumflex over ( E )}p n,i :β1 i . {circumflex over (B)}   n−τ1,i ), and in steps  185  to  187 , the spectral components {circumflex over ( E )}p 2,n,i  are calculated according to {circumflex over ( E )}p 2,n,i =max({circumflex over ( E )}p n,i :β2 i . {circumflex over (B)}   n−τ1,i ).
 
     The voice activity detector  15  of  FIG. 2  comprises a module  19  which calculates energies of the denoised versions of the signal {circumflex over ( E )}p 1,n,i  and {circumflex over ( E )}p 2,n,i  respectively lying in m frequency bands designated by the index j (1≦j≦m, m≧1). This resolution may be the same as that of the subbands defined by the module  12  (index i), or a finer resolution of possibly as much as the whole of the useful band [0, F e /2] of the signal (case m= 1 ). By way of example, the module  12  can define I=16 uniform subbands of the band [0, F e /2], and the module  19  can retain m=3 wider bands, each band of index j covering the subbands of index i ranging from imin(j) to imax(j), with imin(1)=1, imin(j+1)=imax(j)+1 for 1≦j&lt;m, and imax(m)=1. In step  190  ( FIG. 3 ), the module  19  calculates the energies per band: 
         E     l   ,   n   ,   j       =       ∑     i   =     i   ⁢           ⁢     min   ⁡     (   j   )             i   ⁢           ⁢     max   ⁡     (   j   )           ⁢         [       f   ⁡     (   i   )       -     f   ⁡     (     i   -   1     )         ]     ·     E   ^       ⁢     p     l   ,   n   ,   i     2             
         E     2   ,   n   ,   j       =       ∑     i   =     i   ⁢           ⁢     min   ⁡     (   j   )             i   ⁢           ⁢     max   ⁡     (   j   )           ⁢         [       f   ⁡     (   i   )       -     f   ⁡     (     i   -   1     )         ]     ·     E   ^       ⁢     p     2   ,   n   ,   i     2             
 
     A module  20  of the voice activity detector  15  performs a temporal smoothing of the energies E 1,n,j  and E 2,n,j  for each of the bands of index j, this corresponding to steps  200  to  205  for  FIG. 4 . The smoothing of these two energies is performed by means of a determined smoothing window by comparing the energy E 2,n,j  of the most denoised version with its previously calculated smoothed energy Ē 2,n−1,j , or with a value of the order of this smoothed energy Ē 2,n−1,j , (tests  200  and  201 ). This smoothing window can be an exponential window defined by a forget factor λ lying between 0 and 1. This forget factor λ can take three values: the one λ r  very close to 0 (for example λ r =0) chosen in step  202  if E 2,n,j ≦Ē 2,n−1,j ; the second λ q  very close to 1 (for example λ q =0.99999) chosen in step  203  if E 2,n,j &gt;ΔĒ 2,n−1,j , Δ being a coefficient bigger than 1; and the third λ p  lying between 0 and λ q  (for example λ p =0.98) chosen in step  204  if Ē 2,n−1,j &lt;E 2,n−1,j ≦ΔĒ 2,n−1,j . The exponential smoothing with the forget factor λ is then performed conventionally in step  205  according to:
 
 Ē   1,n,j   =λ.Ē   1,n−1,j +(1−λ). E   1,n,j  
 
 Ē   2,n,j   =λ.Ē   2,n−1,j +(1−λ). E   2,n,j  
 
     An exemplary variation over time of the energies E 1,n,j  and E 2,n,j  and of the smoothed energies Ē 1,n,j , and Ē 2,n,j  is represented in  FIG. 5 . It may be seen that good tracking of the smoothed energies is achieved when the forget factor is determined on the basis of the variations in the energy E 2,n,j  corresponding to the most denoised version of the signal. The forget factor λ p  makes it possible to take into account the increases in the level of the background noise, the energy reductions being tracked by the forget factor λ r . The forget factor λ q  very close to 1 means that the smoothed energies do not track the abrupt energy increases due to speech. However, the factor λ q  remains slightly less than 1 so as to avoid errors caused by an increase in the background noise which may arise during a fairly long period of speech. 
     The voice activity detection automaton is controlled in particular by a parameter resulting from a comparison of the energies E 1,n,j  and E 2,n,j . This parameter can in particular be the ratio d n,j =E 1,n,j /E 2,n,j . It may be seen in  FIG. 5  that this ratio d n,j  allows proper detection of the speech phases (represented by hatching). 
     The control of the detection automaton can also use other parameters, such as a parameter related to the signal-to-noise ratio: snr n,j =E 1,n,j /Ē 1,n,j , this amounting to taking into account a comparison between the energies E 1,n,j  and Ē 1,n,j . The module  21  for controlling the automata relating to the various bands of index j calculates the parameters d n,j  and snr n,j  in step  210 , then determines the state of the automata. The new state δ n,j  of the automaton relating to band j depends on the previous state δ n−1,j , on d n,j  and on snr n,j , for example as indicated in the diagram of  FIG. 6 . 
     Four states are possible: δ j =0 detects silence, or absence of speech; δ j =2 detects the presence of voice activity; and the states δ j =1 and δ j =3 are intermediate states of ascent and descent. When the automaton is in the silence state (δ n−1,j =0), it remains there if d n,j  exceeds a first threshold α1 j , and if it switches to the ascent state in the converse case. In the ascent state (δ n−1,j =1), it returns to the silence state if d n,j  exceeds a second threshold α2 j ; and it switches to the speech state in the converse case. When the automaton is in the speech state (δ n−1,j =2), it remains there if snr n,j  exceeds a third threshold α3 j , and it switches to the descent state in the converse case. In the descent state (δ n−1,j =3), the automaton returns to the speech state if snr n,j  exceeds a fourth threshold α4 j , and it returns to the silence state in the converse case. The thresholds α1 j , α2 j , α3 j , and α4 j  may be optimized separately for each of the frequency bands j. 
     It is also possible for the automata relating to the various bands to be made to interact by the module  21 . 
     In particular, it may force each of the automata relating to each of the subbands to the speech state as soon as one among them is in the speech state. In this case, the output of the voice activity detector  15  relates to the whole of the signal band. 
     The two appendices to the present description show a source code in the C++ language, with a fixed-point data representation corresponding to an implementation of the exemplary voice activity detection method described hereinabove. To embody the detector, one possibility is to translate this source code into executable code, to record it in a program memory associated with an appropriate signal processor, and to have it executed by this processor on the input signals of the detector. The function a_priori_signal_power presented in appendix  1  corresponds to the operations incumbent on the modules  18  and  19  of the voice activity detector  15  of  FIG. 2 . The function voice_activity_detector presented in appendix  2  corresponds to the operations incumbent on the modules  20  and  21  of this detector. 
     In the particular example of the appendices, the following parameters have been employed: τ1=1; τ2=0; β1 i =0.3; β2 i =0.001; m=3; Δ=4.953; λ p =0.98; λ q =0.99999; λ r =0; α1 j =α2 j =α4 j =1.221; α3 j =1.649. Table 1 hereinbelow gives the correspondences between the notation employed in the above description and in the drawings and that employed in the appendix. 
     
       
         
               
               
               
             
           
               
                   
                 TABLE I 
               
               
                   
                   
               
             
             
               
                   
                 subband 
                 I 
               
               
                   
                 E[subband] 
                 S n,i   
               
               
                   
                 module 
                 Êp n,i  or Êp 1,n,i  or Êp 2,n,i   
               
               
                   
                 param.beta_a_priori1 
                 β1 j   
               
               
                   
                 param.beta_a_priori2 
                 β2 j   
               
               
                   
                 vad 
                 j-1 
               
               
                   
                 param.vad_number 
                 m 
               
               
                   
                 P1[vad] 
                 E 1,n,j−1   
               
               
                   
                 P1s[vad] 
                 Ē 1,n,j−1   
               
               
                   
                 P2[vad] 
                 E 2,n,j−1   
               
               
                   
                 P2s[vad] 
                 Ē 2,n,j−1   
               
               
                   
                 DELTA_P 
                 Log(Δ) 
               
               
                   
                 d 
                 Log(d n,j ) 
               
               
                   
                 snr 
                 Log(snr n,j ) 
               
               
                   
                 NOISE 
                 silence state 
               
               
                   
                 ASCENT 
                 ascent state 
               
               
                   
                 SIGNAL 
                 speech state 
               
               
                   
                 DESCENT 
                 descent state 
               
               
                   
                 D_NOISE 
                 Log(α1 j ) 
               
               
                   
                 D_SIGNAL 
                 Log(α2 j ) 
               
               
                   
                 SNR_SIGNAL 
                 LOG(α3 j ) 
               
               
                   
                 SNR_NOISE 
                 Log(α4 j ) 
               
               
                   
                   
               
             
          
         
       
     
     In the variant embodiment illustrated by  FIG. 7 , the denoising module  25  of the voice activity detector  15  delivers a single denoised version {circumflex over ( E )}p n,i  of the speech signal, so that the module  26  calculates its energy E 2,n,j  for each band j. The other version, in which the module  26  calculates the energy, is represented directly by the non-denoised samples S n,i . 
     As before, various denoising processes may be applied by the module  25 . In the example illustrated by steps  250  to  256  of  FIG. 8 , the denoising is done by nonlinear spectral subtraction with a noise overestimation coefficient dependent on a quantity ρ related to the signal-to-noise ratio. In steps  250  to  252 , a preliminary denoising is performed for each subband of index i according to:
 
 S′   n,i =max( S   n,i   −α.{circumflex over (B)}   n−1,i   ;β.{circumflex over (B)}   n−1,i )
 
the preliminary overestimation coefficient being for example α=2, and the fraction β possibly corresponding to a noise attenuation of the order of 10 dB.
 
     The quantity ρ is taken equal to the ratio S′ n,i /S n,i  in step  253 . The overestimation factor f(ρ) varies in a nonlinear manner with the quantity ρ, for example as represented in  FIG. 9 . For the values of ρ closest to 0 (ρ&lt;ρ 1 ), the signal-to-noise ratio is low, and it is possible to take an overestimation factor f(ρ)=2. For the highest values of ρ (ρ 2 ≦ρ≦1), the noise is weak and need not be overestimated (f(ρ)=1). Between ρ 1  and ρ 2 , f(ρ) decreases from 2 to 1, for example linearly. The denoising proper, providing the version {circumflex over ( E )}p n,i  is performed in steps  254  to  256 :
 
 Êp   n,i =max( S   n,i   −f(ρ).{circumflex over (B)}   n−1,i   ;β.{circumflex over (B)}   n−1,i )
 
     The voice activity detector  15  considered with reference to  FIG. 7  uses, in each frequency band of index j (and/or in full band), a detection automaton having two states, silence or speech. The energies E 1,n,j  and E 2,n,j  calculated by the module  26  are respectively those contained in the components S n,i  of the speech signal and those contained in the denoised components {circumflex over ( E )}p n,i  calculated over the various bands as indicated in step  260  of  FIG. 8 . The comparison of the two different versions of the speech signal pertains to respective differences between the energies E 1,n,j  and E 2,n,j  and a lower bound of the energy E 2,n,j  of the denoised version. 
     This lower bound E 2min,j  can in particular correspond to a minimum value, over a sliding window, of the energy E 2,n,j  of the denoised version of the speech signal in the frequency band considered. In this case, a module  27  stores in a memory of the first-in first-out type (FIFO) the L most recent values of the energy E 2,n,j  of the denoised signal in each band j, over a sliding window representing for example of the order of 20 frames, and delivers the minimum energies 
               E       2   ⁢   min     ,   j       =       ⁢   min           E     2   ,     n   -   k     ,   j                     ⁢     0   ≤   k   &lt;   L                           
 
over this window (step  270  of  FIG. 8 ). In each band, this minimum energy E 2min,j  serves as lower bound for the module  28  for controlling the detection automaton, which uses a measure M j  given by 
               M   j     =           E     2   ,   n   ,   j       -     E       2   ⁢   min     ,   i             E     2   ,   n   ,   j       -     E       2   ⁢   min     ,   j           .             (     step   ⁢           ⁢   280     )             
 
     The automaton can be a simple binary automaton using a threshold A j , possibly dependent on the band considered: If M j ≧A j , the output bit δ n,j  of the detector represents a silence state of the band j, and if M j ≦A j , it represents a speech state. As a variant, the module  28  could deliver a nonbinary measure of the voice activity, represented by a decreasing function of M j . 
     As a variant, the lower bound E 2min,j  used in step  280  could be calculated with the aid of an exponential window, with a forget factor. It could also be represented by the energy over band j of the quantity β.{circumflex over ( B )} n−1,i  serving as floor in the denoising by spectral subtraction. 
     In the foregoing, the analysis performed in order to decide on the presence or absence of voice activity pertains directly to energies of different versions of the speech signal. Of course, the comparisons could pertain to a monotonic function of these energies, for example a logarithm, or to a quantity having similar behavior to the energies according to voice activity (for example the power). 
     
       
         
               
             
               
             
               
               
             
               
             
               
               
             
               
             
               
               
             
               
             
               
               
             
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
             
               
               
             
               
               
             
               
             
               
               
             
               
             
               
               
             
               
               
             
               
             
               
               
             
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
             
               
               
             
               
             
               
               
             
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
             
               
               
             
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
             
               
               
             
               
             
               
               
             
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
             
               
               
             
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
             
           
               
                   
               
               
                 APPENDIX 1 
               
               
                   
               
             
             
               
                   
               
             
          
           
               
                 /******************************************************************* 
               
               
                 ****** 
               
               
                 * description 
               
               
                 * ----------- 
               
               
                 * NSS module: 
               
               
                 * signal power before VAD 
               
               
                 * 
               
               
                 ******************************************************************* 
               
               
                 ******/ 
               
               
                 /*------------------------------------------------------------------ 
               
               
                 -----* 
               
             
          
           
               
                 * 
                 included files 
               
             
          
           
               
                 *------------------------------------------------------------------ 
               
               
                 -----*/ 
               
               
                 #include &lt;assert.h&gt; 
               
               
                 #include “private.h” 
               
               
                 /*------------------------------------------------------------------ 
               
               
                 -----* 
               
             
          
           
               
                 * 
                 private 
               
             
          
           
               
                 *------------------------------------------------------------------ 
               
               
                 -----*/ 
               
               
                 Word32 power(Word16 module, Word16 beta, Word16 thd, Word16 val); 
               
               
                 /*------------------------------------------------------------------ 
               
               
                 -----* 
               
             
          
           
               
                 * 
                 a_priori_signal_power 
               
             
          
           
               
                 *------------------------------------------------------------------ 
               
               
                 -----*/ 
               
               
                 void a_priori_signal_power 
               
               
                 ( 
               
             
          
           
               
                 /* IN */ 
                 Word16 *E, Word16 *internal_state, Word16 *max_noise, 
               
             
          
           
               
                 Word16 *long_term_noise, 
               
             
          
           
               
                   
                 Word16 *frequential_scale, 
               
               
                 /* IN&amp;OUT */ 
                 Word16 *alpha, 
               
               
                 /* OUT */ 
                 Word32 *P1, Word32 *P2 
               
               
                 ) 
               
               
                 { 
               
             
          
           
               
                   
                 int vad; 
               
               
                   
                 for(vad = 0; vad &lt; param.vad_number; vad++) { 
               
             
          
           
               
                   
                 int start = param.vads[vad].first_subband_for_power; 
               
               
                   
                 int stop = param.vads[vad].last_subband; 
               
               
                   
                 int subband; 
               
               
                   
                 int uniform_subband; 
               
               
                   
                 uniform_subband = 1; 
               
               
                   
                 for(subband = start; subband &lt;= stop; subband++) 
               
             
          
           
               
                   
                 if(param.subband_size[subband] != param.subband_size[start] 
               
             
          
           
               
                 ) 
               
             
          
           
               
                   
                 uniform_subband = 0; 
               
             
          
           
               
                   
                 P1[vad] = 0; move32(); 
               
               
                   
                 P2[vad] = 0; move32(); 
               
               
                   
                 test(); if(sub(internal_state[vad], NOISE) == 0) { 
               
             
          
           
               
                   
                 for(subband = start; subband &lt;= stop; subband++) { 
               
             
          
           
               
                   
                 Word32 pwr; 
               
               
                   
                 Word16 shift; 
               
               
                   
                 Word16 module; 
               
               
                   
                 Word16 alpha_long_term; 
               
               
                   
                 alpha_long_term = shr(max_noise[subband], 2); move16(); 
               
               
                   
                 test(); test(); if(sub(alpha_long_term, long_term_noise 
               
             
          
           
               
                 [subband]) &gt;= 0) { 
               
             
          
           
               
                   
                 alpha[subband] = 0×7fff; move16(); 
               
               
                   
                 alpha_long_term = long_term_noise[subband]; move16(); 
               
             
          
           
               
                   
                 } else if(sub(max_noise[subband], long_term_noise[subban 
               
             
          
           
               
                 d]) &lt; 0) { 
               
             
          
           
               
                   
                 alpha[subband] = 0×2000; move16(); 
               
               
                   
                 alpha_long_term = shr(long_term_noise[subband],2); move 
               
             
          
           
               
                 16(); 
               
             
          
           
               
                   
                 } else { 
               
             
          
           
               
                   
                 alpha[subband] = div_s(alpha_long_term, long_term_noise 
               
             
          
           
               
                 [subband]); move16(); 
               
             
          
           
               
                   
                 } 
               
               
                   
                 module = sub(E[subband], shl(alpha_long_term, 2)); move 
               
             
          
           
               
                 16(); 
               
             
          
           
               
                   
                 if(uniform_subband) { 
               
             
          
           
               
                   
                 shift = shl(frequential_scale[subband], 1); move16(); 
               
             
          
           
               
                   
                 } else { 
               
             
          
           
               
                   
                 shift = add(param.subband_shift[subband], shl(frequen 
               
             
          
           
               
                 tial_scale[subband], 1)); move16(); 
               
             
          
           
               
                   
                 } 
               
               
                   
                 pwr = power(module, param.beta_a_priori1, long_term_noise 
               
             
          
           
               
                 [subband], long_term_noise[subband]); 
               
             
          
           
               
                   
                 pwr = L_shr(pwr, shift); 
               
               
                   
                 P1[vad] = L_add(P1[vad], pwr); move32(); 
               
               
                   
                 pwr = power(module, param.beta_a_priori2, long_term_noise 
               
             
          
           
               
                 [subband], long_term_noise[subband]); 
               
             
          
           
               
                   
                 pwr = L_shr(pwr, shift); 
               
               
                   
                 P2[vad] = L_add(P2[vad], pwr); move32(); 
               
             
          
           
               
                   
                 } 
               
             
          
           
               
                   
                 } else { 
               
             
          
           
               
                   
                 for(subband = start; subband &lt;= stop; subband++) { 
               
             
          
           
               
                   
                 Word32 pwr; 
               
               
                   
                 Word16 shift; 
               
               
                   
                 Word16 module; 
               
               
                   
                 Word16 alpha_long_term; 
               
               
                   
                 alpha_long_term = mult(alpha[subband], long_term_noise 
               
             
          
           
               
                 [subband]); move16(); 
               
             
          
           
               
                   
                 module = sub{E[subband], shl(alpha_long_term, 2}); move 
               
             
          
           
               
                 16(); 
               
             
          
           
               
                   
                 if(uniform_subband) { 
               
             
          
           
               
                   
                 shift = sh1(frequential_scale[subband], 1); move16(); 
               
             
          
           
               
                   
                 } else { 
               
             
          
           
               
                   
                 shift = add(param.subband_shift[subband], sh1(frequen 
               
             
          
           
               
                 tial_scale[subband], 1)); move16(); 
               
             
          
           
               
                   
                 } 
               
               
                   
                 pwr = power(module, param.beta_a_priori1, long_term_noise 
               
             
          
           
               
                 [subband], E[subband]); 
               
             
          
           
               
                   
                 pwr = L_shr(pwr, shift); 
               
               
                   
                 P1[vad] = L_add(P1[vad], pwr); move32(); 
               
               
                   
                 pwr = power(module, param.beta_a_priori2, long_term_noise 
               
             
          
           
               
                 [subband], E[subband]); 
               
             
          
           
               
                   
                 pwr = L_shr(pwr, shift); 
               
               
                   
                 P2[vad] = L_add(P2[vad], pwr); move32(); 
               
             
          
           
               
                   
                 } 
               
             
          
           
               
                   
                 } 
               
             
          
           
               
                   
                 } 
               
             
          
           
               
                 } 
               
               
                 /*------------------------------------------------------------------ 
               
               
                 -----* 
               
             
          
           
               
                 * 
                 power 
               
             
          
           
               
                 *------------------------------------------------------------------ 
               
               
                 -----*/ 
               
               
                 Word32 power(Word16 module, Word16 beta, Word16 thd, Word16 val) 
               
               
                 { 
               
             
          
           
               
                   
                 Word32 power; 
               
               
                   
                 test(); if(sub(module, mult(beta, thd)) &lt;= 0) { 
               
             
          
           
               
                   
                 Word16 hi, lo; 
               
               
                   
                 power = L_mult(val, val); move32(); 
               
               
                   
                 L_Extract(power, &amp;hi, &amp;lo); 
               
               
                   
                 power = Mpy_32_16(hi, lo, beta); move32(); 
               
               
                   
                 L_Extract(power, &amp;hi, &amp;lo); 
               
               
                   
                 power = Mpy_32_16(hi, lo, beta); move32(); 
               
             
          
           
               
                   
                 } else { 
               
             
          
           
               
                   
                 power = L_mult(module, module); move32(); 
               
             
          
           
               
                   
                 } 
               
               
                   
                 return(power); 
               
             
          
           
               
                 } 
               
               
                   
               
             
          
         
       
     
     
       
         
               
             
               
             
               
               
             
               
             
               
               
             
               
             
               
               
             
               
             
               
               
             
               
             
               
               
             
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
             
               
               
             
               
             
               
               
             
               
               
             
               
             
               
               
             
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
             
               
               
             
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
               
             
               
             
           
               
                   
               
               
                 APPENDIX 2 
               
               
                   
               
             
             
               
                   
               
             
          
           
               
                 /******************************************************************* 
               
               
                 ****** 
               
               
                 * description 
               
               
                 * ----------- 
               
               
                 * NSS module: 
               
               
                 * VAD 
               
               
                 * 
               
               
                 ******************************************************************* 
               
               
                 ******/ 
               
               
                 /*------------------------------------------------------------------ 
               
               
                 -----* 
               
             
          
           
               
                 * 
                 included files 
               
             
          
           
               
                 *------------------------------------------------------------------ 
               
               
                 -----*/ 
               
               
                 #include &lt;assert.h&gt; 
               
               
                 #include “private-h” 
               
               
                 #include “simutool.h” 
               
               
                 /*------------------------------------------------------------------ 
               
               
                 -----* 
               
             
          
           
               
                 * 
                 private 
               
             
          
           
               
                 *------------------------------------------------------------------ 
               
               
                 -----*/ 
               
             
          
           
               
                 #define DELTA_P 
                 (1.6 * 1024) 
               
               
                 #define D_NOISE 
                 (.2 * 1024) 
               
               
                 #define D_SIGNAL 
                 (.2 * 1024) 
               
               
                 #define SNR_SIGNAL 
                 (.5 * 1024) 
               
               
                 #define SNR_NOISE 
                 (.2 * 1024) 
               
             
          
           
               
                 /*------------------------------------------------------------------ 
               
               
                 -----* 
               
             
          
           
               
                 * 
                 voice_activity_detector 
               
             
          
           
               
                 /*------------------------------------------------------------------ 
               
               
                 -----*/ 
               
               
                 void voice_activity_detector 
               
               
                 { 
               
             
          
           
               
                 /* IN */ 
                 Word32 *P1, Word32 *P2, Word16 frame_counter, 
               
               
                 /* IN&amp;OUT */ 
                 Word32 *P1s, Word32 *P2s, Word16 *internal_state, 
               
               
                 /* OUT */ 
                 Word16 *state 
               
             
          
           
               
                 } 
               
               
                 { 
               
             
          
           
               
                   
                 int vad; 
               
               
                   
                 int signal; 
               
               
                   
                 int noise; 
               
               
                   
                 signal = 0; move16(); 
               
               
                   
                 noise = 1; move16(); 
               
               
                   
                 for(vad = 0; vad &lt; param.vad_number; vad++) { 
               
             
          
           
               
                   
                 Word16 snr, d; 
               
               
                   
                 Word16 logP1, logP1s; 
               
               
                   
                 Word16 logP2, logP2s; 
               
               
                   
                 logP2 = logfix(P2[vad]); move16(); 
               
               
                   
                 logP2s = logfix(P2s[vad]); move16(); 
               
               
                   
                 test(); if(L_sub(P2[vad], P2s[vad]) &gt; 0) { 
               
             
          
           
               
                   
                 Word16 hi1, lo1; 
               
               
                   
                 Word16 hi2, lo2; 
               
               
                   
                 L_Extract(L_sub(P1[vad], P1s[vad]), &amp;hi1, &amp;lo1); 
               
               
                   
                 L_Extract(L_sub(P2[vad], P2s[vad]), &amp;hi2, &amp;lo2); 
               
               
                   
                 test(); if(sub(sub{logP2, logP2s}, DELTA_P) &lt; 0) { 
               
             
          
           
               
                   
                 P1s[vad] = L_add(P1s[vad], L_shr(Mpy_32_16(hi1, lo1, 0×6 
               
             
          
           
               
                 666), 4)); move32(); 
               
             
          
           
               
                   
                 P2s[vad] = L_add(P2s[vad], L_shr(Mpy_32_16(hi2, lo2, 0×6 
               
             
          
           
               
                 666), 4)); move32(); 
               
             
          
           
               
                   
                 } else { 
               
             
          
           
               
                   
                 P1s[vad] = L_add(P1s[vad], L_shr(Mpy_32_16(hi1, lo1, 0×6 
               
             
          
           
               
                 8db), 13)); move32(); 
               
             
          
           
               
                   
                 P2s[vad] = L_add(P2s[vad], L_shr(Mpy_32_16(hi2, lo2, 0×6 
               
             
          
           
               
                 8db), 13)); move32(); 
               
             
          
           
               
                   
                 } 
               
             
          
           
               
                   
                 } else { 
               
             
          
           
               
                   
                 P1s[vad] = P1[vad]; move32(); 
               
               
                   
                 P2s[vad] = P2[vad]; move32(); 
               
             
          
           
               
                   
                 } 
               
               
                   
                 logP1 = logfix(P1[vad]); move16(); 
               
               
                   
                 logP1s = logfix(P1s[vad]); move16(); 
               
               
                   
                 d = sub(logP1, logP2); move16(); 
               
               
                   
                 snr = sub(logP1, logP1s); move16(); 
               
               
                   
                 ProbeFix16(“d”, &amp;d, 1, 1.); 
               
               
                   
                 ProbeFix16(“_snr”, &amp;snr, 1, 1.); 
               
             
          
           
               
                 { 
               
             
          
           
               
                   
                 Word16 pp; 
               
               
                   
                 ProbeFix16(“p1”, &amp;logP1, 1, 1.); 
               
               
                   
                 ProbeFix16(“p2”, &amp;logP2, 1, 1.); 
               
               
                   
                 ProbeFix16(“p1s”, &amp;logP1s, 1, 1.); 
               
               
                   
                 ProbeFix16(“p2s”, &amp;logP2s, 1, 1.); 
               
               
                   
                 pp = logP2 − logP2s; 
               
               
                   
                 ProbeFix16(“dp”, &amp;pp, 1, 1.); 
               
             
          
           
               
                 } 
               
             
          
           
               
                   
                 test(); if(sub(internal_state[vad], NOISE) == 0) 
               
             
          
           
               
                   
                 goto LABEL_NOISE; 
               
             
          
           
               
                   
                 test(); if(sub(internal_state[vad], ASCENT) == 0) 
               
             
          
           
               
                   
                 goto LABEL_ASCENT; 
               
             
          
           
               
                   
                 test(); if(sub(internal_state[vad], SIGNAL) == 0) 
               
             
          
           
               
                   
                 goto LABEL_SIGNAL; 
               
             
          
           
               
                   
                 test(); if(sub(internal_state[vad], DESCENT) == 0) 
               
             
          
           
               
                   
                 goto LABEL_DESCENT; 
               
             
          
           
               
                   
                 LABEL_NOISE: 
               
               
                   
                 test(); if(sub(d, D_NOISE) &lt; 0) { 
               
             
          
           
               
                   
                 internal_state[vad] = ASCENT; move16(); 
               
             
          
           
               
                   
                 } 
               
               
                   
                 goto LABEL_END_VAD; 
               
               
                   
                 LABEL_ASCENT: 
               
               
                   
                 test(); if(sub(d, D_SIGNAL) &lt; 0) { 
               
             
          
           
               
                   
                 internal_state[vad] = SIGNAL; move16(); 
               
               
                   
                 signal = 1; move16(); 
               
               
                   
                 noise = 0; move16(); 
               
             
          
           
               
                   
                 } else { 
               
             
          
           
               
                   
                 internal_state[vad] = NOISE; move16(); 
               
             
          
           
               
                   
                 } 
               
               
                   
                 goto LABEL_END_VAD; 
               
               
                   
                 LABEL_SIGNAL: 
               
               
                   
                 test(); if(sub(snr, SNR_SIGNAL) &lt; 0) { 
               
             
          
           
               
                   
                 internal_state[vad] = DESCENT; move16(); 
               
             
          
           
               
                   
                 } else { 
               
             
          
           
               
                   
                 signal = 1; move16(); 
               
             
          
           
               
                   
                 } 
               
               
                   
                 noise = 0; move16(); 
               
               
                   
                 goto LABEL_END_VAD; 
               
               
                   
                 LABEL_DESCENT: 
               
               
                   
                 test(); if(sub(snr, SNR_NOISE) &lt; 0) { 
               
             
          
           
               
                   
                 internal_state[vad] = NOISE; move16(); 
               
             
          
           
               
                   
                 } else { 
               
             
          
           
               
                   
                 internal_state[vad] = SIGNAL; move16(); 
               
               
                   
                 signal = 1; move16(); 
               
               
                   
                 noise = 0; move16(); 
               
             
          
           
               
                   
                 } 
               
               
                   
                 goto LABEL_END_VAD; 
               
               
                   
                 LABEL_END_VAD: 
               
               
                   
                 ; 
               
             
          
           
               
                 } 
               
               
                 *state = TRANSITION; move16(); 
               
               
                 test(); test(); if(signal != 0) { 
               
             
          
           
               
                   
                 test(); if(sub(frame_counter, param.init_frame_number) &gt;= 0) { 
               
             
          
           
               
                   
                 for(vad = 0; vad &lt; param.vad_number; vad++) { 
               
             
          
           
               
                   
                 internal_state[vad] = SIGNAL; move16(); 
               
             
          
           
               
                   
                 } 
               
               
                   
                 *state = SIGNAL; move16(); 
               
             
          
           
               
                   
                 } 
               
               
                   
                 } else if(noise != 0) { 
               
             
          
           
               
                   
                 *state = NOISE; move16(); 
               
             
          
           
               
                   
                 } 
               
             
          
           
               
                 }