Dither on Sample Rate conversion?

For everything after the recording stage: hardware/software and how you use it.

Moderator: Moderators

Dither on Sample Rate conversion?

Post by Sundr0wn »

I've asked this question before on reddit and in another forum but i just cant get a conclusive answer.
If i open a a 16bit 96kHz file, resample it to say 48kHz and export it again to 16bit. Do i apply dither? I'm still taking out information so do quantization errors happen here too?
Normally i work in 32bit float (audacity), so i open the file as 32bit float, resample it and then export it again to the original bit depht. Should i dither then because a bit depht change occurs after i processed the audio?
Sundr0wn
New here
Posts: 5 Joined: Thu Aug 05, 2021 6:29 am

Re: Dither on Sample Rate conversion?

Post by Hugh Robjohns »

Sundr0wn wrote: Thu Aug 05, 2021 6:40 am If i open a a 16bit 96kHz file, resample it to say 48kHz and export it again to 16bit. Do i apply dither?

Technically, no, because you have not changed the word-length. Dithering is only required when the word-length is reduced.

However, in practice no modern hardware or software sample rate converter is actually going to work with a 16 bit word-length, so the specific answer will depend on what exact SRC process you're using.

I'm still taking out information so do quantization errors happen here too?


You're taking out the top half of the bandwidth, but you're not affecting the dynamic range, so there are no quantisation errors if the wordlength remains unchanged.

Normally i work in 32bit float (audacity), so i open the file as 32bit float, resample it and then export it again to the original bit depht. Should i dither then because a bit depht change occurs after i processed the audio?

There is no need to dither if always working in the 32-bit floating-point format. You only need to dither when converting that format to a fixed-point 24 or 16 bit file, say.
User avatar
Hugh Robjohns
Moderator
Posts: 38968 Joined: Fri Jul 25, 2003 12:00 am Location: Worcestershire, UK
Technical Editor, Sound On Sound...
(But generally posting my own personal views and not necessarily those of SOS, the company or the magazine!)
In my world, things get less strange when I read the manual... 

Re: Dither on Sample Rate conversion?

Post by Sundr0wn »

There is no need to dither if always working in the 32-bit floating-point format. You only need to dither when converting that format to a fixed-point 24 or 16 bit file, say.

Well yes, i didnt explain it well enough but that's what i meant when i said dither after resampling in 32but float i meant on export.
Basically i am not doing anything else to the file but resampling it from 48, 96 or whatever kHz to 44.1. Then i export it again to the original 16bits. Since you're only supposed to dither on bit depht reduction normally you wouldnt apply dither to that. However i know when doing any kind of processing on the file, like adding samples applying filters etc, you need to dither it on export to 16bit since those changes are in 32bit but not when you're for example cutting parts out of the track. However since i dont quite understand how downsampling frequency works (technically it should just be chopping off everything above 22kHz, but i know now it isnt that simple), so i am not sure if that counts as processing the audio and therefore needs to be dithered or not.

Also i changed my workflow today from audacity to finalCD and i have no idea if that works in 32bit float or not.
Sundr0wn
New here
Posts: 5 Joined: Thu Aug 05, 2021 6:29 am

Re: Dither on Sample Rate conversion?

Post by Hugh Robjohns »

Sundr0wn wrote: Thu Aug 05, 2021 5:36 pm Well yes, i didnt explain it well enough but that's what i meant when i said dither after resampling in 32but float i meant on export.

You need to dither when you reduce the word-length.

Basically i am not doing anything else to the file but resampling it from 48, 96 or whatever kHz to 44.1. Then i export it again to the original 16bits.

You need to dither when you reduce the word-length.

Since you're only supposed to dither on bit depht reduction normally you wouldnt apply dither to that.

Why not? You're changing the word-length from 32-bit float to 16 bit in the export. You need to dither when you reduce the word-length.

However i know when doing any kind of processing on the file, like adding samples applying filters etc, you need to dither it on export to 16bit since those changes are in 32bit but not when you're for example cutting parts out of the track.

If you're working in 32-bit floating point and want to output at 16 bit you need to dither the output. You need to dither when ever you reduce the word-length.

However since i dont quite understand how downsampling frequency works (technically it should just be chopping off everything above 22kHz, but i know now it isnt that simple)

Obviously the maths is complex, but in essence all that happens is a low-pass filter is being applied and the new samples calculated at the new sample rate. The result is that any content above half the new sample rate is removed.

i am not sure if that counts as processing the audio and therefore needs to be dithered or not.

It does if you are reducing the word-length at any point in the process... which you are, from 32-bit float to your export format of 16 bit. You need to dither when you reduce the word-length.

Also i changed my workflow today from audacity to finalCD and i have no idea if that works in 32bit float or not.

Neither do I, but it mentions double precision at the top of the website which implies a word-length of 32 bits since the output is 16/44.1. But since this is generating the 16 bit output directly as part of the process I would presume it is performing the word-length reduction dithering internally to provide the 16 bit output.

If you're interested in the quality of different software SRCs I heartily recommend perusing this website:

https://src.infinitewave.ca/

FinalCD looks pretty good in Sharp mode, but I'd be wary of the medium and would avoid the gentle mode altogether.

... and remember, you need to dither when you reduce the word-length. :D
User avatar
Hugh Robjohns
Moderator
Posts: 38968 Joined: Fri Jul 25, 2003 12:00 am Location: Worcestershire, UK
Technical Editor, Sound On Sound...
(But generally posting my own personal views and not necessarily those of SOS, the company or the magazine!)
In my world, things get less strange when I read the manual... 

Re: Dither on Sample Rate conversion?

Post by Drew Stephenson »

So do you need to dither if you're reducing the word length?

;)
User avatar
Drew Stephenson
Forum Aficionado
Posts: 24566 Joined: Sun Jul 05, 2015 12:00 am Location: York
(The forumuser formerly known as Blinddrew)
Ignore the post count, I still have no idea what I'm doing...
https://drewstephenson.bandcamp.com/

Re: Dither on Sample Rate conversion?

Post by Hugh Robjohns »

You Got It! :D:ugeek:
User avatar
Hugh Robjohns
Moderator
Posts: 38968 Joined: Fri Jul 25, 2003 12:00 am Location: Worcestershire, UK
Technical Editor, Sound On Sound...
(But generally posting my own personal views and not necessarily those of SOS, the company or the magazine!)
In my world, things get less strange when I read the manual... 

Re: Dither on Sample Rate conversion?

Post by Mike Stranks »

Sooooo...

I haven't really bothered about dither before - assuming the software just did it's own thing... :shock: - although I do know that iZotope occasionally prompts me about dither and I use the suggested default.

Anyway, this thread has caused me to do some rootling... I'm very left-field and use Mixcraft... Looking online I see that it's attracted some criticism in the past as its creators have said that they don't believe incorporating dither is necessary. Nevertheless the latest version does now incorporate it... and as they've offered me an upgrade for silly money....

.... Ker-ching! :lol:
Mike Stranks
Jedi Poster
Posts: 10467 Joined: Fri Jan 03, 2003 12:00 am

Re: Dither on Sample Rate conversion?

Post by Hugh Robjohns »

Mike Stranks wrote: Fri Aug 06, 2021 11:01 am ...its creators have said that they don't believe incorporating dither is necessary.

It's not a matter of belief... it's a matter of maths!

In practice, the acoustic/electronic noise floor of the source material is often sufficiently high to 'self-dither' and thus automatically alleviate any quantisation distortion resulting from a word-length reduction...

But that only applies for fixed-level material. If there's a fade-in or fade-out the embedded track noise fades too and at some point will be too low to self-dither -- and nasty quantisation distortions will then be audible.

Believe it or not, you always need to dither when you reduce the word-length. :D:ugeek:
User avatar
Hugh Robjohns
Moderator
Posts: 38968 Joined: Fri Jul 25, 2003 12:00 am Location: Worcestershire, UK
Technical Editor, Sound On Sound...
(But generally posting my own personal views and not necessarily those of SOS, the company or the magazine!)
In my world, things get less strange when I read the manual... 

Re: Dither on Sample Rate conversion?

Post by Eddy Deegan »

I watched the video WTF is dither? a while ago and found it very enlightening. There are a number of practical demonstrations with (audio examples) showing what different types of dither sound like at different word lengths, as well as information on when and how to apply it.
User avatar
Eddy Deegan
Moderator
Posts: 8816 Joined: Wed Sep 01, 2004 12:00 am Location: Brighton & Hove, UK
Some of my works | The SOS Forum Album projects  

Re: Dither on Sample Rate conversion?

Post by Wonks »

I hav reduce m wor lengt. Shoul I dithe?
User avatar
Wonks
Jedi Poster
Posts: 17020 Joined: Thu May 29, 2003 12:00 am Location: Reading, UK
Reliably fallible.

Re: Dither on Sample Rate conversion?

Post by Hugh Robjohns »

Monty Montgomery's tutorial on all things digital audio is another one well worth watching: https://www.youtube.com/watch?v=cIQ9IXSUzuM

He talks about dither from 11:40...
User avatar
Hugh Robjohns
Moderator
Posts: 38968 Joined: Fri Jul 25, 2003 12:00 am Location: Worcestershire, UK
Technical Editor, Sound On Sound...
(But generally posting my own personal views and not necessarily those of SOS, the company or the magazine!)
In my world, things get less strange when I read the manual... 

Re: Dither on Sample Rate conversion?

Post by Hugh Robjohns »

Wonks wrote: Fri Aug 06, 2021 11:52 am I hav reduce m wor lengt. Shoul I dithe?

no. gt a nw spel chekr...

:bouncy:
User avatar
Hugh Robjohns
Moderator
Posts: 38968 Joined: Fri Jul 25, 2003 12:00 am Location: Worcestershire, UK
Technical Editor, Sound On Sound...
(But generally posting my own personal views and not necessarily those of SOS, the company or the magazine!)
In my world, things get less strange when I read the manual... 

Re: Dither on Sample Rate conversion?

Post by Sundr0wn »

So i need to dither if i am reducing the word length? :think:
Jokes aside :D
I had a few discussion in different forums about this before with a bunch of people telling me a bunch of different things about how floating point works and it's just rounding, and your file is still 16bit as long as you dont do any processing (and me being an idiot doesnt help that either). :shocked:
For me it was clear when opening 16bit to 32float and not processing (ex. duplicating a mono track to stereo) no need to dither. But no one ever said anything specifically about resampling.

I forget who i am quoting but i guess "When in doubt, dither".

Got FinalCD set to sharp and dither is actually an option to turn on or off, even if the only option is shaped TPDF. :thumbup:
I did however run into the problem that it doesnt include a 1:1 filter (look the fancy terms i'm using :shifty: ) so i cant do 24bit 44.1 to 16bit.
Sundr0wn
New here
Posts: 5 Joined: Thu Aug 05, 2021 6:29 am

Re: Dither on Sample Rate conversion?

Post by Hugh Robjohns »

Sundr0wn wrote: Fri Aug 06, 2021 12:10 pm...floating point works and it's just rounding, and your file is still 16bit as long as you dont do any processing...

Sure... but you are doing processing. You're sample rate converting which means implementing low-pass filtering and sample reconstruction. The first will undoubtedly result in an extended word-length to maximise the accuracy of the process, and so dithering is required to generate the 16-bit output correctly.

Got FinalCD set to sharp and dither is actually an option to turn on or off, even if the only option is shaped TPDF. :thumbup:

Excellent. Set dither on! TPDF (triangular probability density function) is the standard 'vanilla' dither that sounds just like analogue tape hiss (but much quieter). Shaped TPDF will probably be pushing more dither noise energy into the upper end of the spectrum where it is less audible to us (because of our weird sense of hearing), resulting in a 16 bit output file that appears subjectively to be as quiet as an 18 or 20 bit file.
User avatar
Hugh Robjohns
Moderator
Posts: 38968 Joined: Fri Jul 25, 2003 12:00 am Location: Worcestershire, UK
Technical Editor, Sound On Sound...
(But generally posting my own personal views and not necessarily those of SOS, the company or the magazine!)
In my world, things get less strange when I read the manual... 

Re: Dither on Sample Rate conversion?

Post by Sundr0wn »

Hugh Robjohns wrote: Fri Aug 06, 2021 12:33 pm Sure... but you are doing processing. You're sample rate converting which means implementing low-pass filtering and sample reconstruction.

Thanks, yeah that's what i've realised now. Resampling isnt just cutting off the higher frequencies.
Shaped dither is godd for me, and TPDF also seems to be standard. I'm not gonna start now also trying to find the perfect dither, or i'm gonna go end up going crazy :crazy:
Even contacted the creator about implementing a 1:1 filter and it might be possible.
Sundr0wn
New here
Posts: 5 Joined: Thu Aug 05, 2021 6:29 am

Re: Dither on Sample Rate conversion?

Post by merlyn »

Sundr0wn wrote: Fri Aug 06, 2021 12:57 pm Even contacted the creator about implementing a 1:1 filter and it might be possible.

What is a 1:1 filter?
merlyn
Frequent Poster
Posts: 1224 Joined: Thu Nov 07, 2019 2:15 am
It ain't what you don't know. It's what you know that ain't so.

Re: Dither on Sample Rate conversion?

Post by Sundr0wn »

merlyn wrote: Fri Aug 06, 2021 1:46 pm What is a 1:1 filter?

I'm glad you ask :ugeek:
I have no idea actually, all i know is it allows the resampler to process files that are already 44.1 kHz. Hence the name 1:1 since it's the output samplerate is 1:1 the same than the input.
Basically the option to only reduce bit depth.
Sundr0wn
New here
Posts: 5 Joined: Thu Aug 05, 2021 6:29 am

Re: Dither on Sample Rate conversion?

Post by James Perrett »

If you are reducing bit depth then all you are doing is truncating the data by slicing off the bottom bits. The clever part comes before the slicing with the added dither which eliminates the truncation artefacts.

If you have a resampler that insists on feeding everything through a sample rate conversion process (it is possible that some do in order to simplify the program code) then I'd look for some other way to do the truncation.
User avatar
James Perrett
Moderator
Posts: 14352 Joined: Mon Sep 10, 2001 12:00 am Location: The wilds of Hampshire
JRP Music - Audio Mastering and Restoration. JRP Music Facebook Page

Re: Dither on Sample Rate conversion?

Post by merlyn »

Sundr0wn wrote: Fri Aug 06, 2021 3:54 pm
Hence the name 1:1 since it's the output samplerate is 1:1 the same than the input.

Thanks for clarifying that. A '1:1 filter' is then the same as no filter. :) It's not the filter that does the samplerate conversion. The filter takes out frequency components that otherwise would produce aliasing.

If you think about halving the sapmlerate then this could be done by dropping every second sample. Then that stream or file is run through the filter to remove frequency components above the Nyquist frequency.

To change the bit depth only you could use Audacity. It's also possibile to use Sox as the samplerate convertor in Audacity, and Sox on the highest setting is as good as anything.

If you have 16 bit files they are likely to have already been dithered. The preferred solution would be to go back to the source and export the 16 bit files at the samplerate you want. Not a huge issue though if that's not possible.
merlyn
Frequent Poster
Posts: 1224 Joined: Thu Nov 07, 2019 2:15 am
It ain't what you don't know. It's what you know that ain't so.

Re: Dither on Sample Rate conversion?

Post by Hugh Robjohns »

merlyn wrote: Tue Aug 10, 2021 1:13 pmIf you think about halving the sapmlerate then this could be done by dropping every second sample. Then that stream or file is run through the filter to remove frequency components above the Nyquist frequency.

Wrong order: you'd need to low-pass filter before discarding alternate samples... otherwise the aliasing has been embedded!
User avatar
Hugh Robjohns
Moderator
Posts: 38968 Joined: Fri Jul 25, 2003 12:00 am Location: Worcestershire, UK
Technical Editor, Sound On Sound...
(But generally posting my own personal views and not necessarily those of SOS, the company or the magazine!)
In my world, things get less strange when I read the manual... 
Post Reply