Abstract:
For various values of an integer p, short-term discrete Fourier transforms X(p,k) and X.sub.τ (p,k) of the audio signal shifted by pR samples and of the audio signal shifted by pR+τ samples are respectively calculated, R denoting a predetermined integer and τ denoting a time shift between the echo and the portion of signal which gave rise to it, a corrected signal is calculated in the frequency domain by nonlinear transformation of X(p,k) taking account, for the various values of the frequency index k, of a value representative of an attenuation factor relating to the echo and of X.sub.τ (p,k), and a short-term component of a corrected signal is calculated in the time domain by short-term inverse Fourier transform of the corrected signal in the frequency domain. The corrected signal in the time domain is then formed by weighted summation of its short-term components. Application to the digital reprocessing of analog recordings.

Description:
BACKGROUND OF THE INVENTION 
     The invention relates to the field of the restoration of noise-affected audio recordings. It is of relevance to signals which have been recorded on any medium (magnetic tape, vinyl record, cylinder) and then sampled and stored on a computer medium. 
     Pre- and post-echoes constitute a defect commonly encountered in this type of signal. Pre- or post-echoes are very frequently encountered in analog recordings on a magnetic medium (tape, cassettes) and also on records, when a passage in which the signal is of low sound level precedes or follows a passage of high sound level. The presence, a few moments before a signal of high level, of a greatly attenuated copy of this signal, clearly audible if the useful signal at this moment is of low level, is referred to as pre-echo. Similarly, the presence a few moments after a signal of high level of a greatly attenuated copy of this signal, which may be audible if the useful signal is of low level at this moment, is referred to as post-echo. 
     Pre- and post-echoes stem, in the case of magnetic tapes, from the magnetization, through the backing of the tape, of one turn by the adjoining turns. In the case of recordings on vinyl record, the phenomenon stems from plastic modification of a groove through the engraving of the adjacent grooves. 
     In all of what follows, the term &#34;echo&#34; will denote either a pre-echo or a post-echo which it is desired to eliminate from an audio recording. 
     In the context of telecommunications, the rather similar problem of echo cancellation arises, the echo now being due to the round trip time for the path separating the talker from his opposite party across the communication system. However, the techniques used in the context of communications allow the echo to be attenuated only if the transmission channel can be identified in the absence of any useful signal, this not being the case in the context of audio recordings. Indeed, in order to apply the techniques used in communication, it would be necessary for the echo to be able to be heard entirely on its own, that is to say in the absence of any useful signal. In the context of audio recordings, the echoes are troublesome precisely when they are heard in the presence of a useful signal which should not be impaired. 
     The purpose of the present invention is to eliminate or greatly attenuate the pre-echoes and post-echoes affecting an audio recording, in the presence or absence of any useful signal, and to do so without impairing the latter. 
     SUMMARY OF THE INVENTION 
     The invention thus proposes a process for eliminating, from a first segment of a digitized audio signal, an attenuated replica of a portion of a second segment of the digitized audio signal, said portion of the second segment exhibiting a time shift with respect to said replica, this process comprising the following steps: 
     determining a value representative of an attenuation factor between said portion of the second segment and said replica for a plurality of values of a frequency index k; 
     for a plurality of values of an integer p, calculating respective short-term discrete Fourier transforms X(p,k) and Xτ(p,k) of the audio signal shifted by pR samples and of the audio signal shifted by pR+τ samples, R denoting a predetermined integer at most equal to the length T of said short-term discrete Fourier transforms and τ denoting said time shift expressed as a number of samples, calculating a corrected signal in the frequency domain by nonlinear transformation of the short-term Fourier transform X(p,k) taking account, for each of said plurality of values of the frequency index k, of the value representative of the attenuation factor and of the short-term Fourier transform X.sub.τ (p,k), and calculating a short-term component of a corrected signal in the time domain by short-term inverse Fourier transform of the corrected signal in the frequency domain; and 
     forming the corrected signal in the time domain by weighted summation of the short-term components thereof. 
     The nonlinear transformation used to calculate the corrected signal in the frequency domain Y(p,k) is for example of the form: ##EQU1## g(k) denoting the value representative of the attenuation factor for the frequency index k, f(.) denoting a decreasing real function, and |.| representing the modulus of a complex number. 
     This process uses a simple model of echo production: the echo (pre- or post-) is simply an attenuated and time-shifted version of the signal of which it is the replica. The nonlinear attenuation technique based on the use of the Fourier transform exhibits the following advantages in particular: it makes it possible to obtain very good attenuation factors even in the presence of errors in the estimate of the delay τ; it makes it possible to over-estimate the attenuation factor and to obtain a yet greater reduction in the echo; it does not impair the useful signal. 
     When the time shift is not known precisely a priori, its prior determination advantageously includes the following steps: 
     performing a discrete Fourier transform, of predetermined length N, of the first segment of the digitized audio signal in order to obtain a first function of the frequency domain; 
     performing a discrete Fourier transform of length N of the second segment of the digitized audio signal in order to obtain a second function of the frequency domain; 
     calculating a truncated correlation function between the first and second segments by inverse discrete Fourier transform of length N of a third function of the frequency domain taking the value U(m) *  ·V f  (m) for each frequency index m for which |U(m)|&lt;g max · |V f  (m)| and the value 0 for the other frequency indices m, U(m) and V f  (m) respectively denoting the values for the frequency index m of the first and second functions of the frequency domain, g max  denoting a predetermined coefficient, and (.) *  representing the complex conjugate; and 
     calculating the time shift from the value of an integer for which the modulus of said truncated correlation function exhibits a maximum. 
     It is thus possible to solve the problems raised by the presence of useful signals during the step for estimating the shift, by virtue of a method of estimation by filtering/correlation in the frequency domain. 
     The determination of the value representative of the attenuation factor advantageously includes the following steps: 
     obtaining an estimate of the attenuation factor; and 
     increasing by a predetermined quantity said estimate in order to yield said representative value of the attenuation factor. 
     The estimate of the attenuation factor may be dependent on or independent of the frequency index k. The obtaining of this estimate can include the following steps: 
     for a plurality of values of an integer q, calculating respective short-term discrete Fourier transforms of length T U(q,k) and V(q,k) of the audio signal shifted by qR samples belonging to the first segment and of the audio signal shifted by qR+τ samples belonging to the second segment; and 
     calculating the estimate of the attenuation factor via: ##EQU2## or, if the estimate g is independent of the frequency index k, via: ##EQU3## where Q=1+E (n f  -n d  -T)/R! with n f  -n d  denoting the length of the first segment and E .! representing the integer part. 
     The determination of the attenuation thus takes into account the method used in the subsequent echo elimination step. The attenuation factor is estimated by a method of minimization of the least squares type in the frequency domain. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIGS. 1 and 2 are timing diagrams of signals used in an example implementation of the process according to the invention, in the case of a pre-echo in FIG. 1 and of a post-echo in FIG. 2. 
     FIGS. 3 to 5 are flow charts respectively of procedures for determining the time shift, for determining the value representative of the attenuation factor and for eliminating the echo, which can be used for the implementation of the process. 
     FIG. 6 is a schematic representation of one part of the echo elimination procedure represented in FIG. 5. 
    
    
     DESCRIPTION OF PREFERRED EMBODIMENTS 
     FIGS. 1 and 2 illustrate a section of an audio signal x(n) obtained by sampling and digitizing a recording affected by echoes. The sampling frequency F e  is for example of 44.1 kHz. The signal x(n) is available in the form of a computer file which can be accessed by a computer programmed to implement the process according to the invention. 
     It is assumed that a first segment A containing an echo E pre , E post  and a second segment B, one portion O of which is the &#34;original&#34; of which this echo is a replica, have already been located. Such locating is readily performed aurally. Since the unwanted echo is clearly audible, the operator can pinpoint instants (samples n d  and n f ) bracketing the echo, which will constitute the start and end of the segment A. Having picked out the echo, the operator can recognize and locate the original O in the same way. It is also possible to perform automatic locating of the segments in which echoes and their originals are liable to be found, for example by analysing the energy levels of the signal so as to mark the soft passages preceded or followed by loud passages. The locating of the segments need not be precise in order for the process according to the invention to work. 
     The locating of the segments A and B makes it possible to furnish the following initial data: start and end samples n d , n f  of the first segment A, minimum and maximum values τ min , τ max  of the time shift between the echo and the original, expressed in terms of number of samples. The start and end samples of the second segment B correspond to n d  +τ min  and n f  +τ max . The actual shift τ is then such that 0&lt;τ min  &lt;τ&lt;τ max  in the case of a pre-echo (FIG. 1), and τ min  &lt;τ&lt;τ max  &lt;0 in the case of a post-echo (FIG. 2). 
     When the shift τ is not known a priori (the case of a recording on magnetic tape for example), the first phase of the process according to the invention consists in determining it. FIG. 3 shows a procedure which can be used for this purpose. The first two steps 10, 11 consist in transferring the signals of the first and second segments A, B to a time window N samples long over which their discrete Fourier transforms will be calculated in step 12. For optimal implementation by fast Fourier transform (FFT), it is expedient to take the length N in the form of a power of 2, for example N=2 a , with a=1+E log 2  (n f  -n d  +τ max  -τ min )! where E .! denotes the integer part, so that N is greater than or equal to the lengths n f  -n d  and n f  -n d  +τ max  -τ min  of the segments A and B. 
     Thus, the signals u and v f  illustrated in FIGS. 1 and 2 are defined in steps 10 and 11: 
     
         u(n)=x(n+n.sub.d)if 0≦n&lt;n.sub.f -n.sub.d 
    
     
         u(n)=0if n.sub.f -n.sub.d ≦n&lt;N 
    
     
         v.sub.f (n)=x(n+n.sub.d +τ.sub.min)if 0≦n&lt;n.sub.f -n.sub.d +τ.sub.man -τ.sub.min 
    
     
         v.sub.f (n)=0if n.sub.f -n.sub.d +τ.sub.max -τ.sub.min ≦n&lt;N 
    
     In step 12, a conventional FFT algorithm is used to calculate the discrete Fourier transforms of length N U(m) and V f  (m) of the first and second segments A, B, that is to say, for 0≦m&lt;N: ##EQU4## 
     The next step 13 is a thresholding operation in the frequency domain. In the frequency zones in which |U(m)| is relatively high (that is to say greater than the maximum level at which it would be expected to be found having regard to an envisageable maximum attenuation and to the level of the signal |V f  (m)| which generated the echo), the useful signal is regarded as of greater energy than the echo. This frequency zone is therefore not to be taken into account in estimating the time shift since it is not necessarily representative of the echo signal. The operation carried out in step 13, which is comparable to a temporal filtering separating the echo from the useful signal, is then, for 0≦m&lt;N: ##EQU5## where g max  represents a predetermined coefficient equal to a maximum expected attenuation factor. A typical order of magnitude for the choice of g max  corresponds to an attenuation of the order of -30 dB. 
     In step 14 the inverse discrete Fourier transform of the function W(m) of the frequency domain is performed in order to obtain a truncated correlation function c(n) between the first and second segments A, B. This correlation function is truncated in the sense that the function W(m) has been set to zero in step 13 for those frequency zones in which the signal of the first segment is regarded as too energetic relative to that of the second segment as the representative of an echo. The inverse discrete Fourier transform of length N can also be performed in step 14 by an FFT algorithm, so as to obtain, for 0≦n&lt;N: ##EQU6## 
     In step 15, the integer n 1  is sought for which the modulus of the truncated correlation function c(n) is a maximum in the interval 0≦n&lt;τ max  -τ min . The function c(n) is generally real, and the maximum of its modulus generally corresponds to a positive real, so that it is possible to dispense with the calculation of the moduli |c(n)|. The actual time shift τ is then obtained in step 16 from the value of the integer n 1  obtained in step 15. With the conventions adopted in the example embodiment described, the shift τ is simply obtained by τ=n l  +τ min . 
     This manner of estimating the time shift τ by means of a correlation calculation involving filtering in the frequency domain allows reliable estimation through the use of information available a priori about the maximum value g max  of the attenuation factor. 
     When the time shift τ is known a priori, the estimation procedure illustrated by FIG. 3 may be dispensed with. This is the case for example for an audio frequency signal stemming from a recording on a ν rpm vinyl record: the shift τ can then be obtained in an elementary way via τ=E F e  /(ν/60)!. 
     The second phase of the process according to the invention consists in determining a value g representative of the attenuation factor between the original O and its echo E pre  or E post . Considered below, with reference to FIG. 4, is the case of a single value g independent of frequency to represent the attenuation factor. 
     The obtaining of the value g includes firstly a calculation of an estimate g of the attenuation factor (steps 20 to 22), and then a step 23 of overestimating the estimated attenuation factor. In step 23 it is thus possible to take g=μ.g, the predetermined coefficient μ corresponding for example to a gain of 3 or 5 dB. 
     Short-term Fourier transforms T samples long are used for estimation 20-22 of the attenuation factor g. An analysis window L samples long is defined, corresponding for example to a duration of the order of 40 ms: L=F e  ×0.04. This duration can be adjusted depending on the type of audio signal processed. The analysis window is conventionally associated with a windowing function h(n), for example a rectangular function or alternatively a Hamming function such that: 
     
         h(n)= 1-cos(2πn/L)!/2for 0≦n&lt;L 
    
     
         h(n)=0for n&lt;0 and n≧L 
    
     The length T of the short-term Fourier transform can be taken equal to the length L of the analysis window. For optimal implementation via an FFT algorithm, it is expedient to take T in the form of a power of 2: T=2 b  with b=1+E log 2  L!. From the value of T, an increment factor R is defined, equal to at most T, for example R=T/4. 
     The first step 20 of the estimation of the attenuation consists in temporally aligning the first segment A containing the echo E pre , E post  with the corresponding portion of the second segment B containing the original O. A shifted signal v(n) is thus defined by: 
     
         v(n)=x(n+n.sub.d +τ)for 0≦n&lt;n.sub.f-n.sub.d 
    
     τ being the previously determined value of the time shift (τ&lt;0 for a pre-echo and τ&gt;0 for a post-echo). It may be seen in FIGS. 1 and 2 that, in the signals u(n) and v(n), the echo and its original are temporally aligned. 
     The short-term Fourier transforms are calculated in step 21. More precisely, Q pairs of short-term Fourier transforms are calculated, Q being the integer defined by Q=1+E (n f  -n d  -T)/R!. Thus, for each integer q such that 0≦q&lt;Q, the FFT algorithm makes it possible to obtain two functions U(q,k) and V(q,k) of the frequency domain (0≦k&lt;T): ##EQU7## 
     The estimate g is then calculated in step 22 by applying formula (2). It is noted that this formula takes account only of the moduli of the short-term Fourier transforms U(q,k) and V(q,k). 
     If it is chosen to model the echo by a frequency-dependent attenuation factor, the flow chart of FIG. 4 can be modified in a straightforward way as regards steps 22 and 23. In the modified step 22, T estimates of the attenuation factor g(k) dependent on the frequency index k (0≦k&lt;T) are calculated according to formula (1); and in the modified step 23, we take g(k)=μ.g(k) for 0≦k&lt;T (it would also be possible to take a frequency-dependent overestimation factor μ). 
     The last phase of the process consists in the elimination proper of the echo, for example according to the nonlinear spectral subtraction procedure illustrated in FIG. 5. 
     Firstly the zone to be processed is defined; as previously, it may be the time interval n d  ≦n&lt;n f , but it may also be longer (possibly the whole recording if the attenuation factor and the time shift are regarded as not changing over time). This zone is delimited by the samples numbered n s  and n e . The integer P is then defined by P=1+E n e  -n s  -T)/R!. 
     In step 30, P pairs of short-term Fourier transforms X(p,k), X.sub.τ (p,k), of length T, are calculated. For each integer P such that 0≦p&lt;T, an FFT algorithm makes it possible to obtain the two functions of the frequency index k (0≦k&lt;T): ##EQU8## 
     In step 31, a nonlinear transformation is applied to the short-term Fourier transform X(p,k) to obtain a corrected signal in the frequency domain Y(p,k), and this is done for each integer p such that 0≦p&lt;P. This nonlinear transformation takes account, for the various values of the frequency index k, of the value g(k) or g representative of the attenuation factor and of the short-term Fourier transform X.sub.τ (p,k). More precisely, the corrected signal Y(p,k) is expressed in the form: ##EQU9## f being a positive, decreasing real function which introduces the nonlinearity. Such a transformation affects the modulus but not the argument of X(p,k). Step 31 represented in FIG. 5 corresponds to the case in which the attenuation factor is chosen to be independent of frequency (g(k)=g=Const) and to the choice f(z)=max{0, 1-z}. It will be noted that various other forms could be adopted for the function f, for example f(z)=(max{0, 1-z 2  }) 1/2 . 
     In step 32, P short-term components y(p,n) of a corrected signal are formed in the time domain by short-term inverse discrete Fourier transform of the corrected signals Y(p,k) in the frequency domain. For 0≦p&lt;P, the FFT algorithm thus makes it possible to obtain the signal y(p,n) of time index n (0≦n&lt;T): ##EQU10## 
     It is noted that steps 30 to 32, represented separately in FIG. 5, may be executed within one and the same loop over the integer p ranging from 0 to P-1. The operations corresponding to an iteration within this loop are illustrated in block diagram form in FIG. 6. Blocks 41 and 42 represent the short-term Fourier transforms (STFT) of the signal x(n+pR) and of the same signal shifted by τ samples at 40 (step 30 of FIG. 5 for one value of p). The multiplier block 43 applies the factor g to the modulus of Xτ(p,k), and the result is subtracted from the modulus of X(p,k) by the subtractor block 44. Block 46 represents the short-term inverse Fourier transform (ISTFT) applied to the corrected complex signal Y(p,k) whose argument is the same as that of X(p,k) and whose modulus is the greater, delivered by block 45, of 0 and the output from the subtractor block 46. Blocks 43 to 45 correspond to step 31 of FIG. 5 for one value of p, and block 46 to step 32. 
     In the final step 33, the corrected signal is formed in the time domain y(n) by weighted summation of its short-term components y(p,n). This is an overlap sum (overlap-add) which can be expressed, for T/2≦n&lt;n e  -n s  -T/2, by: ##EQU11## 
     In this expression, w(n) denotes a synthesis windowing function of length L (that is to say zero outside the interval 0≦n&lt;L), such as a rectangular or Hamming function. 
     The signal y(n+n s ) is the restored version of the signal x(n+n s ), in which the echo has been eliminated or at least substantially attenuated. 
     This echo attenuation procedure using a nonlinear short-term spectral subtraction technique has the advantage of working even if the shift τ is estimated only approximately, and even if the attenuation factor is overestimated. Overestimating g (step 23) makes it possible to further improve the attenuation. 
     Multiple pre-echoes or post-echoes may be observed in certain rare cases. For example, this is the case if one turn of a magnetic tape corrupts several neighbouring turns. Such a situation can be handled by executing several times in succession the routine corresponding to FIGS. 4 and 5, once for each individual shift. It is also possible to handle such a situation in a single iteration. In the example in which there are two shifts τ and 2τ, it is possible to obtain two values (or two sets of values) g.sub.τ  and g 2 τ  in steps 22, 23, provided that the short-term Fourier transforms V&#39;(q,k) of the doubly shifted signal v&#39;(n)=x(n+n d  +2τ) were calculated on completion of steps 20 and 21. The corrected signal in the frequency domain Y(p,k) is then obtained, in the modified step 31, via ##EQU12## obtained in the modified step 30 and, for example, f&#39;(z,z&#39;)=max{0, 1-z-z&#39;}. 
     In the case in which the time shift is constant (for example for a 33 rpm record, but not for a magnetic tape), and in which the attenuation factor is also regarded as being constant over time, the entire signal can be processed without impairing the useful signal, that is to say n s  and n e  can correspond to the start and end of the complete recording.