HydrogenAudio

Hydrogenaudio Forum => Scientific Discussion => Topic started by: hellokeith on 2008-02-28 20:01:21

Title: filtering, dither, and noiseshaping
Post by: hellokeith on 2008-02-28 20:01:21
Would someone be kind enough to summarize how filtering, dither, and noiseshaping are used in SRC and mastering applications? Are they ever used simultaneously?
Title: filtering, dither, and noiseshaping
Post by: AndyH-ha on 2008-02-28 20:25:59
Filtering is an awfully big topic. Filters are used for a great many things. If you mean something along the lines of the brick wall filters for playback, that is part of the hardware, not the data. Many kind of filters are used in mastering, mainly to emphasize or reduce particular frequencies or frequency ranges.

Dithering and noise shaping are use together. Dither is noise shaped for best results, mainly so you don’t hear the dithering noise. Dither can be applied at recording time, in the analogue domain prior to the ADC, but is only relevant for 16 bit recording, and probably just about non-existent in professional work these days. Also in amateur and home work I suspect, as I don’t know of any soundcard with the ability to do it.

The only other time dither is used is when reducing the bit depth. Going from 32 or 24 bit to 16 bit results in quantization distortion. Dither eliminates that. The trade off is a higher background noise, which sound a lot better than the distortion. Good noise shaping puts most of the dither in the very high frequency range where few people have any chance of hearing it.
Title: filtering, dither, and noiseshaping
Post by: AndyH-ha on 2008-02-28 22:44:37
When changing the sample rate, filters are quite important, at least when going from a higher to a lower sample rate. The filters don’t seem to really make much of a difference when upsampling, but their use is a pretty normal part of the process. Without high frequency cut off before downsampling, there would be a lot of aliasing distortion -- if there were any higher frequencies in the original (beyond the Nyquist limit of the result sample rate) .
Title: filtering, dither, and noiseshaping
Post by: Woodinville on 2008-02-28 23:51:33
For filtering: http://www.aes.org/sections/pnw/ppt/filters/filtutv1.ppt (http://www.aes.org/sections/pnw/ppt/filters/filtutv1.ppt)

For quantization, noise shaping, and dithering:  http://www.aes.org/sections/pnw/ppt/adc.ppt (http://www.aes.org/sections/pnw/ppt/adc.ppt)

More there than can be discussed in one article here.
Title: filtering, dither, and noiseshaping
Post by: knutinh on 2008-02-29 11:31:50
The filters don’t seem to really make much of a difference when upsampling, but their use is a pretty normal part of the process.

Try generating a regular 8kHz sampled signal (with 4kHz bandwidth), then upsampling to 96kHz with close to "no filtering": producing pulses 1 sample wide (1/96000 seconds) spaced by 1/8000 seconds...

-k
Title: filtering, dither, and noiseshaping
Post by: SebastianG on 2008-02-29 14:14:56
The filters don’t seem to really make much of a difference when upsampling, but their use is a pretty normal part of the process.

How do you resample to a higher sampling rate without filters?
Of course there are also filters involved -- even if you do linear interpolation. Linear interpolation corresponds to a filter with a triangular impulse response. These filters arn't used to fight aliasing but imaging.

... 1 sample wide ...

A sample has no width.

Cheers,
SG
Title: filtering, dither, and noiseshaping
Post by: AndyH-ha on 2008-02-29 21:54:44
I can’t speak to what in the resampling process may mathematically be called a filter, so I will be more specific. CoolEdit/Audition, which we know does very good resampling, provides pre and post filters as an option. If you select some music, such as a CD track, and upsample from 44.1kHz to 96kHz, it can be shown that there is some difference, depending on whether or not one selects the filters option.

Someone may be able to provide a sample where the difference is readily audible, but in my more general tests with music, the differences were not audible. It was easier to find audible differences when downsampling.
Title: filtering, dither, and noiseshaping
Post by: Woodinville on 2008-02-29 23:01:08
I can’t speak to what in the resampling process may mathematically be called a filter, so I will be more specific. CoolEdit/Audition, which we know does very good resampling, provides pre and post filters as an option. If you select some music, such as a CD track, and upsample from 44.1kHz to 96kHz, it can be shown that there is some difference, depending on whether or not one selects the filters option.

Someone may be able to provide a sample where the difference is readily audible, but in my more general tests with music, the differences were not audible. It was easier to find audible differences when downsampling.


Resampling by its nature must absolutely include filtering, so if CooEdit is doing "very good resampling" then it is unquestionably filtering.

If it is not, there will be a great problem.

Try this.

Take a 3.5 kHz sine wave sampled at 8kHz.

resample it.

if you wind up with a nasty 4.5 kHz image, it doesn't do "very good resampling".  If you do not, it filters.
Title: filtering, dither, and noiseshaping
Post by: cabbagerat on 2008-03-02 08:26:50
I can’t speak to what in the resampling process may mathematically be called a filter, so I will be more specific. CoolEdit/Audition, which we know does very good resampling, provides pre and post filters as an option. If you select some music, such as a CD track, and upsample from 44.1kHz to 96kHz, it can be shown that there is some difference, depending on whether or not one selects the filters option.
I have never used Audition, but the fact is that unless you apply an antialiasing filter (for rate reduction) or an anti-imaging filter (for rate increase), then the process shouldn't be called resampling at all. Without these filters, the "resampling" operation violates the Nyquist theorem. Basically, you end up with samples of something - but not samples of the original signal.
Title: filtering, dither, and noiseshaping
Post by: eevan on 2008-03-02 11:49:37
CoolEdit/Audition, which we know does very good resampling, provides pre and post filters as an option.
That's right, but I'm not sure why they left it as an option? Perhaps to provide us the ability to create false frequencies as an unusual effect.

Quote
3. Drag the Low/High Quality slider to adjust the quality of the sampling conversion.
Higher values retain more high frequencies (they prevent aliasing of higher frequencies to lower ones), but the conversion takes longer. Lower values requires less processing time but result in certain high frequencies being "rolled off," leading to muffled-sounding audio. Usually, values between 100 and 400 are fine for most conversion needs.

Use higher values whenever you downsample a high rate to a low rate. When upsampling, results from lower values sound almost identical to those from higher values.

4. Select Pre/Post Filter to prevent false frequencies from being generated at the low end of the audio spectrum. Select this option for the best results.
Title: filtering, dither, and noiseshaping
Post by: tgoose on 2008-03-02 12:53:40
Dithering and noise shaping are use together. Dither is noise shaped for best results, mainly so you don’t hear the dithering noise. Dither can be applied at recording time, in the analogue domain prior to the ADC, but is only relevant for 16 bit recording, and probably just about non-existent in professional work these days. Also in amateur and home work I suspect, as I don’t know of any soundcard with the ability to do it.

Sonic Studio, Pyramix, Waves hardware, and the tc6000 will all dither to 24 bits, as well as probably plenty of other pro equipment. In my book there's never a reason not to dither before ADC or before sample rate conversion or lowering bit depth.
Title: filtering, dither, and noiseshaping
Post by: AndyH-ha on 2008-03-02 19:47:47
The reason to use or not use dither is ‘does it make a difference?’ Well, it always makes a difference in the amount of noise in the mix; it is added noise, but does it improve anything? If processing at 24 bit, for anything except resampling to a lower bit depth, the only audible difference it can make is -- more noise. The quantization errors are so small that they can’t be heard, so dither helps nothing.

There are a lot of superstitions in audio, but maybe 24 bit integer does need some help. Floating point is definitely superior to integer math for audio processing. I’ve never used any of those dinosaur programs that still process with integer math, so I can’t say from experience. I have heard rumors that mixing and mastering in 24 bit integer clearly sounds worse, so maybe dithering transforms would buy something there. The proof of the pudding is always successful ABX tests; I predict no one will accomplish that with 32 bit floating point transforms, probably not even with test tones. If someone can do it with integer math processing, that just shows they should not be using it.
Title: filtering, dither, and noiseshaping
Post by: Vitecs on 2008-03-03 12:18:30
The only other time dither is used is when reducing the bit depth.

Is there any sense to dither+NSH while saving material with the same bit-depth? I have weird example: 16 -> reduce volume on 6.02 dB (shift one bit) -> save 16. We probably end-up with dithering "dithered" material in this case?
Title: filtering, dither, and noiseshaping
Post by: knutinh on 2008-03-03 14:18:23
The reason to use or not use dither is ‘does it make a difference?’ Well, it always makes a difference in the amount of noise in the mix; it is added noise, but does it improve anything? If processing at 24 bit, for anything except resampling to a lower bit depth, the only audible difference it can make is -- more noise. The quantization errors are so small that they can’t be heard, so dither helps nothing.

On the other hand, usually whenever one introduces quantization, you get the choice between correlated distortion, or non-correlated dithering. I think that in cases when quantizing distortion cannot be heard, then typically dithering cannot be heard.

Substituting something that sounds bad with something that sounds less bad seems like a good thing, even if both are at levels where they cannot be heard?

-k
Title: filtering, dither, and noiseshaping
Post by: pdq on 2008-03-03 15:18:29

The only other time dither is used is when reducing the bit depth.

Is there any sense to dither+NSH while saving material with the same bit-depth? I have weird example: 16 -> reduce volume on 6.02 dB (shift one bit) -> save 16. We probably end-up with dithering "dithered" material in this case?

This is in essence a bit depth reduction. Dividing the values by 2 results in a 17 bit value which must be reduced to 16 bits, therefore dithering is called for.
Title: filtering, dither, and noiseshaping
Post by: AndyH-ha on 2008-03-03 20:15:00
I seem to have mis-spoke on that. I don’t often think about processing at 16 bits, but it is essentially the same as recording at 16 bit. The quantization errors with 16 bit transforms (such as amplification) are much larger than when using 24 or 32 bit. It is common to dither the transforms to prevention distortion and increase the dynamic range.

If you take most modern pop music and do some such manipulation, the dynamic range is already so low that dither vs non-dither is unlikely to make an audible difference in that respect. Being that the low dynamic range is achieved at very high levels, the quantization errors at high bit depth are unlikely to be audible even without dithering. However, the general rule is to dither.

If one does a few such transforms in sequence, there will soon be enough dither in the mix to self dither any further calculations. Adding more dither then does not reduce distortion, it just adds more noise. Again, good noise shaping can probably ameliorate that. Some programs do not provide for dither options such as depth, type, and shape when preforming transforms. With these, at least, it is easy to verify that the dither quickly becomes audible (i.e. after a few applications) if one uses music with some fairly quiet passages.
Title: filtering, dither, and noiseshaping
Post by: pdq on 2008-03-03 21:48:21
If one takes a file with noise shaped dither and then low-pass filters it to filter out most of the noise introduced by dithering, has one then potentially increased the bit depth of the resulting file?
Title: filtering, dither, and noiseshaping
Post by: Woodinville on 2008-03-03 22:34:53
If one takes a file with noise shaped dither and then low-pass filters it to filter out most of the noise introduced by dithering, has one then potentially increased the bit depth of the resulting file?


Take a look at the "adc" powerpoint deck mentioned above. This is the essence of oversampling using noise shaping.
Title: filtering, dither, and noiseshaping
Post by: pdq on 2008-03-04 04:29:15

If one takes a file with noise shaped dither and then low-pass filters it to filter out most of the noise introduced by dithering, has one then potentially increased the bit depth of the resulting file?


Take a look at the "adc" powerpoint deck mentioned above. This is the essence of oversampling using noise shaping.

I was actually hoping for a yes/no answer so I wouldn't have to install powerpoint.
Title: filtering, dither, and noiseshaping
Post by: AndyH-ha on 2008-03-04 07:14:08
The bit depth is a matter of format. A 16 bit file is a 16 bit file, dithered or not.

In general, one can remove only some dither by low pass filtering; all the dither is not at high frequencies. Also, in general, one is likely to also remove some of the music.

There is a technique, or a set of techniques, of adding dither prior to the ADC that can be digitally subtracted from the data after the ADC. This result in a SNR more or less equal to the original analogue signal instead of the decreased SNR otherwise obtained by dithering. Whether this is actually in use with any of today’s superior  24 bit ADCs, I have no idea. Certainly it isn’t available in any soundcard I ever read about.
Title: filtering, dither, and noiseshaping
Post by: knutinh on 2008-03-04 07:27:36
I am guessing that as long as current ADCs are 24 bit or more, while their "precision" is typically limited to 19-20 bits at best, the noise present at the input is sufficient to avoid quantising distortion?

pdq:
Adding noise prior to quantisation, then lowpass-filtering is essentially "encoding" more amplitude information into the high-frequency parts of the signal. A single ("DC") 32-bit number can easily be represented by a 1-bit stream if sufficient amount of noise is added prior to quantisation and the signal is then lowpassfiltered.

I think that your question cannot be answered by a simple yes/no. When one deals with oversampling, noise-shaping systems, it is probably better to view the overall information (i.e. bitrate) of a system as a property that can be spent for bandwidth or amplitude-precision in different ways, but always limited by the bitrate.

-k
Title: filtering, dither, and noiseshaping
Post by: Kees de Visser on 2008-03-04 09:46:35
If one takes a file with noise shaped dither and then low-pass filters it to filter out most of the noise introduced by dithering, has one then potentially increased the bit depth of the resulting file?
A low-pass filter will reduce the bandwidth of the signal, and thereby increase the total SNR.
The use of a low-pass filter requires modification (DSP) of the original signal data so you will either end up with an increased wordlength (e.g. 24 or 32 bit) or have to re-dither, but that's probably not what you want because the purpose was to get rid of the dither noise.
There's no such thing as a free lunch I'm afraid.
Title: filtering, dither, and noiseshaping
Post by: Woodinville on 2008-03-04 18:57:47


If one takes a file with noise shaped dither and then low-pass filters it to filter out most of the noise introduced by dithering, has one then potentially increased the bit depth of the resulting file?


Take a look at the "adc" powerpoint deck mentioned above. This is the essence of oversampling using noise shaping.

I was actually hoping for a yes/no answer so I wouldn't have to install powerpoint.


Well, the answer isn't that simple. You're better off doing a bit of study.
Title: filtering, dither, and noiseshaping
Post by: AndyH-ha on 2008-03-04 19:10:24
I don’t know if a "precision" of less than 24 bits is the proper expression. There are lower limits on circuit noise (without cryogenic cooling), so the electronic noise masks any lower level signals. I think it is more correct to say that the ADC itself  is really 24 bits, but the lowest level bits just are not useful in the real world; they are produced and recorded but they can contain only noise.

Whether or not self dithering is responsible for the lack of (audible) quantization distortion when recording with a decent 24 bit soundcard is an interesting question. It is always the case that such errors are essentially irrelevant at higher bit depths. While I can observe the results on screen at higher signal levels when working with 16 bit data, the highest level at which I can hear the distortion is somewhere around -75dB. That is, it is only audible for the least most significant 3 or 4 bits. Operating at 24 bits, the lower  3 or 4 bits are unavailable. Does the “audible” distortion region move down 8 bit under 24 bit operation, or is it just too small to matter, period?

I have no good software that works on 24 bit data (except to open or save as), so I can’t say if it is different. Experimenting on computer generated floating point audio (thus no masking electronic noise included), I find that quantization distortion is irrelevant, even after many transforms. I can’t hear it and I can neither see it nor measure it with any tools I have available.
Title: filtering, dither, and noiseshaping
Post by: pdq on 2008-03-04 19:30:46



If one takes a file with noise shaped dither and then low-pass filters it to filter out most of the noise introduced by dithering, has one then potentially increased the bit depth of the resulting file?

Take a look at the "adc" powerpoint deck mentioned above. This is the essence of oversampling using noise shaping.

I was actually hoping for a yes/no answer so I wouldn't have to install powerpoint.

Well, the answer isn't that simple. You're better off doing a bit of study.

Okay then let me rephrase the question. Isn't this exactly what the human auditory system does with dithered signals? When you sum a low-level signal in the audible range with a dither signal that is mostly supersonic, doesn't your ear/brain combine the two in such a way as to regenerate the part of the low-level signal that would have been lost to quantization? And isn't this essentially low-pass filtering?
Title: filtering, dither, and noiseshaping
Post by: Woodinville on 2008-03-04 19:49:41




If one takes a file with noise shaped dither and then low-pass filters it to filter out most of the noise introduced by dithering, has one then potentially increased the bit depth of the resulting file?

Take a look at the "adc" powerpoint deck mentioned above. This is the essence of oversampling using noise shaping.

I was actually hoping for a yes/no answer so I wouldn't have to install powerpoint.

Well, the answer isn't that simple. You're better off doing a bit of study.

Okay then let me rephrase the question. Isn't this exactly what the human auditory system does with dithered signals? When you sum a low-level signal in the audible range with a dither signal that is mostly supersonic, doesn't your ear/brain combine the two in such a way as to regenerate the part of the low-level signal that would have been lost to quantization? And isn't this essentially low-pass filtering?


No, the ear does a lowpass filter at 20kHz or so, mostly because you can't hear anything much above that even if you're 5 years old and never been near an automobile.  The basic ear canal and eardrum system ensures some of that.

But in addition to that the auditory system does a bunch of BANDPASS filtering in the cochlea.  Not lowpass (except for very low frequencies), but BANDpass.

And so the noise in any critical bandwidth is lower than the total system noise. But this happens to any signal, analog, digital, what-have-you-ital.
Title: filtering, dither, and noiseshaping
Post by: Vitecs on 2008-03-05 08:38:53

Is there any sense to dither+NSH while saving material with the same bit-depth? I have weird example: 16 -> reduce volume on 6.02 dB (shift one bit) -> save 16. We probably end-up with dithering "dithered" material in this case?

This is in essence a bit depth reduction. Dividing the values by 2 results in a 17 bit value which must be reduced to 16 bits, therefore dithering is called for.

OK, but "old" (or previous) dither (or part of it) is still there after shifting. Is dithering again makes it worse?
Title: filtering, dither, and noiseshaping
Post by: knutinh on 2008-03-05 09:10:09
I don’t know if a "precision" of less than 24 bits is the proper expression. There are lower limits on circuit noise (without cryogenic cooling), so the electronic noise masks any lower level signals. I think it is more correct to say that the ADC itself  is really 24 bits, but the lowest level bits just are not useful in the real world; they are produced and recorded but they can contain only noise.

I think that Effective Number of Bits is a commonly used measure of real-world ADC/DAC performance. A 24-bit ADC with ENB of 19, performs more or less like a flawless 19bit ADC. I think that is a more relevant number than the width of any digital bus.

I think that as long as the signal is always _processed_ in high-resolution integer/floating-point precision (at the studio and at the consumer), only once dipping into 16 bit integer of CD, then one probably is quite safe. I cannot imagine audio editing programs using 16bit integer precision in intermediate calculations. Note that clever algorithm design may get better performance using lower-precision arithmetic than less-clever designs.

I still think that it seems fair to:
1)Avoid throwing away any precision unless really necessary
2)When necessary, dither instead of truncate

-k
Title: filtering, dither, and noiseshaping
Post by: AndyH-ha on 2008-03-05 20:17:12
Quote
OK, but "old" (or previous) dither (or part of it) is still there after shifting. Is dithering again makes it worse?


CoolEdit/Audition  (and I suspect many other editors) work in 16 bit on 16 bit files, unless the user first deliberately converts to floating point format (I’m not sure about intermediate calculations, but each result is definitely truncated to 16 bit in 16 bit files). There is the option to dither every operation or to not dither.

Unfortunately, or perhaps of some necessity, this dithering is not noise shaped. Some programs may be better in this respect. If so, multiple steps of dithering should be more benign.

Using simple test tones where it is easy to observe the results, we can see (and hear) that dithering is a positive benefit -- for the first few operations. Eventually (after three or four transforms? I don’t remember, my experiments were done some time ago.) two changes occur.
(1) There is now so much dither noise in the data that distortion from further transforms is no longer either visible or audible if dithering is turned off.
(2) The dither itself becomes readily audible (as background hiss). This latter depends on the music, of course. The dither noise is unlikely to be audible during a loud rock passage, but it will be audible in quieter passages, speech, anywhere electronic hiss would be audible. The more dithered transforms done, the louder the dither noise becomes.

If the audio you are starting is not “saturated” with dither, performing one amplify operation will not add all that much more, as far as becoming audible goes. Dithering will therefore be beneficial. Select some quiet passage or a fade out and try it both ways. If dithering doesn’t add noticeable hiss at normal listening volumes, use it. If not dithering results in noticeable distortion, use dither.
Title: filtering, dither, and noiseshaping
Post by: MLXXX on 2008-03-17 15:24:12
If one takes a file with noise shaped dither and then low-pass filters it to filter out most of the noise introduced by dithering, has one then potentially increased the bit depth of the resulting file?

Yes, provided the filtering were done in the analogue domain, then the additional detail captured by the dither (for lower frequency signal content) could be preserved.  The audible bit depth for the low frequency signal could indeed be improved.

But not if the filtering were done in the digital domain.

To be more specific:

[blockquote]Example 1
A low level (peak amplitude 0.3 bit either side of zero) 200Hz sine wave is captured by a 16bit ADC sampling at 44.1KHz.  As part of the capture process, a 10KHz triangular dither (peak amplitude 2 bits either side of zero) is mixed in with signal prior to the ADC.    The resulting 16-bit format digital signal is then fed to a soundcard operating at 44.1Khz feeding a preamplifier which drives a pair of mono headphones through a resistor.  The gain is set high but the 10KHz dither is quite audible, making it more difficult to hear the 200Hz sine wave.  A large value capacitor is then placed in parallel with the mono headphones so as to attenuate (filter) the 10KHz dither by a factor of 10.  This allows the 200Hz signal to be heard more easily above the dither noise.  The effective bit depth of the sinewave exceeds what would be possible without dither. In fact without dither, the sine wave would not be captured at all using a straight 16-bit capture.

Example 2
Same facts as for example 1, but the 16 bit format signal is filtered in the digital domain before being fed to the soundcard DAC (and there is no capacitor in parallel with the headphones).  The twitter of the least significant bits of the 16-bit signal is at 10Khz.  When reduced by a factor of 10 by digital filtering [and without new dither!], the resulting twitter is less than 1/2 bit in amplitude either side of zero. The remaining underlying 200Hz wave is only 0.3 bit in peak amplitude.  Even with fractional bit computation, the 200Hz wave when combined with the attenuated remnant of the twitter is insufficient to register a full bit [a 16-bit least significant bit] either side of zero.  The soundcard is therefore fed a steady signal of zero and, outputs no dither and no 200Hz. In fact it is a mute soundcard![/blockquote]

The above examples may be a little laboured (as I am new to this Forum), but I think they are relevant to the query pdq raised.
Title: filtering, dither, and noiseshaping
Post by: SebastianG on 2008-03-17 17:09:58
But not if the filtering were done in the digital domain.

Not true. Extreme example: dsd2pcm (http://www.hydrogenaudio.org/forums/index.php?showtopic=37717) (lowpass filtering of the 1-bit-DSD-signal + keeping only 1 out of 32 samples to get to the samplingrate of 88200 Hz)

And what's a "10kHz triangular dither"?

Just to remind all of you: There's a difference between coloured dither and a noise shaping quantizer. Dithering is the noise you add before quantization which may be coloured or simply white. A noise shaping quantizer affects the spectral shape of the overall error (dither + quantization error).

Cheers,
SG
Title: filtering, dither, and noiseshaping
Post by: Woodinville on 2008-03-17 19:03:18
Noise-shaping and dither are two different, independent processes.
Title: filtering, dither, and noiseshaping
Post by: MLXXX on 2008-03-17 22:43:54
@ SebastianG,

1.  I was referring to traditional encoding (PCM), not to DSD which I'll have to read up on.
2.  By 10KHz triangular dither I simply meant a triangular waveform at 10KHz.  This is such a simple dithering method it is not realy noise-shaped, unless keeping the dither at a single frequency [10KHz] well above the target audible frequency [200Hz in the example] just falls within the definition.
Title: filtering, dither, and noiseshaping
Post by: AndyH-ha on 2008-03-17 23:03:47
Unless I am forgetting something, the primary attribute of dither is that it is random, thus the quantization errors become random. Were the added noise a regular waveform, the quantization errors would be correlated with the (more or less) regular waveform of the music, rendering the "dither" (probably?) useless for eliminating quantization distortion.
Title: filtering, dither, and noiseshaping
Post by: SebastianG on 2008-03-17 23:45:59
Noise-shaping and dither are two different, independent processes.

That's basically what I was trying to say. Just to make sure this doesn't slip anyone's attention I'm quoting it again.

The computer graphics guys also seem to confuse these (ie. Floyd-Steinberg dithering is actually noise shaping.)

1.  I was referring to traditional encoding (PCM), not to DSD which I'll have to read up on.

It certainly applies to "traditional" PCM encoding as well. Noise shaping could easily help you get a SNR of 120 dB within 0-20 kHz at 16/96. This SNR is preserved when you do proper lowpass filtering digitally, throw every 2nd sample away and store the result with a 24bit sample precision.

2.  By 10KHz triangular dither I simply meant a triangular waveform at 10KHz.

Seems like you're confusing triangular waveform with triangular probability density. No sane person would use a triangular waveform as "dither" signal.

Cheers!
SG
Title: filtering, dither, and noiseshaping
Post by: Woodinville on 2008-03-18 04:14:37

1.  I was referring to traditional encoding (PCM), not to DSD which I'll have to read up on.

It certainly applies to "traditional" PCM encoding as well. Noise shaping could easily help you get a SNR of 120 dB within 0-20 kHz at 16/96. This SNR is preserved when you do proper lowpass filtering digitally, throw every 2nd sample away and store the result with a 24bit sample precision.



I have to point out that 'DSD' is nothing but highly noise-shaped, highly-oversampled PCM.
Title: filtering, dither, and noiseshaping
Post by: MLXXX on 2008-03-18 06:40:02
...

1.  I was referring to traditional encoding (PCM), not to DSD which I'll have to read up on.

It certainly applies to "traditional" PCM encoding as well. Noise shaping could easily help you get a SNR of 120 dB within 0-20 kHz at 16/96. This SNR is preserved when you do proper lowpass filtering digitally, throw every 2nd sample away and store the result with a 24bit sample precision.

Yes if you store with 24bit precision, but I took pdq to be referring to a 16-bit digital format that had been processed to reduce the intensity of the higher frequency components of the dither, and render a result still in a 16-bit format.



2.  By 10KHz triangular dither I simply meant a triangular waveform at 10KHz.

Seems like you're confusing triangular waveform with triangular probability density. No sane person would use a triangular waveform as "dither" signal.

Cheers!
SG


I actually meant a triangular wave at 10KHz!  Not an optimal dither, but it would work.  In my example, triangular is good because it creates a nice smoothly rising and falling dither waveform to combine with the signal waveform prior to ADC.  A square wave would not be as good.  In fact I think it would be useless in the example I have chosen.

Unless I am forgetting something, the primary attribute of dither is that it is random, thus the quantization errors become random. Were the added noise a regular waveform, the quantization errors would be correlated with the (more or less) regular waveform of the music, rendering the "dither" (probably?) useless for eliminating quantization distortion.

I must apologise for using an example that is so far outside normal practice, which is why I think my post has triggered a number of responses pointing out disagreement.  However it is my understanding that a non-random dither signal, although not optimal as a form of dither [for one thing it would be highly audible if within the frequency range of human hearing], will actually reduce quantization errors quite nicely for signals at much lower frequencies. 

I think it is the essence of what pdq was suggesting that by filtering a high frequency dither you may be able to hear more of the lower frequency signal.  I think that is true with analogue filtering 'after the fact', i.e. post the DAC conversion.  But it is not true with digital filtering and still keeping within an original 16 bit format.  You would need to store results at higher than 16-bit precision.
Title: filtering, dither, and noiseshaping
Post by: pdq on 2008-03-18 13:17:31
Yes if you store with 24bit precision, but I took pdq to be referring to a 16-bit digital format that had been processed to reduce the intensity of the higher frequency components of the dither, and render a result still in a 16-bit format.

I actually was referring to a situation, whether digital or analog, where the signal is not requantized to 16 bits after filtering. Obviously if you requantize then you lose any additional bit depth.
Title: filtering, dither, and noiseshaping
Post by: MLXXX on 2008-03-18 14:06:37
I actually was referring to a situation, whether digital or analog, where the signal is not requantized to 16 bits after filtering. Obviously if you requantize then you lose any additional bit depth.

And if you allow requantisation of the processed (i.e. filtered) digital stream but to a greater bit depth (finer resolution) than the source digital stream I think the answer to your query is yes, selective digital filtering of the audible part of the dither could leave desired source content relatively intact and easier to hear above what remained of the dither noise.  This should work out nicely if the dither is concentrated in frequency bands lying above the target audible range for the signal.

So in a 16-bit format PCM stream, dither will normally need to be present in the stream at a significant level to do its work, but if converting that 16-bit stream to a 24-bit format, the level of the dither (relative to the target audible signal content) could usefully be reduced in some circumstances.

Another way of looking at the question posed is that the use of 24-bits allows complete flexibility.  Dither is no longer needed.  It would be possible to use a 16-bit DAC, filter the output in the analogue domain and then use a 24-bit ADC.

I think this topic may have fallen through the cracks a little as in some ways the answer may appear self-evident.  However dither is so often presented in a highly mathematical manner (with references to random uncorrelated dither).  For example, the use of a single fixed frequency of dither is rarely discussed.  The bias used for magnetic audio tape recording is a form of dither and that bias signal is at a fixed frequency much higher than the highest audio frequency intended to be reproduced by the audio tape recorder.

And amplitude modulation radio uses a carrier wave much higher in frequency than the audio signal modulated onto the carrier.

Dither in a 16-bit 44.1KHz PCM environment extends the strict 16-bit digital encoding which exists at up to the Nyquist limit (22.05KHz) [or less in practice because of the need to filter before the Nyquist limit is reached] by a further extent of resolution that -- I presume  -- will not reach up to 22.05KHz, but decidely less, as the dither used for this extension acts as a carrier for the quantisation error and will not offer a sufficiently high sample rate.  Can someone please tell me whether that presumption of mine is correct?  I presume that a 20KHz signal at an amplitude of 0.4 of the least significant bit cannot be successfully dithered in a 44.1KHz 16 bit PCM format, as the dither [I still presume!] would not be fast enough. The result would be, for want of a better word, "sketchy".
Title: filtering, dither, and noiseshaping
Post by: SebastianG on 2008-03-18 16:03:51
And if you allow requantisation of the processed (i.e. filtered) digital stream but to a greater bit depth (finer resolution) than the source digital stream I think the answer to your query is yes, selective digital filtering of the audible part of the dither could leave desired source content relatively intact and easier to hear above what remained of the dither noise. This should work out nicely if the dither is concentrated in frequency bands lying above the target audible range for the signal.

could? should? dither is concentrated in frequency bands lying above the target audible range?
First of all, the primary purpose of dithering is not noise shaping. Even colored dither that fulfills this primary purpose doesn't help you reduce the overall error's power (overall error = dither noise + truncation error) in the "band of interest" by more than 4.7 dB in comparison to plain TPDF dithering because the quantization noise is in this case just white noise on top of the dither noise. That's where noise shaping comes in. Dithering and noise shaping are completely orthogonal. This is the 3rd time this is being mentioned in this thread.
Second, the essence of what I think you tried to formulate is the same thing I was telling you.

So in a 16-bit format PCM stream, dither will normally need to be present in the stream at a significant level to do its work, but if converting that 16-bit stream to a 24-bit format, the level of the dither (relative to the target audible signal content) could usefully be reduced in some circumstances.

Do you know the purpose of dithering? The 2nd part is pretty vague and close to meaningless. Assuming that you still have the 16 bit signal -> lowpass filtering -> 24 bit signal processing chain in mind: Of course you don't need to add dither at the same level you would use when quantizing to 16 bits.

random uncorrelated dither).  For example, the use of a single fixed frequency of dither is rarely discussed.

Why do you think that is?

The bias used for magnetic audio tape recording is a form of dither and that bias signal is at a fixed frequency much higher than the highest audio frequency intended to be reproduced by the audio tape recorder. And amplitude modulation radio uses a carrier wave much higher in frequency than the audio signal modulated onto the carrier.

Relevance?

Dither in a 16-bit 44.1KHz PCM environment extends the strict 16-bit digital encoding which exists at up to the Nyquist limit (22.05KHz) (...) by a further extent of resolution that -- I presume  -- will not reach up to 22.05KHz, but decidely less, as the dither used for this extension acts as a carrier for the quantisation error and will not offer a sufficiently high sample rate. (...) as the dither [I still presume!] would not be fast enough. (...)

That's a lot of nonsense that is.

Cheers,
SG
Title: filtering, dither, and noiseshaping
Post by: pdq on 2008-03-18 16:50:33
The bias used for magnetic audio tape recording is a form of dither and that bias signal is at a fixed frequency much higher than the highest audio frequency intended to be reproduced by the audio tape recorder.

No, the bias has nothing to do with dither. The magnetic tape has hysterisis and so small signals would not be recorded or would be much smaller in amplitude if it were not for the bias signal.
Title: filtering, dither, and noiseshaping
Post by: 2Bdecided on 2008-03-18 18:05:22

The bias used for magnetic audio tape recording is a form of dither and that bias signal is at a fixed frequency much higher than the highest audio frequency intended to be reproduced by the audio tape recorder.
No, the bias has nothing to do with dither. The magnetic tape has hysterisis and so small signals would not be recorded or would be much smaller in amplitude if it were not for the bias signal.
Conceptually, that's "similar" to the LSB; hence dither is "similar" to bias, though I wouldn't want to push the analogy.


As mixed up as MLXXX may have been at points in this thread, the specific idea of using dither and/or noise shaping to ensure the audible range is roughly linear and has lower noise, while concentrating more dither and/or requantisation noise at higher frequencies, does allow you to use the trick that was suggested: take the 16-bit version, (process it in 24-bit, floating point, or analogue!), filter out the noise above 20kHz, and end up with an 18-bit (for example) equivalent version. It's not magic.


btw - "narrow band dither" - an example is UV22, isn't it? So it's not that rare or undiscussed. Not sure/convinced of the theory behind it, but it's not secret.

Cheers,
David.
Title: filtering, dither, and noiseshaping
Post by: Woodinville on 2008-03-18 18:14:02

The bias used for magnetic audio tape recording is a form of dither and that bias signal is at a fixed frequency much higher than the highest audio frequency intended to be reproduced by the audio tape recorder.

No, the bias has nothing to do with dither. The magnetic tape has hysterisis and so small signals would not be recorded or would be much smaller in amplitude if it were not for the bias signal.


While they may appear similar to some people, because tape bias is a way to decorrelate the hysteresis, and dither decorrelates quantization noise, their mechanisms are very different.

There is no way to individually dither each particle in magtape.

There is a way to individually dither each sample.

In magtape, the dither is larger than the signal.

In PCM, the dither is at the smallest signal level, give or take.

In magtape, the high freuqency is used to get a distribution of domains in the head gap.

In PCM, wideband dither ensures that you don't get any crossmodulation between the dither and the quantization error.

They are entirely different things.

As mixed up as MLXXX may have been at points in this thread, the specific idea of using dither and/or noise shaping to ensure the audible range is roughly linear and has lower noise, while concentrating more dither and/or requantisation noise at higher frequencies, does allow you to use the trick that was suggested: take the 16-bit version, (process it in 24-bit, floating point, or analogue!), filter out the noise above 20kHz, and end up with an 18-bit (for example) equivalent version. It's not magic.



You're confusing dither and noise shaping.

IF you use "ultrasonic dither" you still have quantization noise everywhere in the baseband.  Convolve the dither spectrum with every harmonic of every part of the signal, and add them together (knowing the total magnitude), you get an example of the quantization noise with narrowband dither. Notice that it's going to be wideband.


Noise shaping pushes the noise around in frequency while resulting in the same total noise.

Dither ~= noise shaping as somebody's said a few times already.
Title: filtering, dither, and noiseshaping
Post by: pdq on 2008-03-18 18:54:36
How about my other question. If 16-bit dithered audio is played back, and the dither is inaudible because it is above the limit of one's hearing, does its presence nonetheless allow us to hear lower frequencies at less than 1 lsb in amplitude?
Title: filtering, dither, and noiseshaping
Post by: Woodinville on 2008-03-18 19:40:13
How about my other question. If 16-bit dithered audio is played back, and the dither is inaudible because it is above the limit of one's hearing, does its presence nonetheless allow us to hear lower frequencies at less than 1 lsb in amplitude?


First, let me point out that the QUANTIZATION noise can be above your high frequency cutoff, and that will be due to NOISE SHAPING, not dither!

If you use noise-shaping and put all the quantization noise above the threashold of hearing, and that noise doesn't cause some electronics to go wonky, yes, you will get lower frequencies at less than 1 lsb.

Any delta-sigma convertor on the market proves this trivially,and nearly all convertors are delta-sigma these days.

But it isn't DITHER that moves the quantization noise to high frequencies, and saying "the dither is above the limint of one's hearing" isn't something that happens.  The quantization noise can be. The dither is just part of the quantization noise, but the spectrum of the dither that's added to the original signal is NOT what theq uantization noise spectrum will look like.
Title: filtering, dither, and noiseshaping
Post by: cabbagerat on 2008-03-18 19:44:40
How about my other question. If 16-bit dithered audio is played back, and the dither is inaudible because it is above the limit of one's hearing, does its presence nonetheless allow us to hear lower frequencies at less than 1 lsb in amplitude?
Yes, or at least allow these signals to be detected if they are not audible. Assuming, or course, that by "above the limit of one's hearing" you mean "below the limit of audibility" and by "16bit dithered" you mean "with application of suitable noise shaping". Noise shaping can therefore increase the effective dynamic range in some frequency band of interest at the cost of dynamic range in some other frequency band. This property is what makes noise shaping much more interesting for audio signals (where some bands are more important) than for radar signals (where all frequency bands are equally important).

The wikipedia article on noise shaping (http://en.wikipedia.org/wiki/Noise_shaping) is worth a read. It covers the information under discussion here fairly well. From the article:
Quote
Not all algorithms that reduce bit depth by spreading the noise around are noise shapers. UV-22 and UV-22HR by Apogee, for example, are 24 bit to 16 bit dither algorithms that merely use colored (filtered) dither. This does not involve a feedback loop and does not involve the filtering of the quantization error, but merely involves pre-filtering the dither noise.


Edit: Stop spreading the dither/noise shaping confusion.
Title: filtering, dither, and noiseshaping
Post by: MLXXX on 2008-03-18 23:02:15

Dither in a 16-bit 44.1KHz PCM environment extends the strict 16-bit digital encoding which exists at up to the Nyquist limit (22.05KHz) (...) by a further extent of resolution that -- I presume  -- will not reach up to 22.05KHz, but decidely less, as the dither used for this extension acts as a carrier for the quantisation error and will not offer a sufficiently high sample rate. (...) as the dither [I still presume!] would not be fast enough. (...)

That's a lot of nonsense that is.

Well SebastianG is obviously not on the same wavelength as I am on this, no pun intended.

I presume from this that the answer to my question is 'no', even a 20KHz low amplitude signal can benefit from dither in a 44.1KHz PCM environment, as much as a lower frequency source signal can benefit?


The bias used for magnetic audio tape recording is a form of dither and that bias signal is at a fixed frequency much higher than the highest audio frequency intended to be reproduced by the audio tape recorder.

No, the bias has nothing to do with dither. The magnetic tape has hysterisis and so small signals would not be recorded or would be much smaller in amplitude if it were not for the bias signal.


While they may appear similar to some people, because tape bias is a way to decorrelate the hysteresis, and dither decorrelates quantization noise, their mechanisms are very different.

There is no way to individually dither each particle in magtape.

There is a way to individually dither each sample.

In magtape, the dither is larger than the signal.

In PCM, the dither is at the smallest signal level, give or take.

In magtape, the high freuqency is used to get a distribution of domains in the head gap.

In PCM, wideband dither ensures that you don't get any crossmodulation between the dither and the quantization error.

They are entirely different things.


Using a very broad definition, dither can be described as a waveform added to the source signal for the purpose of reducing the effects of non-linearities in the transfer characteristic of a device used to convey the source signal.  The original waveform can be recovered at a better quality at the output than if dither had not been used. 

In the case of magnetic tape, there is a non-linearity in the transfer characteristic of the extent of magnetism the tape retains after it has passed in front of the recording head, as a function of the current that passed through the recording head.  This non-linearity is worse as a result of hysteresis in the transfer curve [it is different on the way down compared to the way up].

I note that digital quantisation can be viewed as a particular kind of non-linearity of transfer characteristic. It is stepped.

The possibilities for the dither waveform are infinite.  It can be white noise, shaped noise (commonly used these days and a quite complex process) or a fixed relatively high frequency [as in my example of a triangular waveform at 10KHz].

Many people who contribute to these threads are well versed in optimal forms of dither, and with the mathematical description of the dither being random and independent of the source waveform.  From that perspective, it may be difficult to answer some seemingly basic questions, as the maths involved to present the matter even broadly, could be quite complex.  Certainly the mathematics involved are outside my experience [though if someone presented the material simply and clearly I could hopefully understand the presentation!].

One way around any difficulties of analysis would of course be practical testing.  For example it seems to have been implied that a 20KHz low amplitude waveform can be substantially enhanced with dither in a 44.1/16 environment [whatever theoretical explanation may or may not apply as to whether or not this ought to be possible].  I have not tried to test this myself.  I assume others will have tried something like it.  The question I am posing is whether the quantisation error in sampling a low amplitude 20KHz wave (let us say a sine wave) can be corrected by dither when the format is 44.1KHz/16bits.  As I said in my earlier post (#39):

[blockquote]I presume that a 20KHz signal at an amplitude of 0.4 of the least significant bit cannot be successfully dithered in a 44.1KHz 16 bit PCM format, as the dither would not be fast enough. The result would be, for want of a better word, "sketchy".[/blockquote]
Title: filtering, dither, and noiseshaping
Post by: 2Bdecided on 2008-03-19 11:04:53
[blockquote]I presume that a 20KHz signal at an amplitude of 0.4 of the least significant bit cannot be successfully dithered in a 44.1KHz 16 bit PCM format, as the dither would not be fast enough. The result would be, for want of a better word, "sketchy".[/blockquote]
That's wrong - it works "perfectly", as the theory suggests. It would take you less than a minute in Cool Edit to demonstrate this.

You're confusing dither and noise shaping.

IF you use "ultrasonic dither" you still have quantization noise everywhere in the baseband.  Convolve the dither spectrum with every harmonic of every part of the signal, and add them together (knowing the total magnitude), you get an example of the quantization noise with narrowband dither. Notice that it's going to be wideband.


Noise shaping pushes the noise around in frequency while resulting in the same total noise.

Dither ~= noise shaping as somebody's said a few times already.
I'm not confusing dither with noise shaping. I think I understand standard dither (e.g. 1 LSB RMS tri-PDF white), noise shaping, and both used together, fairly well.

What I don't understand is "ultrasonic" "dither" like UV22. It "claims" to leave the quantisation noise level in the audio band unchanged (i.e. same RMS level as with no dither), adds dither noise only at ultrasonic frequencies, but still manages to decorrelate the quantisation noise from the signal (so the quantisation noise is flat and harmonic-free). Yes, the noise level in-band could be even lower with noise shaping - I understand that. No, this "dither" isn't noise shaping - I understand that. What I don't understand is how a couple of high frequency sine waves (which is all UV22 appears to be) can work as correctly decorrelating dither.

Your explanation ("Convolve the dither spectrum with every harmonic of every part of the signal") implies to me that UV22 should leave a right mess - but supposedly it doesn't.

What am I missing?

Cheers,
David.
Title: filtering, dither, and noiseshaping
Post by: pdq on 2008-03-19 12:03:43

[blockquote]I presume that a 20KHz signal at an amplitude of 0.4 of the least significant bit cannot be successfully dithered in a 44.1KHz 16 bit PCM format, as the dither would not be fast enough. The result would be, for want of a better word, "sketchy".[/blockquote]
That's wrong - it works "perfectly", as the theory suggests. It would take you less than a minute in Cool Edit to demonstrate this.

If I understand what you are saying, even though the dither has frequency components both above and below the 20 kHz signal, it will still make that signal audible when it otherwise would not. The 20 kHz tone will be audible in the presence of audible noise resulting from the dither.
Title: filtering, dither, and noiseshaping
Post by: MLXXX on 2008-03-19 12:58:53

[blockquote]I presume that a 20KHz signal at an amplitude of 0.4 of the least significant bit cannot be successfully dithered in a 44.1KHz 16 bit PCM format, as the dither would not be fast enough. The result would be, for want of a better word, "sketchy".[/blockquote]
That's wrong - it works "perfectly", as the theory suggests. It would take you less than a minute in Cool Edit to demonstrate this.

I'm not that quick, David.  It took about 10 minutes, and all I could hear was hiss.  This is what I did:

[blockquote]1. Used Cooledit to create a 20KHz sinewave at -80dB in 44.1/32 format.  Reduced that by 20dB to get -100dB.
2. Used Audacity to convert the 44.1/32 format to 44.1/16 with shaped dither.
3. Played back the 44.1/16 file at 8KHz (using other software) so that the 20KHz sinewave should have been audible as a 3.628KHz sine wave (a frequency I can hear much more readily than 20KHz).[/blockquote]
All I could hear was hiss. And all I could see on the audio spectrum [Cooledit or Audacity] was huge amounts of noise shaped dither.

I may be interpreting the result incorrectly.  But prima facie the -100dB sinewave did not benefit from the dither.

I then repeated the exercise with a 2KHz sinewave.  This took only 2 minutes, as I knew the steps to follow. The 2KHz waveform was clearly audible above the dither noise in the 44.1/16 format, despite being at -100dB.

Now I don't want anyone to accept what I did as conclusive.  I am a rookie when it comes to this type of exercise.  That is why I have asked for advice as to the answer to the question.  I would like others to comment on whether the result I obtained was to be expected.

If it was, is there some other dither that will give a better result? Intuitively I don't see how a 20KHz signal can be well dithered in a 44.1/16 environment.  The dither can not be faster than 22.05KHz, and that is not fast enough to capture 20KHz quantisation error effectively, or so I would presume.

The wikipedia article on noise shaping (http://en.wikipedia.org/wiki/Noise_shaping) is worth a read. It covers the information under discussion here fairly well.

Thanks cabbagerat.  I see that noise shaping is quite a different methodology.  I will have to try to understand it, and think through the implications.
Title: filtering, dither, and noiseshaping
Post by: SebastianG on 2008-03-19 14:11:09
Common terminology consistent with the works of Lipshitz, Vanderkooy and Wannamaker:
dither = the signal you add right before quantization
quantization errors = another noise source due to the quantizer
overall/total error = the sum of both above.
Proper dithering makes the 2nd noise source (quantization errors) a source of white noise.
The noise shaping technique can alter the spectral shape of the overall/total error.

The wikipedia article on noise shaping (http://en.wikipedia.org/wiki/Noise_shaping) is worth a read.

Of course there's colored dither out there. But a proper colored dither is just colored dither. It doesn't affect the spectral shape of quantization errors -- only the spectral shape of the overall/total error to some very limited extent. That's why "spreading the noise around" (quote from the wikipedia article) is kind of a misnomer, IMHO.

In case of the UV22 dither you still get a lot of noise in the base band due to the quantizer that adds white noise. Colored dither doesn't help you when you want the the noise floor (total error) to drop by more than 4.7 dB in some frequency band (compared to white TPDF dither). No matter what kind of crazy dither you are using.

Well SebastianG is obviously not on the same wavelength as I am on this, no pun intended.

It may also be a terminology issue.

I presume from this that the answer to my question is 'no', even a 20KHz low amplitude signal can benefit from dither in a 44.1KHz PCM environment, as much as a lower frequency source signal can benefit?

Sure, if by "benefit" you mean that your signal doesn't get lost like in undithered quantization.

What I don't understand is "ultrasonic" "dither" like UV22. It "claims" to leave the quantisation noise level in the audio band unchanged (i.e. same RMS level as with no dither), adds dither noise only at ultrasonic frequencies, but still manages to decorrelate the quantisation noise from the signal (...) What I don't understand is how a couple of high frequency sine waves (which is all UV22 appears to be) can work as correctly decorrelating dither.

Good question! UV22 seems to be just "filtered iid-RPDF-noise". The paper (http://music.calarts.edu/~rwannama/writings/ieee.pdf) by Wannamaker et al also covers this kind of dither noise (see theorem 7 at page 40) but I have to admit that I'm not sure about its implications and how this exactly relates to UV22 assuming it fits the mentioned category of filtered nRPDF noise. For example: What exactly means "the total error will be wide-sense stationary and independent of the system input"? This can't be true in case of n=1, c_1=0.1 c_2=-0.1 for example, can it?. So, I was missing some more constraints on the c_is' magnitudes.

One last quote from the linked Wannamaker paper from the conclusion section:
"The use of spectrally-shaped dither will usually be superseded, however, by the powerful technique of noise shaping."

More you ever wanted to know about this is probably here (http://www.iet.ntnu.no/courses/fe8114/files/Wannamaker_phd_2003.pdf) (Robert Wannamaker's PhD thesis).

Cheers,
SG
Title: filtering, dither, and noiseshaping
Post by: 2Bdecided on 2008-03-19 14:21:50
EDIT: this is in reply to MLXXX, post 50.

Why did you use noise shaped dither?

If you push all the noise above ~16kHz, then it'll probably hide a 20kHz signal!

I've attached the frequency plots for 20kHz, -100dB (generated the same way as you), converted to 16-bit without dither, and with 1LSB triangular dither (no noise shaping).

The 20kHz tone survives, distortion-free, as expected.

Cheers,
David.
Title: filtering, dither, and noiseshaping
Post by: MLXXX on 2008-03-19 15:03:55
Why did you use noise shaped dither?

If you push all the noise above ~16kHz, then it'll probably hide a 20kHz signal!


Yes probably a bad idea.  I've redone it with 1LSB triangular dither no noise shaping (in Cooledit).
[Edit - results below at #55]

Did you notice that your graphs are showing -60dB rather than -100dB?

I think you did not reduce the signal amplitude sufficiently.
Title: filtering, dither, and noiseshaping
Post by: Kees de Visser on 2008-03-19 15:15:30
2Bdecided, are you sure the signal was at -100 dBFS ?
I wouldn't expect it to show up at all after truncation to 16 bits (without dithering).
Title: filtering, dither, and noiseshaping
Post by: MLXXX on 2008-03-20 11:18:01
Since my previous post I have used Cooledit to:
[blockquote]1.  Generate a mono 44.1KHz/32 bit (float) waveform with a single tone at -80dB
2.  Reduce the amplitude by 20dB
3.  Do a mixdown at 16bits wih 1LSB triangular dither (no shaping), and save.[/blockquote]

I then examined the saved mixdown:
(a) using the frequency analysis graph cooledit provides
(b) by listening to the file but playing it back at a sample rate of 8KHz instead of 44.1KHz.

Results I obtained were:

1.  The tone could be identified in the cumulative frequency analysis graph of the whole clip (slightly above the noise), but was more readily identified by observing the instantaneous frequency analysis, by setting Cooledit to play the waveform.  A 20KHz -100dB tone was as prominent in the graph as a 2KHz -100dB tone.

2. The higher the frequency of the tone, the more difficult it was to hear it above the dither noise.  In particular, the 20KHz tone tended to blend in with the dither, despite the whole file being played back at less than 1/5th speed, bringing the 20KHz tone into a more readily audible range.  [It became a 3628Hz tone as a result of the slow playback.]

I was surpised that the 20KHz tone showed up at a similar intensity level in the frequency analysis graph to lower frequency tones I tried.  On the other hand, I could not fail to notice how much more difficult it was to hear the 20Khz tone above the dither noise compared with lower frequency tones

For example, the 20KHz tone did not benefit from the dither as much as a 2KHz tone.

I did not experiment with other varieties of dither.  I suspect all forms of dither would struggle to make a low amplitude 20KHz waveform audible above dither/quantisation noise, where the format is 44.1/16 PCM.
Title: filtering, dither, and noiseshaping
Post by: 2Bdecided on 2008-03-20 11:31:24
2Bdecided, are you sure the signal was at -100 dBFS ?
I wouldn't expect it to show up at all after truncation to 16 bits (without dithering).
It was +/- 0.33 LSB peak amplitude.

Whether this toggles the LSB in the output or not (without dither) depends entirely on the rounding used in the software. In Cool Edit, it does.


Did you notice that your graphs are showing -60dB rather than -100dB?

I think you did not reduce the signal amplitude sufficiently.
I did the test correctly. The frequency analysis dB scale is uncalibrated. You can reproduce the exact same graph using the FFT length, range and offset values shown in my image.


2. The higher the frequency of the tone, the more difficult it was to hear it above the dither noise.  In particular, the 20KHz tone tended to blend in with the dither, despite the whole file being played back at less than 1/5th speed, bringing the 20KHz tone into a more readily audible range.  [It became a 3628Hz tone as a result of the slow playback.]

I was surpised that the 20KHz tone showed up at a similar intensity level in the frequency analysis graph to lower frequency tones I tried.  On the other hand, I could not fail to notice how much more difficult it was to hear the 20Khz tone above the dither noise compared with lower frequency tones

For example, the 20KHz tone did not benefit from the dither as much as a 2KHz tone.

I did not experiment with other varieties of dither.  I suspect all forms of dither would struggle to make a low amplitude 20KHz waveform audible above dither/quantisation noise, where the format is 44.1/16 PCM.
This is entirely false.

The high frequency fall off you are hearing is due to your sound card, windows internal wave handling, and maybe your ears. The former two will fall off around the Nyquist frequency, whatever sample rate you choose for playback.

The frequency graphs show you what is actually there - 2kHz, 20kHz and even 200Hz - all are equally helped by dither. There is no frequency dependent effect.


If you look at the FAQ, you can find other threads where people join HA to explain why universally held theories are wrong, and proceed to prove this by incorrect use of hardware or software.

It's quite amusing, but we already have enough of these threads!

Please trust the frequency analysis: it is, in this case, correct.

Cheers,
David.

P.S. I'm not trying to be rude or harsh, but when you realise what you're claiming, you'll be surprised at the arrogance of it!
Title: filtering, dither, and noiseshaping
Post by: MLXXX on 2008-03-20 12:42:19
The high frequency fall off you are hearing is due to your sound card, windows internal wave handling, and maybe your ears. The former two will fall off around the Nyquist frequency, whatever sample rate you choose for playback.

I was reluctant to perform the exercise that you suggested I could do in under a minute. I downloaded Cool Edit Pro only a week ago and have barely used it.  I anticipated there would be variables I would be unfamiliar with.  And you have listed a few potential variables I did actually consider and I'm sure there are more.

I see now that you in fact changed the scale on your frequency analysis plot by 40dB by changing the reference level.  When I change the various settings to match yours, I do not get the clear graphs you get, but ones showing the noise at a much closer level to the signal.  Anyway that is a detail I will not worry about.

I will concede that the 20KHz response is definitely there, and this differs from my intuitive hypothesis that it might hardly be present at all.

I also acknowledge that the intensity level shows up as at least approximately the same as for lower frequencies.  Whether under ideal conditions it is as easy to hear above the dither noise (something about which I still entertain doubts), becomes less important with 44.1KHz as we are moving away from that to 48KHz as a minimum sampling rate.

Although my hearing extends to about 21KHz, the response is much less than at lower frequencies.  This is a further reason for the topic to be moot, as most of us will not be able to hear higher frequency content that is commensurate with quantisation error.

On the whole I've found material I've read in HA quite stimulating, and I anticipate I will stick around a bit longer.

Regarding an attitude of arrogance I suppose it may have been presumptuous of me to query your graphs [though they do look so different to mine] but I have to say that as a newcomer I have received almost a barrage of negative remarks in this particular thread.  My initial purpose was to clarify that you can usefully reduce higher frequencies in the dither/quantisation noise in instances where the target signal is at lower frequencies; something that is at once almost self-evident but on the other hand probably difficult to explain mathematically.

And it is something pdq had requested an answer to.

His question has been answered in the affirmative, subject to the proviso that you cannot do the filtering in the digital domain (traditional 16 bit PCM) without retaining the result of the filtering at a greater precision.  This proviso to some people (even pdq himself) was sufficiently obvious not to need mentioning.
Title: filtering, dither, and noiseshaping
Post by: 2Bdecided on 2008-03-20 14:43:07
I see now that you in fact changed the scale on your frequency analysis plot by 40dB by changing the reference level.  When I change the various settings to match yours, I do not get the clear graphs you get, but ones showing the noise at a much closer level to the signal.  Anyway that is a detail I will not worry about.
I generated a 1 second long tone, I selected the entire waveform, and clicked "scan" in the frequency analysis window. This averages the results of the analysis windows across the selection, rather than just showing you the result from one analysis window (the middle one).

Even with the reference changed from -40dB to 0dB, you shouldn't trust the graph 100%. It's nearly correctly for some settings, but not "calibrated". It'll jump around by a few dB if you change the window function, for example.


Quote
Regarding an attitude of arrogance I suppose it may have been presumptuous of me to query your graphs
No, it wasn't that - I don't mind people disagreeing with me! What you're doing by questioning whether dither "works" is questioning decades of work by people far more qualified than you or I. It's fair enough to question, and lots of "qualified" people have been wrong before, but the evidence in this case is overwhelming.

Cheers,
David.
Title: filtering, dither, and noiseshaping
Post by: MLXXX on 2008-03-20 15:18:29
What you're doing by questioning whether dither "works" is questioning decades of work by people far more qualified than you or I. It's fair enough to question, and lots of "qualified" people have been wrong before, but the evidence in this case is overwhelming.

I was not questioning whether dither 'works'.  It has been apparent to me for some years that it does.

What I was querying is how effective it is for a signal approaching the Nyquist limit.  Intuitively for me that is where a weakness could lie.  But I also realise it is where a weakness could be least noticeable.

Cheers,
1080
Title: filtering, dither, and noiseshaping
Post by: SebastianG on 2008-03-20 15:41:54
What I was querying is how effective it is for a signal approaching the Nyquist limit.

What do you mean by effective?
Title: filtering, dither, and noiseshaping
Post by: MLXXX on 2008-03-20 16:07:34

What I was querying is how effective it is for a signal approaching the Nyquist limit.

What do you mean by effective?

1. THD comes to mind, e.g. I would speculate that a low amplitude 10KHz tone would give more 2nd order harmonic than a 5Khz tone, after conversion to 44.1/16.  I know  this would depend on the particular dither protocol used, but as a general statement does this speculation have any validity?

2. S/N ratio comes to mind.  I presume that you cannot dither a 20KHz tone without using noise at around 20KHz or beyond.  So inevitably noise will encroach.  In contrast, for frequencies much lower than Nyquist, you can place the dither noise above the frequencies of interest.  Particularly with noise shaping it seems that the frequency range just below Nyquist may become quite noisy.  I suspect that if you are trying to hear a frequency of interest, it is distracting to hear noise concentrated at around the same frequency.  (So distracting, the frequency of interest may cease to be audible.)

3. IMD only came to mind this evening when I was listening to dithered -100dB signals.  The 20KHz signal seemed to intermodulate with the dither noise creating spurious sounds.  Sorry this is a bit vague but I almost felt I could hear a lower frequency tone as well as the actual 20KHz tone.  I guess this could also occur with a low frequency signal.
Title: filtering, dither, and noiseshaping
Post by: pdq on 2008-03-20 16:45:34
In the case of the small 20 kHz signal, if one applied low frequency dither (i.e. send it through a low-pass filter before applying it) then the 20 kHz signal would sometimes be not present and other times present as a 1 lsb signal. On average, though, wouldn't it be present and in the correct amplitude and audible over the low-frequency dither?
Title: filtering, dither, and noiseshaping
Post by: SebastianG on 2008-03-20 17:35:48
1. THD comes to mind (...)
3. IMD (...)

Properly dithered quantization --> No THD, no IMD, no nothing except for some noise.
Doing it properly is soooo easy: Just use white TPDF-noise with "2 bits peak-to-peak" as dither.
End of story.

2. S/N ratio comes to mind ....

If you're not happy with the white noise floor you'll be getting you could use noise shaping (http://wiki.hydrogenaudio.org/index.php?title=Noise_shaping) as well and/or use a higher bit depth. Note: Noise shaping is not the same as using a colored(*) dither.

.... I presume that you cannot dither a 20KHz tone without using noise at around 20KHz or beyond.

If you're interested in constraints about dither in order to be "effective" you should check Wannamaker's dissertation. Anyhow, why do you still tackle those questions when there's a simple, effective, and proven method available to do things the right way?

edit: (*) colored = opposite of white = not a flat power spectrum.
Title: filtering, dither, and noiseshaping
Post by: Woodinville on 2008-03-20 18:52:11
1. THD comes to mind, e.g. I would speculate that a low amplitude 10KHz tone would give more 2nd order harmonic than a 5Khz tone, after conversion to 44.1/16.  I know  this would depend on the particular dither protocol used, but as a general statement does this speculation have any validity?



No,it wouldn't.

Neither would give you any harmonics IF YOU DITHER CORRECTLY. White, TPD dither.

Try it, you'll like it.
Title: filtering, dither, and noiseshaping
Post by: SebastianG on 2008-03-21 14:46:59
Here's something I've been thinking about regarding white versus colored dither. Maybe anyone knowledgable can verify and comment on it. If I'm right colored dither can outperform white dither. Please read on:

An interesting question is IMHO if it's actually worth using non-white dithers especially in the light of the noise shaping technique. To check this my idea was to compare plain "white TPD dither" with Wannamaker's "high pass TPD dither" (page 37) (http://music.calarts.edu/~rwannama/writings/ieee.pdf). According to Wannamaker et al this kind of dither is also appropriate which I presume means decorrelated moments of signal and error for the first two orders. To compare the performance we could use noise shaping to compensate for the colored error and then check how this relates in terms of power to the error we get by using plain white TPD dither.

According to Wannamaker the autocorrelation of the error using this "high pass dither" is
[... 0 0 0 -1 3 -1 0 0 0 ...]  (normalized so that the center coefficients corresponds to the variance in multiples of LSB^2/12)
The autocorrelation of the error using the plain white TPD dither is
[... 0 0 0 0 3 0 0 0 0 ...]  (normalized as above)

The noise transfer function for whitening the colored error should be N(z) = 1/(1 - r z^-1) where r is the root inside the unit circle of the polynomial x^2-3x+1, approximately 0.38197. To get the autocorrelation of the whitened error we can simply apply this filter bidirectionally on the original autocorrelation:
filtfilt(1,[1 -r],[... 0 0 0 -1 3 -1 0 0 0 ...]) --> [... 0 0 0 2.61803 0 0 0 ...]
The result is a scaled unit impulse (white). Incidently the scale is the other root of the polynomial from above -- (3+sqrt(5))/2=2.61803 -- and is equivalent to the error's variance in terms of LSB^2/12 which is lower than 3.

So, in case I didn't make any mistakes the use of the "high pass dither" is preferable because the noise floor is lower by log10(3/2.61803)*10 = 0.59 dB. Of course, the 0.59 dB improvement is hardly noticable but it sure was a big surprise for me!

Can anyone confirm this or point out any mistakes I possibly made?
I think I'm going to run some simulations...


Cheers,
SG
Title: filtering, dither, and noiseshaping
Post by: MLXXX on 2008-03-22 14:26:10
I generated a 1 second long tone, I selected the entire waveform, and clicked "scan" in the frequency analysis window. This averages the results of the analysis windows across the selection, rather than just showing you the result from one analysis window (the middle one).

Even with the reference changed from -40dB to 0dB, you shouldn't trust the graph 100%. It's nearly correctly for some settings, but not "calibrated". It'll jump around by a few dB if you change the window function, for example.

Thanks for that.  I have now been able to replicate your graphs.

But I have come up with an anomaly.  When I use my version of cool edit pro (2.00 build 2095) to generate a stereo sine wave it seems to generate the right channel differently.  This is apparent when looking at the frequency distribution of the 32 or 24 bit wave immediately after it is generated: the right-hand channel has a 'fatter' distribution.

And after dithering to 16-bits, odd order harmonics are visible, but only in the right channel. I do not know whether others have encountered this.  Here is what the frequency distribution looks like for a 5 second clip recorded at -50dB using a triangular pdf dither (set to 2 bits). This was all done in Cool Edit and the result was the same on an old pc running XP and a newer pc running Vista:-

Tone Generator Query (http://www.hydrogenaudio.org/forums/index.php?act=Attach&type=post&id=4331)

The difference is real. After separating the channels, I was able to successfully ABX them.  [Interestingly, the channel with the harmonics actually sounded 'purer' to my ears than the one without.]

I have to assume that I have used an incorrect setting, or the version of cool edit had a minor bug.

Although I know that some forms of stereo encoding use L+R in one channel and a difference signal in the other channel (e.g. FM radio), I do not think that is the method for standard 16 or 24 bit stereo PCM at 44.1KHz. When I used other software (Audacity) to generate a 4KHz stereo sinewave, both channels were the same.

Can anyone confirm this or point out any mistakes I possibly made?
I think I'm going to run some simulations...

Hi Sebastian.  I have read the paper, but its mathematics are well beyond my current comprehension.  I can only offer an intuitive comment, and it is that the lower frequency components of dither are probably redundant.  This may be why it can be slightly more efficient to start with coloured noise.
Title: filtering, dither, and noiseshaping
Post by: MLXXX on 2008-03-22 15:20:51
In the case of the small 20 kHz signal, if one applied low frequency dither (i.e. send it through a low-pass filter before applying it) then the 20 kHz signal would sometimes be not present and other times present as a 1 lsb signal. On average, though, wouldn't it be present and in the correct amplitude and audible over the low-frequency dither?

I am probably one of the least qualified people of those contributing to this thread to comment on this but I will try.

First off, if ordinary triangular probability distribution function (TPDF) dither is used, the frequency components of the dither can exceed the Nyquist limit.  I say this because the TPDF is typically generated with random numbers.  It is possible that from one sampling instant (say 44.1KHz sampling) to the next, the dither can vary in instantaneous amplitude from +1 (least significant bit) to -1.  [Here I think is where I fell into error with my own intuitive analysis. I had assumed the dither would need to be filtered to half the sampling frequency.  In fact that filtering (necessary to avoid aliases) can occur after the dither is applied.]

Your suggestion of filtering the dither before it is applied would dramatically reduce its maximum frequency components.  I do not see how if so constrained it could be at all effective for signals at high frequencies. For example, if you limited the dither to a maximum component frequency of 10KHz I am sure it would be insufficient to rescue a low amplitude 20KHz signal from quantisation error.  However others may have more specific (and informed!) comments to make.

Handy software for simple real time experimenting with dither can be found on the following webpage: ditherer (http://www.ohl.to/about-audio/audio-softwares/downloads/)
Title: filtering, dither, and noiseshaping
Post by: cabbagerat on 2008-03-25 05:57:48
First off, if ordinary triangular probability distribution function (TPDF) dither is used, the frequency components of the dither can exceed the Nyquist limit.
No. Any samples you can generate do not exceed the Nyquist limit, by definition. The analogue signal is recovered from the samples by a bandlimited process, which by definition cannot produce frequencies about fs/2. Perhaps what you mean is that the noise will no longer be white (that is, have a flat PSD) - and here you are still mistaken. Provided there is no correlation between samples, the PSD of the produced spectrum will be flat - whether the PDF of the noise is triangular, Gaussian, or any other.
Title: filtering, dither, and noiseshaping
Post by: MLXXX on 2008-03-25 09:56:27
Cabbagerat, I have been wrong so many times previously in this thread it is not surprising to me that you commenced your post immediately above with the word 'No'.

However, did you read my post carefully, particularly the part in italics?  I referred to the fact that filtering could be applied after the dither process.

I do not understand your use of the phrase 'by definition'.  If you generate a set of random numbers at 44.1KHz you will generate instantaneous slew rates beyond what a low amplitude continuous 22.05KHz wave would involve.  Theoretically you could have a series of numbers as follows: +1, -1, +1, -1. [although the probability of that exact series would be extremely low]

Intuitively [for me anyway], you need freedom of the dither to change its value as fast as possible, and not to be filtered down to 22.05KHz.  A low amplitude continuous 22.05KHz wave (or a little below 22.05KHz) could lead to the following instantaneous samples at 44.1KHz sampling: +1, 0, -1, 0, +1, 0, -1, 0

But if someone can confirm dither is filtered down before it is combined with the signal, I will have to reconsider my intuitive understanding.
Title: filtering, dither, and noiseshaping
Post by: pdq on 2008-03-25 10:11:37
I do not understand your use of the phrase 'by definition'.

I think I can answer this one. A series of samples at 44.1 khz cannot be used to represent any frequency above 22.05 khz because there will be a perfectly valid frequency below 22.05 khz which also goes through those exact same samples. Therefore 'by definition' all of the resulting frequencies are below the Nyquist limit.
Title: filtering, dither, and noiseshaping
Post by: cabbagerat on 2008-03-25 10:28:22
Cabbagerat, I have been wrong so many times previously in this thread it is not surprising to me that you commenced your post immediately above with the word 'No'.
Please don't think I was being rude 
I do not understand your use of the phrase 'by definition'.  If you generate a set of random numbers at 44.1KHz you will generate instantaneous slew rates beyond what a continuous 22.05KHz wave would involve.  Theoretically you could have a series of numbers as follows: +1, -1, +1, -1. [although the probability of that exact series would be extremely low]

Intuitively [for me anyway], you need freedom of the dither to change its value as fast as possible, and not to be filtered down to 22.05KHz.  A low amplitude continuous 22.05KHz wave (or a little below 22.05KHz) could lead to the following instantaneous samples at 44.1KHz sampling: +1, 0, -1, 0, +1, 0, -1, 0
A continuous sine wave at 22.05KHz, sampled at 44.1KHz, could produces the samples [0, 0, 0, 0, 0, .....] or [1, -1, 1, -1, 1, -1, ......], or something inbetween - depending on the phase difference between it and the carrier. In fact, a sine wave at fs/2 Hz, sampled at fs Hz produces the samples [-sin(theta), sin(theta), -sin(theta), sin(theta), .....], where theta is the phase offset between the wave and the carrier. But that's just an aside. Critical sampling is a bit of a complication, and can be avoided entirely by defining your sampling theorem to require the signal to be bandlimited to less than fs/2 Hz.

The issue of "by definition" is that you cannot break the sampling theorem in any single rate digital system. Any (finite-valued) set of samples you can produce correspond to samples of a function bandlimited to half the system sampling rate. Be careful here, though - they might not correspond to samples of the bandlimited function  you intended them to. This sounds like an arbitrary distinction, but I think it's fairly important. This is what I meant by "by definition": "by definition, all sampled signals are bandlimited".

As long as noise is generated digitally, bandlimiting doesn't matter.

Consider sampling an infinite bandwidth white gaussian noise source, without using an anti-aliasing filter. Clearly, the frequencies about fs/2 (where fs is clearly the sampling frequency) will be aliased back into that band. But because the noise source is infinite bandwidth, the same amount of energy will end up being aliased into every frequency of the sampled signal - the samples will stay white. Note that this is only true for white noise, but should be true for white noise with any PDF.

So, as long as dither is white - bandlimiting doesn't matter.

Complications start coming up when the noise used is coloured, sampling rates are changed, and because of the way data converters are actually made. But those are different issues for a different time (and I'm hardly an expert on dither, noise shaping or ADC/DAC hardware).


I do not understand your use of the phrase 'by definition'.

I think I can answer this one. A series of samples at 44.1 khz cannot be used to represent any frequency above 22.05 khz because there will be a perfectly valid frequency below 22.05 khz which also goes through those exact same samples. Therefore 'by definition' all of the resulting frequencies are below the Nyquist limit.
Thanks, that's a lot clearer than what I wrote.
Title: filtering, dither, and noiseshaping
Post by: 2Bdecided on 2008-03-25 10:40:29
I have come up with an anomaly.  When I use my version of cool edit pro (2.00 build 2095) to generate a stereo sine wave it seems to generate the right channel differently.  This is apparent when looking at the frequency distribution of the 32 or 24 bit wave immediately after it is generated: the right-hand channel has a 'fatter' distribution.
Check the settings (all of them) in the tone generator. IIRC there's a difference between the left and right channels in the "default" settings. I can't remember what it is though (might be phase?), or why it would cause harmonics in the downconversion.

If it is phase, that's why the initial frequency analysis looks "fatter" - it starts on a non-zero sample on the phase shifted channel only.

Cheers,
David.


An interesting question is IMHO if it's actually worth using non-white dithers especially in the light of the noise shaping technique. To check this my idea was to compare plain "white TPD dither" with Wannamaker's "high pass TPD dither" (page 37) (http://music.calarts.edu/~rwannama/writings/ieee.pdf).

...

So, in case I didn't make any mistakes the use of the "high pass dither" is preferable because the noise floor is lower by log10(3/2.61803)*10 = 0.59 dB. Of course, the 0.59 dB improvement is hardly noticable but it sure was a big surprise for me!
I'm glad you're coming around to my way of thinking...
http://www.hydrogenaudio.org/forums/index....st&p=514491 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=16963&view=findpost&p=514491)
However, I don't claim to understand the theory at all.
Cheers,
David.
Title: filtering, dither, and noiseshaping
Post by: MLXXX on 2008-03-25 10:46:31
A continuous sine wave at 22.05KHz, sampled at 44.1KHz, could produces the samples [0, 0, 0, 0, 0, .....] or [1, -1, 1, -1, 1, -1, ......], or something inbetween - depending on the phase difference between it and the carrier. In fact, a sine wave at fs/2 Hz, sampled at fs Hz produces the samples [-sin(theta), sin(theta), -sin(theta), sin(theta), .....], where theta is the phase offset between the wave and the carrier. But that's just an aside. Critical sampling is a bit of a complication, and can be avoided entirely by defining your sampling theorem to require the signal to be bandlimited to less than fs/2 Hz.

No offence taken. Yes I was aware of that phase issue and that is why I stated 'or a little below' 22.05KHz.

The issue of "by definition" is that you cannot break the sampling theorem in any single rate digital system. Any (finite-valued) set of samples you can produce correspond to samples of a function bandlimited to half the system sampling rate. Be careful here, though - they might not correspond to samples of the bandlimited function  you intended them to. This sounds like an arbitrary distinction, but I think it's fairly important. This is what I meant by "by definition": "by definition, all sampled signals are bandlimited".

I think I understand what you are saying here.  But I am not referring to the final product of a sampling process, but to an intermediate step, the addition of dither.

The point I wish to concentrate on is simply this: is dither intended for use for a signal sampled at 44.1KHz pre-filtered to 22.05KHz or is it allowed to roam freely as generated.  I understand that TPDF dither can be generated wth two random number generators each creating +- 0.5 LSB, so that in combination (addition of the outputs) they produce +- 1.0 LSB of dither, concentrated around 0 and tapering off at the outer limits of +1 and -1 which are extremely improbable.

Actually I was hoping to get a sample of raw TPDF dither, but I have not come across a sample on the net.  Or at least a little bit of software that generates TPDF dither in isolation.  I was then going to add that dither to a 24-bit signal in a relatively 'manual' dithering process, and save the mix to 16 bits without [further] dither.

Check the settings (all of them) in the tone generator. IIRC there's a difference between the left and right channels in the "default" settings. I can't remember what it is though (might be phase?), or why it would cause harmonics in the downconversion.

If it is phase, that's why the initial frequency analysis looks "fatter" - it starts on a non-zero sample on the phase shifted channel only.

Cheers,
David.

Seemed odd that the cooledit software would produce the same anomaly on different pc's.  I've subsequently downloaded a version of Audition and it is free of the error.  So I am using Audition for the moment.  But I'll go back and check the cooledit settings when I have a spare moment.  Thanks.
Title: filtering, dither, and noiseshaping
Post by: 2Bdecided on 2008-03-25 11:28:55
Also, IIRC, the "correct" dither settings in CEP are dither depth = 1 bit Triangular, because of the way it defines the dither depth. Selecting 2 bits gives you 2 bits RMS - this is double what you want (1 bit RMS, 2 bits peak-to-peak).

Cheers,
David.
Title: filtering, dither, and noiseshaping
Post by: cabbagerat on 2008-03-25 13:03:13
The point I wish to concentrate on is simply this: is dither intended for use for a signal sampled at 44.1KHz pre-filtered to 22.05KHz or is it allowed to roam freely as generated.

"As generated", assuming it was generated digitally with the same sample rate, the dither is already bandlimited to between 0 and fs/2 Hz. Assuming the generator isn't horribly broken, you don't need to filter the dither at all.

This description slightly oversimplifies the mathematical point - but is not misleading. As long as you generate the dither digitally, and the samples match the required spectrum (or PSD, or autocorrelation, etc.) and PDF, then you don't need to worry about filtering.
Actually I was hoping to get a sample of raw TPDF dither, but I have not come across a sample on the net.  Or at least a little bit of software that generates TPDF dither in isolation.  I was then going to add that dither to a 24-bit signal in a relatively 'manual' dithering process, and save the mix to 16 bits without [further] dither.

Somebody please correct me if I am wrong, but as far as I can see you should be able to do something like this in GNU Octave (freely available on Windows, Linux and Mac) or MATLAB to get what you want:
Code: [Select]
seconds = 1;
rate = 44100;
sz = seconds*rate;
x=(rand(1,sz)+rand(1,sz)-1)/32768;
wavwrite('out.wav', x, rate, 24);
Title: filtering, dither, and noiseshaping
Post by: pdq on 2008-03-25 13:04:50


I do not understand your use of the phrase 'by definition'.

I think I can answer this one. A series of samples at 44.1 khz cannot be used to represent any frequency above 22.05 khz because there will be a perfectly valid frequency below 22.05 khz which also goes through those exact same samples. Therefore 'by definition' all of the resulting frequencies are below the Nyquist limit.
Thanks, that's a lot clearer than what I wrote.

Thank you cabbagerat. That is high praise indeed coming from you.
Title: filtering, dither, and noiseshaping
Post by: MLXXX on 2008-03-25 14:25:15
A series of samples at 44.1 khz cannot be used to represent any frequency above 22.05 khz because there will be a perfectly valid frequency below 22.05 khz which also goes through those exact same samples. Therefore 'by definition' all of the resulting frequencies are below the Nyquist limit.

Yes, this is true of a continuous sine wave.  And it is all part of sampling theory since Nyquist.  It is why filters are used immediately prior to an analogue to digital conversion process.

I am not sure though that this is the analysis that is relevant to white noise (or its variants), as white noise consists of random events rather than natural waveforms such as a vibrating string, or the sound of a pipe organ. The only way to asynchronously sample white noise created in the 44.1KHz format would be to sample it at over 88.2KHz.  Alternatively it can be captured by phase locking the sample rate, i.e. sample at 44.1KHz in phase with the 44.1KHz creation.  This may sound like double Dutch.  I am saying that transferring a digital stream undisturbed is a special case of sampling it.  Some people may understand what I am trying to say here, particularly after reading the next two paragraphs.

In video terms, this is like a aligning a 1920x1080 pixel video camera in front of a 1920x1080 test pattern such that the test pattern pixels line up in a perfect one to one correspondence with the pixels in the camera. [Actually practical high performance video cameras have optical filters to avoid optical aliasing, but if you removed the optical filter you could get a perfect 1920x1080 result.]  This is the exception to Nyquist: if a signal varies at the sampling rate, and the sampling coincides with that variation, a perfect sampling can be done:  synchronous sampling.

Putting this in more familiar terms, if you created a square wave at 44.1KHz, and you modulated the height of the top step and independently the bottom step of each of the square wave cycles to convey data, you could perfectly recover that data by sampling the square wave at 44.1KHz locked in phase to the middle of each step: synchronous sampling.  If you could not do synchronous sampling you would need to sample at over 88.2KHz to recover the encoded data [actually for an encoded wave of such complexity and precision you might need quite a bit more than 88.2KHz of conventional asynchronous sampling not optimised to the characteristics of the waveform].

The frequency analysis algorithms built into cool edit pro etc are not designed to display frequencies above fs/2.  The concept of frequency of a wave created by a random number generator is a difficult concept.  A random wave really has no frequency.  Any readout of frequency is as a result of chance.  For short periods (of sufficient duration to be measured) the random wave behaves in a similar manner to a continuous wave of a particular frequency.  An extremely quickly changing waveform cannot be recognized by the frequency analysis algorithm.  So the example in my post above of +1, -1, +1, -1 would be ignored by the analysis algorithm, as it has no normal meaning in a 44.1KHz asynchronous sampling environment, even though if listened to by a bat would be at 44.1KHz!

Anyway I'll follow up on the  software cabbagerat has referred to and see what happens when I record the dither produced by the software.  Cheers.
Title: filtering, dither, and noiseshaping
Post by: cabbagerat on 2008-03-25 15:12:29

A series of samples at 44.1 khz cannot be used to represent any frequency above 22.05 khz because there will be a perfectly valid frequency below 22.05 khz which also goes through those exact same samples. Therefore 'by definition' all of the resulting frequencies are below the Nyquist limit.

Yes, this is true of a continuous sine wave.  And it is all part of sampling theory since Nyquist.  It is why filters are used immediately prior to an analogue to digital conversion process.
And true of all signals (ok, provided they meet a variety of conditions (http://mathworld.wolfram.com/DirichletFourierSeriesConditions.html), none of which are important here).
I am not sure though that this is the analysis that is relevant to white noise (or its variants), as white noise consists of random events rather than natural waveforms created by vibrating objects. The only way to asynchronously sample white noise created in the 44.1KHz format would be to sample it at over 88.2KHz.  Alternatively it can be captured by phase locking the sample rate, i.e. sample at 44.1KHz in phase with the 44.1KHz creation.  This may sound like double Dutch.  I am saying that transferring a digital steam undisturbed is a special case of sampling it.  Some people may understand what I am trying to say here, particularly after reading the next two paragraphs.
Let me address this before the next two paragraphs. The sampling theorem, as originated from Shannon, Kotelnikov, etc. refers very specifically to a particular interpolation process. The theorem states that samples can be taken of a signal and interpolated with a specific process to produce the original signal if and only if the original signal only contained frequencies below fs/2 Hz. That particular interpolation process is widely called Sinc interpolation.

You are not seeking to produce a noise signal with frequencies in (0, 44100), you are seeking to produce samples of a noise process bandlimited to (0, 22050Hz). That noise process is bandlimited, so sampling at 44100Hz is just fine.
In video terms, this is like a aligning a 1920x1080 pixel video camera in front of a 1920x1080 test pattern such that the test pattern pixels line up in a perfect one to one correspondence with the pixels in the camera. [Actually practical high performance video cameras have optical filters to avoid optical aliasing, but if you removed the optical filter you could get a perfect 1920x1080 result.]  This is the exception to Nyquist: if a signal varies at the sampling rate, and the sampling coincides with that variation, a perfect sampling can be done:  synchronous sampling.
Yes, and no. If you do this process, you will certainly get a perfect photo of the original card. There are some important things to remember here:

1) The sampling process you are doing (using an imaging sensor) averages out the signal (image) over the sample period (pixel). In audio, the signal is sampled at a single instant - the signal between these instants is discarded.

2) The interpolation process is different. Viewing the image on a screen does a sort of zeroth-order hold on the signal - the value is held over the output sample period. In audio (and printers) the signal is interpolated between sampling instants. In audio, this is done with Sinc interpolation (or a low-pass filter, which is mathematically equivalent).

So this depends very strongly on your definition of sampling. The one most DSP uses, and the one the DFT depends on, requires that the samples are related to the original signal by sinc interpolation (or an ideal low pass filter).

Putting this in more familiar terms, if you created a square wave at 44.1KHz, and you modulated the height of the top step and independently the bottom step of each of the square wave cycles to convey data, you could perfectly recover that data by sampling the square wave at 44.1KHz locked in phase to the middle of each step: synchronous sampling.  If you could not do synchronous sampling you would need to sample at over 88.2KHz to recover the encoded data [actually for an encoded wave of such complexity and precision you might need quite a bit more than 88.2KHz of conventional asynchronous sampling].
Yes, you can do this. No, the DFT won't do anything sensible with the signal so produced - neither would conventional upsampling procedures, conventional digital filters, or conventional DACs.

The frequency analysis algorithms built into cool edit pro etc are not designed to display frequencies above fs/2.
Because the sets of samples that cool edit deals with by definition contain no frequencies above fs/2. Cool edit makes the assumption that the samples were produced from a lowpass signal - not a bandpass signal.

The concept of frequency of a wave created by a random number generator is a difficult concept.
Yes, but it is extremely well defined for digital signals, via the Wiener-Khinchine (http://mathworld.wolfram.com/Wiener-KhinchinTheorem.html) theorem (or Einstein-Weiner-Khintchine depending on the book) to the autocorrelation function - a simple function of the original samples. It's difficult conceptually, but certainly not hazy mathematically.

I know it can be a difficult concept to grasp - but time varying signals, random signals (provided they are time limited), and all sorts of other non-sinusoidal signals fit just perfectly into this scheme.
A random wave really has no frequency.  Any readout of frequency is as a result of chance.

Random waves have very well defined power spectral densities (PSDs). Talking about their frequency isn't any more interesting than talking about the frequency of the Motorhead song "Ace of Spades". Talking about the power spectral density of both of these things is interesting, however.
For short periods (of sufficient duration to be measured) the random wave behaves in a similar manner to a continuous wave of a particular frequency.
Random discrete-time waves (with N samples) behave like the sum of N sine waves equally spaced in frequency from  -fs/2 to fs/2 Hz, with randomly scrambled phase, weighted by the power spectrum of the chosen noise signal. This much we know from the definition of discrete time signals and the discrete Fourier transform. Sure, you might get lucky and find ten consecutive points that you can fit a single sine to - but that doesn't tell you much about the underlying signal.

An extremely quickly changing waveform cannot be recognized by the frequency analysis algorithm.  So my example above of +1, -1, +1, -1 would be ignored by the analysis algorithm, as it has no normal meaning in a 44.1KHz asynchronous sampling environment, even though if listened to by a bat would be at 44.1KHz!
By frequency analysis algorithm, do you mean the discrete fourier transform? Or do you mean the short-time Fourier transform (like a sonogram)? In both cases this signal is an edge case. It's discrete fourier transform (in the commonly used form) will yield [0, 0, 2, 0]. If you fed this signal (or a longer extension of the pattern) to an ideal DAC, you would get a 22050Hz sine wave at the output. This is simply because these samples correspond to the samples of a 22050Hz sine wave with a particular phase. But please don't get fixated on the critically sampled case.
Title: filtering, dither, and noiseshaping
Post by: 2Bdecided on 2008-03-25 15:20:21
MLXXX,

Click "FAQ" (top right)

Click "SACD, DVD-A, Vinyl, and Cassette"

Read the first thread there, and any others you want.


Come back when you've digested them.

HA doesn't need another "Nyquist wasn't quite right" thread - we've had enough already.

Cheers,
David.
Title: filtering, dither, and noiseshaping
Post by: MLXXX on 2008-03-25 16:16:22
David,
I'll take that to mean you have tired of my posts. That is fine.  You are free to ignore them or skim them quickly and pass on.  I think though that you may be intepreting my queries as challenges to conventional theory.  They are not.  I am simply trying to understand dither.  If dither is as good as it appears it is, there seems little reason to use 24 bits in a released version of audio unless the audio source is at a very high SNR or rthe final mix is at significantly less than 0dB.  This is an important issue in my home forum (DTV Australia) and home cinema forums such as AVS, as many people are clamouring for 24-bit Blu-ray audio whereas it appears all they need is well dithered 16-bit audio.



An extremely quickly changing waveform cannot be recognized by the frequency analysis algorithm.  So my example above of +1, -1, +1, -1 would be ignored by the analysis algorithm, as it has no normal meaning in a 44.1KHz asynchronous sampling environment, even though if listened to by a bat would be at 44.1KHz!
By frequency analysis algorithm, do you mean the discrete fourier transform? Or do you mean the short-time Fourier transform (like a sonogram)? In both cases this signal is an edge case. It's discrete fourier transform (in the commonly used form) will yield [0, 0, 2, 0]. If you fed this signal (or a longer extension of the pattern) to an ideal DAC, you would get a 22050Hz sine wave at the output. This is simply because these samples correspond to the samples of a 22050Hz sine wave with a particular phase. But please don't get fixated on the critically sampled case.


Cabbagerat, many thanks for your various explanations in your immediately preceeding post.  I think I understand them, at least broadly.

Concerning the last topic you covered, which I have reproduced above, an ideal DAC will filter the ouput to create an interpolated wave.  If fed a +1,-1,+1,-1, ...  digital signal, the interpolation will I presume yield zero or close to zero.  The 44.1 KHz signal would at the very least be muffled.

I note you say 'Random waves have very well defined power spectral densities (PSDs).'.

My understanding is that digital dither is not constrained before being added to the signal to be dithered. 

I am not sure how this is accounted for in a power spectral density graph of a digitally encoded waveform.  Presumably a short burst of +!, -1,+!-1 does not appear on the graph but is ignored.  The graph presumably ceases at fs/2.

There is a certain limitation by definition here.  If we define digital sampling to represent waveforms from 0Hz to fs/2 then by definition that is all we have.  We cannot within that scheme have a meaning for a rapidly changing stream encoded as +1,-1,+1,_1.  Yet that is a possible output of a white noise generator over a short period of successive samples; unless we take steps to filter it out.

Anyway I'll do some of the reading 2Bdecided suggests (though I suspect doing so will not  throw much light on specific questions I have raised in my last few posts).  Cheers.
Title: filtering, dither, and noiseshaping
Post by: cabbagerat on 2008-03-25 16:41:27
I am simply trying to understand dither.  If dither is as good as it appears it is, there seems little reason to use 24 bits in a released version of audio unless the audio source is at a very high SNR or recorded at significantly less than 0dB.  This is an important issue in my home forum (DTV Australia) and home cinema forums such as AVS, as many people are clamouring for 24-bit Blu-ray audio whereas it appears all they need is well dithered 16-bit audio.
I think it's really good that you are trying to understand dither. People are often too quick to jump on the "16bit sucks" bandwagon. Unfortunately, at the moment, your understanding of dither seems to be blocked by a misunderstanding of some of the concepts of discrete-time signal processing.


Cabbagerat, many thanks for your various explanations in your immediately preceeding post.  I think I understand them, at least broadly.
That's good - but don't take my word for all of this stuff. There is good information on the topics I have discussed available freely on the internet, and in books. I would recommend looking at some of the free resources available.


Concerning the last topic you covered, which I have reproduced above, an ideal DAC will filter the ouput to create an interpolated wave.  If fed a +1,-1,+1,-1, ...  digital signal, the interpolation will I presume yield zero or close to zero.  The 44.1 KHz signal would at the very least be muffled.

No, an ideal DAC will reproduce a 22.05kHz sine wave with a pi/2 phase offset. Seriously, though - this is an extremely borderline case, and isn't closely related to the problem of the spectra of noise signals.

I note you say 'Random waves have very well defined power spectral densities (PSDs).'.

My understanding is that digital dither is not constrained before being added to the signal to be dithered. 

I am not sure how this is accounted for in a power spectral density graph of a digitally encoded waveform.  Presumably a short burst of +!, -1,+!-1 does not appear on the graph but is ignored.  The graph presumably ceases at fs/2.
Of course it isn't ignored. The power-spectral density (defined for all finite length signals of finite length that satisfy the dirichlet criteria) is the Fourier transform of the autocorrellation function. For white noise, the autocorellation function approaches Delta[n, 0] (where Delta is the Kronecker delta) as the signal length approaches infinity. The PSD therefore approaches F[w] = 1 as the signal length approaches infinity (this is known as the localization property of the discrete Fourier transform).

When you say "digital dither is not constrained" you are missing the fact that it is sampled - therefore it is bandlimited by definition. Apply a digital low-pass filter with a cutoff of fs/2 if you want, but don't be surprised when you get back exactly the same samples you put into the filter.

There is a certain limitation by definition here.  If we define digital sampling to represent waveforms from 0Hz to fs/2 then by definition that is all we have.  We cannot within that scheme have a meaning for a rapidly changing stream encoded as +1,-1,+1,_1.  Yet that is a possible output of a white noise generator over a short period of successive samples; unless we take steps to filter it out.
Yes, we have a meaning for those samples - just as we have a meaning for any set of samples. The meaning is defined by the interpolation formula (http://en.wikipedia.org/wiki/Whittaker%E2%80%93Shannon_interpolation_formula). By definition, you can find a bandlimited function which, when sampled, would produce *any* given (finite) sample values.

Anyway I'll do some of the reading 2Bdecided suggests (though I suspect doing so will not  throw much light on specific questions I have raised in my last few posts).  Cheers.
I suspect it would throw a lot of light on your questions. What you are asking seems to come from a fundamental misunderstanding of the principles of digital signal processing. I am happy to answer the questions that you do have - but as 2Bdecided suggested some reading might get you to the answer quicker than I can.
Title: filtering, dither, and noiseshaping
Post by: MLXXX on 2008-03-25 16:58:43
When you say "digital dither is not constrained" you are missing the fact that it is sampled - therefore it is bandlimited by definition. Apply a digital low-pass filter with a cutoff of fs/2 if you want, but don't be surprised when you get back exactly the same samples you put into the filter.


That presumably would be because the digital filter would not recognise the +1,-1,+1,-1 encoding as representing a 44.1KHz signal.  You have suggested that +1,-1,+1,-1 encoding would be interpteted as a 22.05Khz signal.  I note that a steady low amplitude 22.05KHz signal might be encoded as +1,0,-1,0 if in phase and -1,0,+1,0 if 180 degrees out of phase.  It still seems to me we have a limitation by definition.  Anyway I must log off and get some sleep. - Cheers, MLXXX
Title: filtering, dither, and noiseshaping
Post by: greynol on 2008-03-25 17:01:56
You have suggested that +1,-1,+1,-1 encoding would be interpteted as a 22.05Khz signal.

Because with a sample rate of 44.1 kHz, alternating +1, -1 is a 22.05 kHz signal!
Title: filtering, dither, and noiseshaping
Post by: MLXXX on 2008-03-25 17:09:46
Because with a sample rate of 44.1 kHz, alternating +1, -1 is a 22.05 kHz signal!

Is it?  I'd have thought that a 44.1KHz signal would give samples of +1,-1 etc if synchronously sampled in phase at 44.1Khz; and I'd have thought a 22.05KHz signal would give samples of +1,0,-1,0 etc (if sampling was kept in phase with peaks and zero crossings of the waveform).
Title: filtering, dither, and noiseshaping
Post by: greynol on 2008-03-25 17:12:02
That would be an 11.025 kHz signal!

Sounds like you need to do a little more research into discrete-time sampling.
Title: filtering, dither, and noiseshaping
Post by: MLXXX on 2008-03-25 17:33:08
Yes greynol, it appears I typed far too late into the night and overlooked a very basic issue. Thanks.
Title: filtering, dither, and noiseshaping
Post by: 2Bdecided on 2008-03-26 13:17:40
David,
I'll take that to mean you have tired of my posts.
No, I'm just watching you grope around in the dark, and I'm trying to hand you a torch. Trust me, it'll be more use to you long term, than having five HA members who know the way, lead you around in the dark!

Cheers,
David.
Title: filtering, dither, and noiseshaping
Post by: MLXXX on 2008-03-26 15:00:27
... as far as I can see you should be able to do something like this in GNU Octave (freely available on Windows, Linux and Mac) or MATLAB to get what you want:
Code: [Select]
seconds = 1;
rate = 44100;
sz = seconds*rate;
x=(rand(1,sz)+rand(1,sz)-1)/32768;
wavwrite('out.wav', x, rate, 24);


I downloaded Octave Forge Windows and that version of Octave would only support a maximum of 16 bit encoding for the wavwrite command.  So I had to modify the code a little.  The following gave me a 1 second sample at 44.1KHz 16 bits:

[blockquote]seconds = 1;
rate = 44100;
sz = seconds*rate;
x=(rand(sz,1)+rand(sz,1)-1)/128;
wavwrite('out.wav',x,rate,16)[/blockquote]

This is fascinating stuff for me, and I'll have to look into it some more. It's years since I've played around with this type of high level programming language.

No, I'm just watching you grope around in the dark, and I'm trying to hand you a torch. Trust me, it'll be more use to you long term, than having five HA members who know the way, lead you around in the dark!


Nicely put.

I am normally more a 'work it out or for myself' individual.  However internet forums can be quite tempting for someone with a specific query.  [I am getting close to the point where I will have to report back in a fairly bold manner that 24-bit distribution media have very little practical advantage over well dithered 16-bit distribution media, even when listened to with a high quality home cinema setup.]
Title: filtering, dither, and noiseshaping
Post by: 2Bdecided on 2008-03-26 15:29:08
Contrary to a lot of what you'll read on HA, I think more than 16-bits could be useful in a home cinema environment.

If you really want to maintain the transient peaks of the waveforms (if only the music industry did!), and you want a huge amount of subsonic bass (ignoring the dedicated channel available for that for one moment), and you want dialogue at a reasonable level, and you want the noise floor below that of a dedicated listening room at all frequencies, and you don't want to have too much noise shaping in there because there are several stages of digital processing (lossy coding, level matching, delay, speaker EQ, room EQ etc), and you don't really trust all the equipment to be bit perfect, and you want the option of applying DRC to the output or not as you choose, and you want to match source levels in the digital domain without compromising headroom, then you probably want to start with more than 16-bits, and keep more than 16-bits throughout. (You also need a pretty amazing amp and speakers, not to mention very distant neighbours!)

So 16-bits are enough, but it's conceivable that you could throw together a situation where they're not.

Given the cost, which with today's disc media and hardware is so small as to be irrelevant, there's no reason to use "only" 16-bits on new disc media, even though in most situations 16-bits is more than enough.
Title: filtering, dither, and noiseshaping
Post by: pdq on 2008-03-26 15:37:57
When applying dither to 16-bit signals, is there an advantage to using 48 kHz vs. 44.1 kHz because it is easier to keep the added noise inaudable?
Title: filtering, dither, and noiseshaping
Post by: krabapple on 2008-03-26 16:27:58
Contrary to a lot of what you'll read on HA, I think more than 16-bits could be useful in a home cinema environment.

If you really want to maintain the transient peaks of the waveforms (if only the music industry did!), and you want a huge amount of subsonic bass (ignoring the dedicated channel available for that for one moment), and you want dialogue at a reasonable level, and you want the noise floor below that of a dedicated listening room at all frequencies, and you don't want to have too much noise shaping in there because there are several stages of digital processing (lossy coding, level matching, delay, speaker EQ, room EQ etc), and you don't really trust all the equipment to be bit perfect, and you want the option of applying DRC to the output or not as you choose, and you want to match source levels in the digital domain without compromising headroom, then you probably want to start with more than 16-bits, and keep more than 16-bits throughout. (You also need a pretty amazing amp and speakers, not to mention very distant neighbours!)



My understanding is that most modern AVRs operate in the 24-bit domain anyway, in anything put 'pure direct' modes. Could be wrong about that, and that;s leaving aside that it's not 'full' 24-bit in practice.

But I have to wonder how many listening rooms in practice have a noise floor lower than that offered by dithered, noise-shaped Redbook audio.  Not to mention the noise from the recording itself (if from an analog source).
Title: filtering, dither, and noiseshaping
Post by: 2Bdecided on 2008-03-26 17:33:33
But I have to wonder how many listening rooms in practice have a noise floor lower than that offered by dithered, noise-shaped Redbook audio.
Almost none, which is why it took me so many "and"s to try to justify it.

Cheers,
David.



When applying dither to 16-bit signals, is there an advantage to using 48 kHz vs. 44.1 kHz because it is easier to keep the added noise inaudable?
There's a double advantage: the bandwidth is slightly wider which means the dither noise/Hz is fractionally lower - and, far more significantly, as you suggest a far greater chunk of the available spectrum is basically inaudible, so a great place to push noise into.

Cheers,
David.
Title: filtering, dither, and noiseshaping
Post by: MLXXX on 2008-03-26 22:35:55
Contrary to a lot of what you'll read on HA, I think more than 16-bits could be useful in a home cinema environment.

If you really want to maintain the transient peaks of the waveforms (if only the music industry did!), and you want a huge amount of subsonic bass (ignoring the dedicated channel available for that for one moment), and you want dialogue at a reasonable level, and you want the noise floor below that of a dedicated listening room at all frequencies, and you don't want to have too much noise shaping in there because there are several stages of digital processing (lossy coding, level matching, delay, speaker EQ, room EQ etc), and you don't really trust all the equipment to be bit perfect, and you want the option of applying DRC to the output or not as you choose, and you want to match source levels in the digital domain without compromising headroom, then you probably want to start with more than 16-bits, and keep more than 16-bits throughout. (You also need a pretty amazing amp and speakers, not to mention very distant neighbours!)

So 16-bits are enough, but it's conceivable that you could throw together a situation where they're not.

Given the cost, which with today's disc media and hardware is so small as to be irrelevant, there's no reason to use "only" 16-bits on new disc media, even though in most situations 16-bits is more than enough.


An extremely useful response for my particular purposes.

Re the last para, with High Definition Media (Blu-ray, and the no longer continuing HD-DVD format) it has been common to include audio tracks in several languages.  Particularly if a lossless audio codec is used (as it is sometimes for the main audio track), space on the HDM disc can become a critical issue.  A decision could be made in compiling the source material to use a 16 bit mix in preference to 24 (assuming a 24 bit mix is actually available for the transfer to HDM) in order to conserve space.

Here is a link to audio formats of a number of released Blu-ray discs: AVS: Unofficial Blu-ray Audio and Video Specifications Thread (http://www.avsforum.com/avs-vb/showpost.php?p=9044310&postcount=1).  A large number of the discs use "LPCM (uncompressed) 16-bit/48kHz".
Title: filtering, dither, and noiseshaping
Post by: Woodinville on 2008-03-27 05:20:08
But I have to wonder how many listening rooms in practice have a noise floor lower than that offered by dithered, noise-shaped Redbook audio.
Almost none, which is why it took me so many "and"s to try to justify it.



Very true, and let's not forget 6dB SPL with a flat white spectrum, 20Hz to 20kHz is what the atmosphere, by being made of individual molecules, actually creates at your eardrum (yes, there is "shot noise" like effects from the individual molecules, yes it's that energetic).

Getting below that kind of noise floor in any one critical band or ERB really kinda-sorta defines not to useful in the real world.
Title: filtering, dither, and noiseshaping
Post by: hellokeith on 2008-03-27 19:14:55
Woodinville,

In regards to filtering/dithering/noise shaping, how does Vista handle various operations like volume control, eq (in WMP), SRC, delivery to sound card, etc?
Title: filtering, dither, and noiseshaping
Post by: Woodinville on 2008-03-28 20:26:58
Woodinville,

In regards to filtering/dithering/noise shaping, how does Vista handle various operations like volume control, eq (in WMP), SRC, delivery to sound card, etc?



Volume control, src are both float. WMP will use float for some EQ and fix for others (sorry, legacy systems are fun, fun, fun).

Dither is applied, always, after the float pipeline.  Once.  Not sure what you mean by filtering, no filtering is done except as needs be done for SRC.
Title: filtering, dither, and noiseshaping
Post by: DualIP on 2008-03-29 10:35:04
[quote name='Woodinville' date='Mar 28 2008, 22:26' post='555548']
[quote name='hellokeith' post='555317' date='Mar 27 2008, 12:14']
Not sure what you mean by filtering, no filtering is done except as needs be done for SRC.
[/quote]
EQ is obvious a filter! Even amplification is mathematical a filter, and, when used on integers without dither, can serious degrade signal quality.
Title: filtering, dither, and noiseshaping
Post by: MLXXX on 2008-03-29 11:07:21
Even amplification is mathematical a filter, and, when used on integers without dither, can serious degrade signal quality.

That is certainly true if the result of the processing is limited to 16 bits.

But how serious a problem is it if the result of the processing is stored as a 24-bit integer after a one step operation, e.g. an operation consisting of (a) one step of equalisation, or (b) one step of amplification?  I had assumed the impact would be negligible.
Title: filtering, dither, and noiseshaping
Post by: Woodinville on 2008-03-29 22:34:24
EQ is obvious a filter! Even amplification is mathematical a filter, and, when used on integers without dither, can serious degrade signal quality.



Yes, oh bright one, but EQ is applied in the PLAYER. You said "after the player".
Title: filtering, dither, and noiseshaping
Post by: hellokeith on 2008-03-31 04:34:31

Woodinville,

In regards to filtering/dithering/noise shaping, how does Vista handle various operations like volume control, eq (in WMP), SRC, delivery to sound card, etc?



Volume control, src are both float. WMP will use float for some EQ and fix for others (sorry, legacy systems are fun, fun, fun).

Dither is applied, always, after the float pipeline.  Once.  Not sure what you mean by filtering, no filtering is done except as needs be done for SRC.


Thanx!

Lastly, what is the purpose or reasoning of the Advanced > Default Format ?

"Select the sample rate and bit depth to be used when running in Shared Mode"

Why does this need to be set at all?
Title: filtering, dither, and noiseshaping
Post by: Woodinville on 2008-03-31 06:24:40


Woodinville,

In regards to filtering/dithering/noise shaping, how does Vista handle various operations like volume control, eq (in WMP), SRC, delivery to sound card, etc?



Volume control, src are both float. WMP will use float for some EQ and fix for others (sorry, legacy systems are fun, fun, fun).

Dither is applied, always, after the float pipeline.  Once.  Not sure what you mean by filtering, no filtering is done except as needs be done for SRC.


Thanx!

Lastly, what is the purpose or reasoning of the Advanced > Default Format ?

"Select the sample rate and bit depth to be used when running in Shared Mode"

Why does this need to be set at all?


Unlike XP, Vista uses a high-quality software resampler, and does not change the DAC rate or bit depth. Set it to whatever makes your DAC happiest, and Vista will adapt the inputs to it.

This means that you don't get any wierdnesses like having a system sound set your sampling rate to 22k and then finding out your entire movie is going to be at 22k unless you stop it and start over.

There are a lot of nasty considerations when one has to consider a lot of stuff might be coming the way of the DAC.
Title: filtering, dither, and noiseshaping
Post by: hellokeith on 2008-07-08 10:47:52
Noise-shaping and dither are two different, independent processes.


For ADC, what piece or pieces of circuitry perform the dithering? How is the dither generated? Does it happen before quantization, during, or after?

Is the same kind of dither (TPDF white?) used in ADC/quantization and in word-length reduction (24bit --> 16bit)?
Title: filtering, dither, and noiseshaping
Post by: SebastianG on 2008-07-08 12:07:27
For ADC, what piece or pieces of circuitry perform the dithering? How is the dither generated?

Good question. I don't know the answer either. I'd guess people are relying on thermal noise or something like that which would be a good reason to record in 24 bit accuracy. If anyone is in the know please speak up.

Cheers,
SG
Title: filtering, dither, and noiseshaping
Post by: pdq on 2008-07-08 21:06:59
If I'm not mistaken, the sigma delta ADCs that are in common use today inherently dither, i.e. if you apply a DC level half way between two quantization levels then you will alternately get one and then the other. A successive approximation ADC would simply give you the same value all the time.
Title: filtering, dither, and noiseshaping
Post by: SebastianG on 2008-07-08 21:48:09
If I'm not mistaken, the sigma delta ADCs that are in common use today inherently dither, i.e. if you apply a DC level half way between two quantization levels then you will alternately get one and then the other.

What you describe is primarily the effect of noise shaping which alone doesn't guarantee linearity. Some dithering can theoretically be achieved by randomly shifting the quantization threshold of the 1bit quantizer up and down to some extent (not too much to avoid overloading issues). I think it's really down to thermal noise and/or background noise which should be enough when recording in high resolution.

Cheers,
SG
Title: filtering, dither, and noiseshaping
Post by: Dynamic on 2008-07-09 03:41:39

If I'm not mistaken, the sigma delta ADCs that are in common use today inherently dither, i.e. if you apply a DC level half way between two quantization levels then you will alternately get one and then the other.

What you describe is primarily the effect of noise shaping which alone doesn't guarantee linearity. Some dithering can theoretically be achieved by randomly shifting the quantization threshold of the 1bit quantizer up and down to some extent (not too much to avoid overloading issues). I think it's really down to thermal noise and/or background noise which should be enough when recording in high resolution.

Cheers,
SG


Good point. I suspect any consumer sigma delta ADC used in 16-bit mode is not applying sufficient dither to decorrelate quantization noise, just bandlimiting.

Potentially, one could implement dither by adding a signal that's suitable to provide dither onto the analogue signal before the discriminator (thresholding device). If you can add the output of a 20 to 24-bit DAC to the input, or more simply supply its output to the threshold-level input of the discriminator, you can choose a single level for each output sample period that fits the required PDF (e.g. triangular PDF). The alternative is to record to 24-bit (where thermal noise will supply dither) and convert on-the-fly to 16-bit in the digital domain with appropriate dither, which could be implemented within the ADC chip.
Title: filtering, dither, and noiseshaping
Post by: pdq on 2008-07-09 15:02:35
If I'm not mistaken, the sigma delta ADCs that are in common use today inherently dither, i.e. if you apply a DC level half way between two quantization levels then you will alternately get one and then the other. A successive approximation ADC would simply give you the same value all the time.

Let me refine what I said above. I still believe that a sigma delta ADC is in effect self-dithered, but it is not noise shaped and is probably not a very desirable way of dithering. For example, if a DC level of 0.1 quantization levels is applied then 10% of the time the output value would be 1, and 90% of the time it would be 0. This introduces a tone at 1/10 of the sampling frequency, and I don't think one wants a 4.41 kHz tone added to one's audio.
Title: filtering, dither, and noiseshaping
Post by: SebastianG on 2008-07-09 17:12:46
This mainly seems to be a terminology issue we're dealing with here. Sigma delta is just noise shaping in disguise. It has nothing to do with dithering in the sense of R. Wannamaker, S. Lipshitz, J. Vanderkooy. I'm not denying the fact that "dithering" is oftentimes used instead of "noise shaping" to describe the same thing. A prime example being the Floyd-Steinberg dither for images.

Let's take a simple first order sigma delta modulator as example. It's just a special case of this signal flow graph (http://wiki.hydrogenaudio.org/index.php?title=Image:Noiseshaper3.png). Just set "dither" to be constant zero and H(z) to be 1. I'm leaving the proof to the interested reader. What happens is that the the quantization error (think of it as another source) gets filtered by a simple high pass filter: N(z) = 1 - z^{-1}. Because of N(1)=0 your quantized signal will even have exactly the same DC offset as your input. But there's nothing in there that guarantees the quantizer to behave like we want it to, namely adding a bit of "friendly noise" instead of potential spurious tones which is the goal of dithering.

In a way Floyd-Steinberg dithering and 1st order sigma delta modulation are very much alike because they both use high pass noise shaping filters that have "a zero at DC". The Floyd-Steinberg method also shifts the noise away from lower spatial frequency that are perceptually more important. This is referred to as "error diffusion" which translates to N(1)=0. It qualifies as noise shaping. The lack of real dithering here can lead to repeating patters in the same way non-dithered sigma delta modulation potentially suffers from "birdies". Your 4.41kHz buzz is an example of a "birdie".

Cheers,
SG
Title: filtering, dither, and noiseshaping
Post by: pdq on 2008-07-09 17:34:22
Thank you Sebastian, that really helps.

Am I right that typically the quantizer is one bit, i.e. a comparator?

Edit: I just took a quick look at Lipshitz and Vanderkooy (http://sjeng.org/ftp/SACD.pdf). Very interesting read.