a and 1b are block and flow diagrams for computing inverse linear and non-linear transfer functions for pre-compensating an audio signal for playback on an audio reproduction device;
a and 3b are a diagram illustrating the frequency-domain filtering and reconstruction of the snapshots and
a-4d are diagrams illustrating the parallel application of a Wavelet transform to snapshots of the forward linear transfer function;
a and 5b are plots of the noise reduced forward linear transfer function;
a and 9b are block diagrams of an audio system configured to compensate linear and non-linear distortion of the speaker;
a and 10b are flow diagrams for compensating an audio signal for linear and non-linear distortion during playback;
a and 12b are plots of the speaker's impulse response before and after compensation, respectively.
The present invention provides efficient, robust and precise filtering techniques for compensating linear and non-linear distortion of an audio transducer such as a speaker, amplified broadcast antenna or perhaps a microphone. These techniques include both a method of characterizing the audio transducer to compute the inverse transfer functions and a method of implementing those inverse transfer functions for reproduction during playback, broadcast or recording. In a preferred embodiment, the inverse transfer functions are extracted using time domain calculations such as provided by linear and non-linear neural networks, which more accurately represent the properties of audio signals and the audio transducer than conventional frequency domain or modeling based approaches. Although the preferred approach is to compensate for both linear and non-linear distortion, the neural network filtering techniques may be applied independently. The same techniques may also be adapted to compensate for the distortion of the speaker and listening, broadcast or recording environment.
As used herein, the term “audio transducer” refers to any device that is actuated by power from one system and supplies power in another form to another system in which one form of the power is electrical and the other is acoustic or electrical, and which reproduces an audio signal. The transducer may be an output transducer such as a speaker or amplified antenna or an input transducer such as a microphone. An exemplary embodiment of the invention will be now be described for a loudspeaker that converts an electrical input audio signal into an audible acoustic signal.
The test set-up for characterizing the distortion properties of the speaker and the method of computing the inverse transfer functions are illustrated in
The techniques of the present invention will characterize and compensate for any sources of distortion in the signal path from playback to recording. Accordingly, a high quality microphone is used such that any distortion induced by the microphone is negligible. Note, if the transducer under test were a microphone, a high quality speaker would be used to negate unwanted sources of distortion. To characterize only the speaker, the “listening environment” should be configured to minimize any reflections or other sources of distortion. Alternately, the same techniques can be used to characterize the speaker in the consumer's home theater, for example. In the latter case, the consumer's receiver or speaker system would have to be configured to perform the test, analyze the data and configure the speaker for playback.
The same test set-up is used to characterize both the linear and non-linear distortion properties of the speaker. The computer generates different audio test signals 18 and performs a different analysis on the recorded audio signal 20. The spectral content of the linear test signal should cover the full analyzed frequency range and full range of amplitudes for the speaker. An exemplary test signal consists of two series of linear, full-frequency chirps: (a) 700 ms linear increase in frequency from 0 Hz to 24 kHz, 700 ms linear decrease in frequency down to 0 Hz, then repeat, and (b) 300 ms linear increase in frequency from 0 Hz to 24 kHz, 300 ms linear decrease in frequency down to 0 Hz, then repeat. Both kinds of chirps are present in the signal at the same time spanning the full duration of the signal. Chirps are modulated by amplitude in such a way to produce sharp attacks and slow decay in time domain. The length of each period of amplitude modulation is arbitrary and ranges approximately from 0 ms to 150 ms. The nonlinear test signal should preferably contain tones and noise of various amplitudes and periods of silence. There should be enough variability in the signal for the successful training of the neural network. An exemplary nonlinear test signal is constructed in a similar way but with different time parameters: (a) 4 sec linear increase in frequency from 0 Hz to 24 kHz, no decrease in frequency, next period of chirp starts again from 0 Hz, and (b) 250 ms linear increase in frequency from 0 Hz to 24 kHz, 250 ms linear decrease in frequency down to 0 Hz. Chirps in this signal are modulated by arbitrary amplitude change. The rate of amplitude can be as fast as 0 to full scale in 8 ms. Both linear and nonlinear test signals preferably contain some sort of marker which can be used for synchronization purposes (e.g. a single full-scale peak), but this is not mandatory.
As described in
The computer executes a synchronized playback and recording of a non-linear test signal (step 36). This step can be performed after the linear transfer function is extracted or off-line at the same time as the linear test signal is recorded. In the preferred embodiment, the FIR filter is applied to the recorded signal to remove the linear distortion component (step 38). Although not always necessary, extensive testing has shown that the removal of the linear distortion greatly improves the characterization, hence inverse transfer function of the non-linear distortion. The computer subtracts the test signal from the filtered signal to provide an estimate of only the non-linear distortion component (step 40). The computer then processes the non-linear distortion signal to extract the non-linear transfer function (step 42) and to compute the inverse non-linear transfer function (step 44). Both transfer functions are preferably computed using time-domain calculations.
Our simulations and testing have demonstrated that the extraction of inverse transfer functions for both the linear and non-linear distortion components improves the characterization of the speaker and the distortion compensation thereof. Furthermore, the performance of the non-linear portion of the solution is greatly improved by removing the typically dominant linear distortion prior to characterization. Lastly, the use of time-domain calculations to compute the inverse transfer functions also improves performance.
An exemplary embodiment for extracting the forward and inverse linear transfer functions is illustrated in
The computer averages multiple periods of the recorded test signal to reduce noise from random sources (step 50). The computer then divides the period of the test and recorded signal into as many segments M as possible subject to the constraint that each segment must exceed the duration of the speaker's impulse response (step 52). If this constraint is not met, then parts of the speaker's impulse response will overlap and it will be impossible to separate them. The computer computes the spectra of the test and recorded segments by, for example, performing an FFT (step 54) and then forms a ratio of the recorded spectra to the corresponding test spectra to form M ‘snapshots’ in the frequency domain of the speaker impulse response (step 56). The computer filters each spectral line across the M snapshots to select subsets of N<M snapshots all having similar amplitude response for that spectral line (step 58). This “Best-N Averaging” is based on our knowledge that in typical audio signals in noisy environments there are usually a set of snapshots where correspondent spectral lines are almost unaffected by ‘tonal’ noise. Consequently this process actually avoids noise instead of just reducing it. In an exemplary embodiment, the Best-N Averaging algorithm is (for each spectral line):
1. Calculate the average for the spectral line over the available snapshots.
2. If there are only N snapshots—stop.
3. If there are >N snapshots—find the snapshot where the value of the spectral line is farthest from the calculated average and remove the snapshot from further calculations.
4. Continue from step 1.
The output of the process for each spectral line is the subset of N ‘snapshots’ with the best spectral line values. The computer then maps the spectral lines from the snapshots enumerated in each subset to reconstruct N snapshots (step 60).
A simple example is provided in
This process can be represented algorithmically as follows:
S(i,j)=FFT(Recorded Segment (i,j))/FFT(Test Segment (i,j)) where S( ) is a snapshot 70 and I=1−M segments and j=1−P spectral lines;
Line(j,k)=F(S(i,j)) where F( ) is the Best-4 Avg algorithm and k=1 to N; and
RS(k,j)=Line(j,k) where RS( ) is the reconstructed snapshot.
The results of a Best-4 Averaging are shown in
The computer performs an inverse FFT on each of the N frequency-domain snapshots to provide N time-domain snapshots (step 90). At this point, the N time-domain snapshots could be simply averaged together to output the forward linear transfer function. However, in the exemplary embodiment, an additional Wavelet filtering process (step 92) is performed on the N snapshots to remove noise that can be ‘localized’ in the multiple time-scales in the time/frequency representation of the Wavelet transform. Wavelet Filtering also results in a minimal amount of ‘ringing’ in the filtered result.
One approach is to perform a single Wavelet transform on the averaged time-domain snapshot, pass the ‘approximation’ coefficients and threshold the ‘detail’ coefficients to zero for a predetermined energy level, and then inverse transform to extract the forward linear transfer function. This approach does remove the noise commonly found in the ‘detail’ coefficients at the different decomposition levels of the Wavelet transform.
A better approach as shown in
The effectiveness of the noise reduction techniques is illustrated in
To preserve the accuracy of the forward linear transfer function, we need a method of inverting the transfer function to synthesize the FIR filter that can flexibly adapt to the time and frequency domain properties of the speaker and its impulse response. To accomplish this we selected a Neural Network. The use of a linear activation function constrains the selection of the Neural Network architectures to be linear. The weights of the linear neural network are trained using the forward linear transfer function 100 as the input and a target impulse signal as the target to provide an estimate of the speaker's inverse linear transfer function A( ) (step 104). The error function can be constrained to provide either desired time-domain constraints or frequency-domain characteristics. Once trained, the weights from the nodes are mapped to the coefficients of the linear FIR filter (step 106).
Many known types of neural networks are suitable. The current state of art in neural network architectures and training algorithms makes a feedforward network (a layered network in which each layer only receives inputs from previous layers) a good candidate. Existing training algorithms provide stable results and a good generalization.
As shown in
An offline supervised resilient back propagation training algorithm tunes the weights with which the time-domain forward linear transfer function is passed to the neuron. In supervised learning, to measure neural network performance in training process, the output of the neuron is compared to a target value. To invert the forward transfer function, the target sequence contains a single “impulse” where all the target values Ti are zero except one which is set to 1 (unity gain). Comparison is performed by the means of mathematical metric such as mean square error (MSE). The standard MSE formula is:
where N is the number of output neurons, Oi are the neuron output values and Ti are the sequence of target values. The training algorithm “back propagates” the errors through the network to adjust all of weights. The process is repeated until the MSE is minimized and the weights have converged to a solution. These weights are then mapped to the FIR filter.
Because the neural network performs a time-domain calculation, i.e. the output and target values are in the time domain, time-domain constraints can be applied to the error function to improve the properties of the inverse transfer function. For example, pre-echo is a psychoacoustic phenomenon where an unusually noticeable artifact is heard in a sound recording from the energy of time domain transients smeared backwards in time. By controlling it's duration and amplitude we can lower it's audibility, or make it completely inaudible due to existence of ‘forward temporal masking’.
One way to compensate for pre-echo is weight the error function as a function of time. For example, a constrained MSE is given by
We can assume that times t<0 correspond to pre-echoes and the error at t<0 should be weighted more heavily. For example, D(−inf:−1)=100 and D(0:inf)=1. The back propagation algorithm will then optimize the neuron weights Wi to minimize this weighted MSEw function. The weights may be tuned to follow temporal masking curves, and there are other methods to impose constraints on error measure function besides individual errors weighting (e.g. constraining the combined error over a selected range).
An alternate example of constraining the combined error over a selected range A:B is given:
SSEAB—Sum squared error over some range A:B;
Oi—network output values;
Ti—target values;
Lim—some predefined limit;
Err—final error (or metric) value.
Although the neural network is a time-domain calculation, a frequency-domain constraint can be placed on the network to ensure desirable frequency characteristics. For example, “over-amplification” can occur in the inverse transfer function at frequencies where the speaker response has deep notches. Over-amplification will cause ringing in the time-domain response. To prevent over-amplification the frequency envelope of the target impulse, which is originally equal to 1 for all frequencies, is attenuated at the frequencies where original speaker response has deep notches so that the maximum amplitude difference between the original and target is below some db limit. The constrained MSE is given by:
T′—constrained target vector;
T—original target vector;
O—network output vector;
F( )—denotes Fourier transform;
F−1( )—denotes inverse Fourier transform;
Aj—target attenuation coefficients;
N—number of samples in target vector.
Alternately, the contributions of errors to the error function can be spectrally weighted. One way to impose such constraints is to compute the individual errors, perform an FFT on those individual errors and then compare the result to zero using some metric e.g. placing more weight on high-frequency components. For example a constrained error function is given by:
Sf—Spectral weights;
O—Network output vector;
T—Original target vector;
F( )—Denotes Fourier transform;
Err—Final error (or metric) value;
N—Number of spectral lines.
The time and frequency domain constraints may be applied simultaneously either by modifying the error function to incorporate both constraints or by simply adding the error functions together and minimizing the total.
The combination of the noise-reduction techniques for extracting the forward linear transfer function and the time-domain linear neural network that supports both time and frequency domain constraints provides a robust and accurate technique for synthesizing the FIR filter to perform the inverse linear transfer function to precompensate for the linear distortion of the speaker during playback.
An exemplary embodiment for extracting the forward and inverse non-linear transfer functions is illustrated in
To address the non-linear portion of the problem, we use a neural network to estimate the non-linear forward transfer function (step 132). As shown in
To invert the non-linear transfer function, we use a formula that recursively applies the forward non-linear transfer function F( ) to the test signal I using the non-linear neural network and subtracts a 1st order approximation Cj*F(I), where Cj is a weighting coefficient for the jth recursive iteration, from the test signal I to estimate an inverse non-linear transfer function RF( ) for the speaker (step 134). The weighting coefficients Cj are optimized using, for example, a conventional least-squares minimization algorithm.
For a single iteration (no recursion), the formula for the inverse transfer function is simply Y=I−C1*F(I). In other words, passing an input audio signal I, in which the linear distortion has been suitably removed, through the forward transform F( ) and subtracting that from the audio signal I produces a signal Y that has been “precompensated” for the non-linear distortion of the speaker. When audio signal Y is passed through the speaker, the effects cancel. Unfortunately the effects do not exactly cancel and there typically remains a nonlinear residual signal. By iterating recursively two or more times, and thus having more weighting coefficients Ci to optimize, the formula can drive the nonlinear residual closer and closer to zero. Just two or three iterations have been shown to improve performance.
For example, a three iteration formula is given by:
Y=I−C3*F(I−C2*F(I−C1*F(I))).
For playback there are two options. The weights of the trained neural network and the weighting coefficients Ci of recursive formula can be provided to the speaker or receiver to simply replicate the non-linear neural network and recursive formula. A computationally more efficient approach is to use the trained neural network and the recursive formula to train a “playback neural network” (PNN) that directly computes the inverse non-linear transfer function (step 136). The PNN is suitably also a feedforward network and may have the same architecture (e.g. layers and neurons) as the original network. The PNN can be trained using the same input signal that was used to train the original network and the output of the recursive formula as the target. Alternately, a different input signal can be passed through the network and recursive formula and that input signal and the resulting output used to train the PNN. The distinct advantage is that the inverse transfer function can be performed in a single pass through a neural network instead of requiring multiple (e.g. 3) passes through the network.
In order to compensate for the speaker's linear and non-linear distortion characteristics, the inverse linear and non-linear transfer functions must actually be applied to the audio signal prior to its playback through the speaker. This can be accomplished in a number of different hardware configurations and different applications of the inverse transfer functions, two of which are illustrated in
As shown in
As shown in
As mentioned earlier, the speaker itself or the audio receiver may be provided with a microphone input and the processing and algorithmic capability to characterize the speaker and train the neural networks to provide the coefficients and weights required for playback. This would provide the advantage of compensating for the linear and non-linear distortion of the particular listening environment of each individual speaker in addition to the distortion properties of that speaker.
Precompensation using the inverse transfer functions will work for any output audio transducer such as the described speaker or an amplified antenna. However, in the case of any input transducer such as a microphone any compensation must be performed “post” transducing from an audible signal into an electrical signal, for example. The analysis for training the neural networks etc. does not change. The synthesis for reproduction or playback is very similar except that it occurs post-transduction.
The general approach set-forth of characterizing and compensating for the linear and non-linear distortion components separately and the efficacy of the time-domain neural network based solutions are validated by the frequency and time-domain impulse responses measured for a typical speaker. An impulse is applied to both a speaker with and without correction and the impulse response is recorded. As shown in
While several illustrative embodiments of the invention have been shown and described, numerous variations and alternate embodiments will occur to those skilled in the art. Such variations and alternate embodiments are contemplated, and can be made without departing from the spirit and scope of the invention as defined in the appended claims.