DSPRelated.com
Forums

Reducing u-law noise?

Started by Filip Larsen April 21, 2007
I have a 200-3400 Hz voice signal in a 22050 Hz sampled 16-bit PCM file 
that I have to deliver to a sound speaker computer system that only 
accepts 22050 Hz u-law. However, the u-law encoding process seems to 
introduce full spectrum (quantization?) noise so the result is a 
200-3400 Hz signal overlaid with 0-11 kHz noise, thus giving very 
perceptible high frequency noise during playback since there is no 
"natural" noise above 3400 Hz to "hide" encoding noise.

If I had access to change the signal processing in the speaker system, I 
guess the noise could be reduced a lot by using a voice bandpass filter 
after u-law decoding (the systems uses an internal 16 bit PCM buffer for 
playback).

However, I am now wondering if it in general is possible to process the 
22050 Hz PCM sound *before* u-law encoding in such a way that noise 
perception will be reduced after u-law decoding and play back on a 
"good" sound system?

I was thinking like adding noise or somehow add a signal that cancels 
out u-law noise (if the 16-bit PCM signal by magic had only signal 
levels that exactly matched the 8 bit u-law levels there would be no 
noise, I assume).


Thank you in advance,
-- 
Filip Larsen

Filip Larsen wrote:
> I have a 200-3400 Hz voice signal in a 22050 Hz sampled 16-bit PCM file > that I have to deliver to a sound speaker computer system that only > accepts 22050 Hz u-law.
Fs = 22.05kHz and uLaw is a very strange combination of parameters. Are you sure this is the only option?
> However, the u-law encoding process seems to > introduce full spectrum (quantization?) noise so the result is a > 200-3400 Hz signal overlaid with 0-11 kHz noise, thus giving very > perceptible high frequency noise during playback since there is no > "natural" noise above 3400 Hz to "hide" encoding noise.
I see. The uLaw produces a quantization noise of about -30dB in the full band.
> If I had access to change the signal processing in the speaker system, I > guess the noise could be reduced a lot by using a voice bandpass filter > after u-law decoding (the systems uses an internal 16 bit PCM buffer for > playback).
Yes. The analog or digital bandlimiting filter would help.
> However, I am now wondering if it in general is possible to process the > 22050 Hz PCM sound *before* u-law encoding in such a way that noise > perception will be reduced after u-law decoding and play back on a > "good" sound system?
This is what is called the nonlinear noise shaping. In the short, you will have to implement an iterative algorithm which converts a sliding window of N input samples into N output samples, so the resultant error will be perceptually optimal.
> I was thinking like adding noise or somehow add a signal that cancels > out u-law noise (if the 16-bit PCM signal by magic had only signal > levels that exactly matched the 8 bit u-law levels there would be no > noise, I assume).
Let's keep it simple. If you lowpass the incoming signal to 5kHz, then you can decimate it to Fs = 11.05kHz. So, at the output, each sample will be repeated twice and there will be no noise components at the high frequencies. However, there will be a high frq trash due to the aliasing instead. The question is what is worse: the quantization error or the amount of the aliased trash. It depends on the spectrum of the incoming signal and its amplitude. So the algorithm should select between the repetitions of the samples and direct u-law encoding for every sample, so the resultant distortion will be kept at minimum. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
I wrote:

 >> I have a 200-3400 Hz voice signal in a 22050 Hz sampled 16-bit PCM
 >> file that I have to deliver to a sound speaker computer system that
 >> only accepts 22050 Hz u-law.

and Vladimir Vassilevsky was kind enough to answer:

> Fs = 22.05kHz and uLaw is a very strange combination of parameters. Are > you sure this is the only option?
This is the only option at present. Luckily we may have a chance in the near future to negotiate a change with the manufacturer of that system where I then can try persuade them to offer a 16-bit sample transfer mode. And for that negotiation it helps that I can explain what the benefit of such a change will be.
>> However, the u-law encoding process seems to introduce full spectrum >> (quantization?) noise so the result is a 200-3400 Hz signal overlaid >> with 0-11 kHz noise, thus giving very perceptible high frequency noise >> during playback since there is no "natural" noise above 3400 Hz to >> "hide" encoding noise. > > I see. The uLaw produces a quantization noise of about -30dB in the full > band.
This seems to fit with the noise levels I see.
>> However, I am now wondering if it in general is possible to process >> the 22050 Hz PCM sound *before* u-law encoding in such a way that >> noise perception will be reduced after u-law decoding and play back on >> a "good" sound system? > > This is what is called the nonlinear noise shaping. In the short, you > will have to implement an iterative algorithm which converts a sliding > window of N input samples into N output samples, so the resultant error > will be perceptually optimal.
Excellent. Noise shaping filter seems to be a simple thing to implement once I have a set of coefficients. Unfortunately, I have not been able to find anything about calculating or "looking up" such coefficients in my introductory signal processing textbooks or on the net. Only hits I get to be about patented 24-to-16 bit noise shaping methods. In case we decide that noise shaping really is the only option, how would I then go about getting some working coefficients? Anyone know of a tool or a method that can do this? At the moment all I can come up with (being a software engineer) is to code it up as some sort of optimization problem and let a computer search for a set. Which unfortunately sounds like a small research project all by itself.
>> I was thinking like adding noise or somehow add a signal that cancels >> out u-law noise (if the 16-bit PCM signal by magic had only signal >> levels that exactly matched the 8 bit u-law levels there would be no >> noise, I assume). > > Let's keep it simple. If you lowpass the incoming signal to 5kHz, then > you can decimate it to Fs = 11.05kHz. So, at the output, each sample > will be repeated twice and there will be no noise components at the high > frequencies. However, there will be a high frq trash due to the aliasing > instead. The question is what is worse: the quantization error or the > amount of the aliased trash. It depends on the spectrum of the incoming > signal and its amplitude. So the algorithm should select between the > repetitions of the samples and direct u-law encoding for every sample, > so the resultant distortion will be kept at minimum.
I don't understand what this algorithm chooses between and what is obtained by doing it. For each 11 kHz sample I make two 22 kHz samples from from which values? To me it seems that a range of signal level values around the original level all map to the same u-law encoded/decoded value, so in order to end up as a different signal one or two of the samples must be selected from a "higher" or "lower" u-law decoded value? But selected how and to satisfy which "measure"? Aren't we back at noise shaping for this to "work"? Best regards, -- Filip Larsen

Filip Larsen wrote:


>>> However, I am now wondering if it in general is possible to process >>> the 22050 Hz PCM sound *before* u-law encoding in such a way that >>> noise perception will be reduced after u-law decoding and play back >>> on a "good" sound system? >> >> >> This is what is called the nonlinear noise shaping. In the short, you >> will have to implement an iterative algorithm which converts a sliding >> window of N input samples into N output samples, so the resultant >> error will be perceptually optimal. > > > Excellent. Noise shaping filter seems to be a simple thing to implement > once I have a set of coefficients. Unfortunately, I have not been able > to find anything about calculating or "looking up" such coefficients in > my introductory signal processing textbooks or on the net. Only hits I > get to be about patented 24-to-16 bit noise shaping methods.
I would try the following things: 1. Pushing the noise to above 9.5kHz with the noise shaping filter with the fixed coefficients. The frequencies above 0.9 of Nyquist are very well attenuated by the antialiasing filter inside the typical audio DAC. 2. The adaptive noise shaping filter which concentrates the noise in the areas of the spectral peaks of the signal, so the noise is masked.
> In case we decide that noise shaping really is the only option, how > would I then go about getting some working coefficients? Anyone know of > a tool or a method that can do this?
This is a basic task of designing a filter to a spec. However the filter is represented in the non-traditional form.
> At the moment all I can come up > with (being a software engineer) is to code it up as some sort of > optimization problem and let a computer search for a set. Which > unfortunately sounds like a small research project all by itself.
I don't have the canned answer however it shouldn't be a very big deal to figure it out. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
Vladimir Vassilevsky <antispam_bogus@hotmail.com> writes:
> [...] > 1. Pushing the noise to above 9.5kHz with the noise shaping filter > with the fixed coefficients. The frequencies above 0.9 of Nyquist are > very well attenuated by the antialiasing filter inside the typical > audio DAC.
Vladimir, I don't know what you're talking about. The noise is being introduced by the u-law decoder, which is not under his control - it's in the loudspeaker. How could any manipulation of the u-law-encoded signal result in a noise-shaped decoder output? At least this is how I have it. I could be wrong. -- % Randy Yates % "The dreamer, the unwoken fool - %% Fuquay-Varina, NC % in dreams, no pain will kiss the brow..." %%% 919-577-9882 % %%%% <yates@ieee.org> % 'Eldorado Overture', *Eldorado*, ELO http://home.earthlink.net/~yatescr

Randy Yates wrote:
> Vladimir Vassilevsky <antispam_bogus@hotmail.com> writes: > >>[...] >>1. Pushing the noise to above 9.5kHz with the noise shaping filter >>with the fixed coefficients. The frequencies above 0.9 of Nyquist are >>very well attenuated by the antialiasing filter inside the typical >>audio DAC. > > > > I don't know what you're talking about. The noise is being introduced > by the u-law decoder, which is not under his control - it's in the > loudspeaker. How could any manipulation of the u-law-encoded signal > result in a noise-shaped decoder output? > At least this is how I have it. I could be wrong.
The 16 bit PCM source is encoded into 8bit uLaw. You know what is the error introduced by the uLaw encoding at every sample. The uLaw is not linear however the error feedback concept is exactly the same. VLV
Vladimir Vassilevsky <antispam_bogus@hotmail.com> writes:

> Randy Yates wrote: >> Vladimir Vassilevsky <antispam_bogus@hotmail.com> writes: >> >>>[...] >>>1. Pushing the noise to above 9.5kHz with the noise shaping filter >>>with the fixed coefficients. The frequencies above 0.9 of Nyquist are >>>very well attenuated by the antialiasing filter inside the typical >>>audio DAC. >> I don't know what you're talking about. The noise is being >> introduced >> by the u-law decoder, which is not under his control - it's in the >> loudspeaker. How could any manipulation of the u-law-encoded signal >> result in a noise-shaped decoder output? >> At least this is how I have it. I could be wrong. > > The 16 bit PCM source is encoded into 8bit uLaw. You know what is the > error introduced by the uLaw encoding at every sample. The uLaw is not > linear however the error feedback concept is exactly the same.
Right-o. I started scratching my head after my post and realized that a u-law (I've never worked with it) encoder must be sorta like a quantizer. So in reality it is the encoder that is introducing the noise, not the decoder. -- % Randy Yates % "Bird, on the wing, %% Fuquay-Varina, NC % goes floating by %%% 919-577-9882 % but there's a teardrop in his eye..." %%%% <yates@ieee.org> % 'One Summer Dream', *Face The Music*, ELO http://home.earthlink.net/~yatescr
Follow-up to my earlier question:

> In case we decide that noise shaping really is the only option, how > would I then go about getting some working coefficients?
I have now found a conference paper that after a first read appears to cover enough detail to allow implementation of fixed and adaptive noise shaping filters to be made from it: W. Verhelst and D. De Koning. "Least Squares Theory and Design of Optimal Noise Shaping Filters." In Proc. 22nd International Conference of the Audio Engineering Society (AES): Virtual, Synthetic, and Entertainment Audio, pp. 216-222, Espoo, Finland, June 2002. http://www.etro.vub.ac.be/Research/DSSP/Publications/int_conf/AES-2002-B.pdf Regards, -- Filip Larsen

Filip Larsen wrote:


> I have now found a conference paper that after a first read appears to > cover enough detail to allow implementation of fixed and adaptive noise > shaping filters to be made from it: > > W. Verhelst and D. De Koning. "Least Squares Theory and Design of > Optimal Noise Shaping Filters." In Proc. 22nd International Conference > of the Audio Engineering Society (AES): Virtual, Synthetic, and > Entertainment Audio, pp. 216-222, Espoo, Finland, June 2002. > > http://www.etro.vub.ac.be/Research/DSSP/Publications/int_conf/AES-2002-B.pdf >
It would be really interesting to know of how much of improvement you would be able to achieve and what seems to be the "optimal" solution. Please keep sending the updates on your progress. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com