Help - Search - Members - Calendar
Full Version: Some Ideas/Questions about Dithering [LONG]
Hydrogenaudio Forums > Hydrogenaudio Forum > General Audio
tigre
Hi there!

Lately I've read a lot about dithering here on HA and did some "experiments", mainly resampling of artificial signals using SSRC and CEP with different settings. What caused my interest in this: I've got a life concert DVD with 48kHz 16bit 2Ch uncompressed audio stream and I wanted to create an audio CD as "archive" and mp3 files for portable use (--alt-preset standard), each with decent quality. - OK, I admit: best possible quality, wasting a lot of time and gaining a lot knowledge wink.gif

What I'll write next is mainly what I filtered out of what I've read, so if I'm wrong please to correct me.

For decent resampling it's necessary to raise resolution in a first step, e.g. from 16bit to 24 or 32 bit. The next step is changing sample rate using algorithms I don't have a clue about smile.gif, e.g 48kHz -> 44.1kHz. Final step: Downsampling to final resolution (24/32bit -> 16bit). In this step it's good to apply dither to avoid distortion, especially noticable at low volume signals. The price for it is adding noise of very low volume. When processing an audio signal in multiple steps it's supposed to be a good idea to use white noise (or noise with the same frequency response as the background noise of the original signal, IIRC), for the final step, e.g. before creating an audio CD from the result, "shaped" noise, e.g. frequency response similar to ATH curve or frequencies mainly arround 20kHz. Using "shaped" noise for final step only makes sense because applying it several times can cause audible artifacts. This leads to my 1st question(s):

1. Could someone explain to me why it is like that, please? Maybe it's possible to generate an example for this intentionally, e.g. "Generate a 100Hz sine tone in CEP - resample it from 44.1kHz to 48kHz and the other way round 10 times using ... settings and you'll hear ..."?

2. I've read a post here by Frank Klemm IIRC but I can't find it anymore. It made me think that it's a good idea to apply noise with the same frequency response as the background noise of the source if you can suppose that noise shaped dithering has been applied to the source already (e.g. audio stream of a DVD). What do you think of this?

3. To create noise for this "customised" dithering I would create white noise with CEP, do a frequency analysis of the source's background noise, apply an equalizer filter to the noise fitting to the frequency analysis, reduce the volume of the resulting shaped noise and add it to the already downsampled but still 32bit source. Then lowering resolution to 16 bit (truncating, no extra dithering). Any suggestions to improve this?

4. What amplitude should my "customized" shaped noise have before adding to the source signal?

5. I'm wondering about the same in CEP: There's a "Dither dephth (bits)" setting. What value gives the best "avoid distortion/add noise" ratio when using CEP's built in dithering - and why?

6. AFAIK --alt-presets in mp3 work better with 44.1 kHz than with 48kHz and there's some lowpass applied. So my idea is to use 48kHz noise shaped dithering (20kHz+ frequency range noise) or even add a 22.05 kHz, +/-1 amplitude sine tone to the source because both will completely cut away by lame's lowpass. Will this work or could there be a bad surprise?

Thanks for your answers
tigre
Pio2001
QUOTE (tigre @ Jan 21 2003 - 12:20 AM)
2. I've read a post here by Frank Klemm IIRC but I can't find it anymore.

It must have been inthis thread : http://www.hydrogenaudio.org/forums/index....t=ST&f=2&t=1628
Gabriel
You can resample if you need, but you do not need to requantize to 16 bits to encode in mp3.
KikeG
Several things:

- In order to properly use dither with noise-shaping, it's not enough to simply add noise-shaped dither signal. A more complex sytem is used that feeds quantization error back into the quantizer, together with the dither.

- Dither with noise shaping pushes dither noise into higher frequencies, and keeps higher dynamic range of the original (24 or 32 bit) signal at lower frequencies. Aplying dither with noise shaping several times can cause very high levels of high-frequency noise, and that is not good.

- If you use dither with noise shaping in order to move noise to high frequencies, and then you filter the high frequencies, you lose all the benefits of the dithering process.

- For these reasons, if you are going to process (DSP, compression) the dithered signal, it's better to use instead flat dither. Also, when using dither with noise shaping, the higher noise at high frequencies can make work worse perceptual encoders or compressors. In my opinion, for 16 bits, flat dither is not audibly different from noise shaping dither, under regular listening conditions. Even no dither (truncation) is really really tough to hear!! However, on 8 bits there's a big difference.

- For any dither, the best pdf if triangular. For flat dither, the theorical needed dither is 1 lsb or bit. In my tests wit CEP, using just 0.9 bits it's enough, adding also slighly less noise . With noise shaping less bits are needed in practice. With 44.1 KHz CEP noise shaping, 0.5 bits is enough.

I had missed the end of Pio's pointed thread, very interesting.


Edit: Gabriel's suggestion is the best to avoid this dithering issues when compressing data: convert to 32 bit, resample, save as 24 or 32 bits and then convert to mp3 or whatever.
tigre
QUOTE (Pio2001 @ Jan 20 2003 - 01:41 PM)

It's not but it's very interesting and contains interesting links. Thanks for making me read it carefully again smile.gif. I found out that when asking question 6. I've been typing faster than thinking. Forget about it. wink.gif
tigre
QUOTE (Gabriel @ Jan 21 2003 - 12:41 AM)
You can resample if you need, but you do not need to requantize to 16 bits to encode in mp3.

Thanks for your answer. This makes things (mp3 encoding) quite simple. I just wonder if there'll be a different mp3 filesize when encoding from 24bit or 32bit source compared to 16bit - I'll try.


QUOTE (KikeG @ Jan 21 2003 - 01:10 AM)
Several things:

- In order to properly use dither with noise-shaping, it's not enough to simply add noise-shaped dither signal. A more complex sytem is used that feeds quantization error back into the quantizer, together with the dither.

OK. I got now that dithering=just adding noise is simplified to much (even if it would work - what you describe is better). If I understand correctly (noise shaped) dithering in CEP works the way you say - right?

QUOTE
- If you use dither with noise shaping in order to move noise to high frequencies, and then you filter the high frequencies, you lose all the benefits of the dithering process.

When talking about removing high frequencies I was thinking about lossy encoding (such as mp3). Now that I know I can feed lame with 24bit/32bit resolution this doesn't matter anymor practically, but just for me being curious: I thought lowpassing in lame is done after transforming (I think it's called DCT) to frequency "look" (this is where my English skills leave me wink.gif ), so there should be no distortion introduced by this (at least not the same as when lowering resolution 32/24bit->16bit without dithering). Am I wrong?

The rest of what you wrote is useful and quite clear for me (no more quotes to save space). I'll keep it in mind. Thnx.
KikeG
QUOTE (tigre @ Jan 21 2003 - 10:39 AM)
OK. I got now that dithering=just adding noise is simplified to much (even if it would work - what you describe is better).

Simple dither without noise shaping is what you say, is just adding some random noise before quantizing to decorrelate the quantization error from the signal itself. But noise shaping dither is the one more complicated, is what I tried to explain in my previous post.

QUOTE
If I understand correctly (noise shaped) dithering in CEP works the way you say - right?

Yes, if you use noise shaping. If not, it makes what you said.

QUOTE
I thought lowpassing in lame is done after transforming (I think it's called DCT) to frequency "look" (this is where my English skills leave me wink.gif ), so there should be no distortion introduced by this (at least not the same as when lowering resolution 32/24bit->16bit without dithering). Am I wrong?

The thing is that whenever you change an already dithered signal you will "break" the dithering process, because the signal will have be re-quantized with the change, and digital distortion will appear again. If I'm not wrong, noise-shaping dithered signals are specially sensitive to this. Simplyfying, with simple flat dither, this happens to a lesser extent, the signal is less "fragile". About mp3 encoding, I think that lowpassing is the first step performed in the process, but I'd say it wouldn't matter when this is done, it would have a similar effect.

More info (pdf):

http://www.benchmarkmedia.com/appnotes-d/ditherap.pdf

http://www.mediarte.org/download/software/...io/whitepapers/ , last doc.
Chun-Yu
Nice link, KikeG! I like the part where he duplicates the Sony Super Bit Mapping noise-shaping curve (in the PDF)!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.