Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: To dither, or not to dither? (Read 6645 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

To dither, or not to dither?

Should i dither files when simply changing the sample rate? So for example i open a 16bit 48kHz file in audacity (as 32bit float), resample it to 44.1kHZ and then export it again to 16bit 44.1kHz, should i dither on export?

For reference, i'm resampling files i get from bandcamp to burn on CDs. Obviously i dither 24bit files since i'm changing bit depht, but i cant get a conclusive answer when it comes to only changing the sample rate, some people say yes some say no.
Please no turff war on wether it is audible or not, i'm just interested in the dry technical aspect of it.

Re: To dither, or not to dither?

Reply #1
Audacity is doing processing in 32 bit float, so your 16 bit file actually becomes 32 bit float after resampling. So, yes, you should dither on export to 16 bit.

BTW, if transition between original tracks is not silence, and you are resampling tracks one by one, you can get audible clicks between tracks - https://hydrogenaud.io/index.php?topic=114960.msg947760#msg947760 If you can afford foobar2000, i would recommend to use it instead of Audacity. Because it can avoid these clicks between tracks with option "Don't reset DSP between tracks". Also it is very convenient for mass conversion.

Re: To dither, or not to dither?

Reply #2
You just opened a whole 'nother can of worms. I spent the last hours reading up on clipping audio, since i did notice some in my waveforms. I'm drowning in a sea of confusion about limiters, replaygain, normalizng etc. And i'm starting to question if there even is really a way for a noob wanna-be audio engineer like me to properly downsample higher quality files to 16bit 44.1kHz without noticeably changing the audio information. How accurate of a representation of the music is the waveform even? I've got tracks where the waveform looks 'normalized', so all blue lines peak at more or less the same level, and after simply resampling suddenly singular blue lines go out way further than the rest (even when not clipping)
I gotta run now but i'll post some screenshots later.

Re: To dither, or not to dither?

Reply #3
I never used Bandcamp so I have no idea what format they are using. Always use lossless if its possible.
Audacity is using SoX resampler internally so you don't have to worry about quality - it will be great (transparent).
I assume you are creating a mixed CD with music from various artists.
If I were you I would do the following:

1. Import original audio
2. Resample to 44.1 kHz
3. Apply 20 kHz lowpass
4. Use loudness normalization tool to normalize everything to -14 LUFS
5. If there are only peaks clipping use limiter to remove them (I usually leave 1 dB headroom)
-- If the whole audio is clipping (this never really happens) play with compressor and other stuff
6. Cut excess silence and apply fade-in/fade-out for smooth intro/outro
7. Export as 16-bit WAV
8. I always used ImgBurn to create audio image because it allows you to add CD-Text (if your player supports it)
9. Use high quality CD. This is very important. I used some no-name brand CD and it didn't work at all, then I bought Verbatim AZO or something like that and it works great.

Like Rollin said, Audacity works in 32-bit float internally so you will need to use dithering.
There are 3 different dithering algorithms in Audacity. I use Rectangle.

There is no simple answer for your question. Some songs are actually two part songs.
First part is usually quieter intro and second part is rest of the song.
If you use loudness normalization here you will ruin the song.

You will need to do some experiments by yourself and see what works best for you.
The only important thing is that it sounds good to you.

Edit: Just wanted to give you an example of two part song. The Road To Hell by Chris Rea.
Totally ruined by loudness normalization.
gold plated toslink fan

Re: To dither, or not to dither?

Reply #4
Bandcamp uses different formats but i always download as WAV. Artist are required to upload their Tracks as either 16 or 24bit WAV, while the Frequency rate can be anything i think, i've seen from 44.1kHz to 196kHz. Even some Mono tracks. Since my goal is to store anything as CD quality FLACs and burn on CDs, i resample anything that is above that. (I havent had any files below 16bit 44.1kHz so far from bandcamp). I am mostly concerned about quality of the digital file in this case here, if that is in order anything i do after that will be too.
However i only burn complete albums, i dont change any track orders or make mixtapes. So it is also important for me that the overall audio levels and 'sound' stay the same (also if some tracks on an album are louder than others that difference should be preserved). Especially since many albums also come with only a few select tracks being higher than CD quality, so i'm not resampling the entire album. I also leave in silence since i regard it as 'the way the artist intended'.
My endgoal is to downsample these tracks without any change in any form to the original audio (if possible like that).

Why does it clip in the first place when only resampling, isnt there a way to avoid that?

Like Rollin said, Audacity works in 32-bit float internally so you will need to use dithering.
There are 3 different dithering algorithms in Audacity. I use Rectangle.
So is it better if i import these files as 16bit before resampling and then export without dither? In a previous discussion on the audacity forum i was told that i should also import any and all files as 32bit and apply dither whenever i do any kind of processing.

Quote: "If you want to do things "technically perfect", then there is exactly ONE situation when dither should be disabled:

If your input audio is 16-bit or 24-bit, and your exported file is exactly the same format as the input file
AND
you are not applying any processing of any kind to the audio.

"Cut / delete / copy / paste / trim" do not count as "processing", they are just "edits".
"Fade / Amplify / Normalize / Noise Reduction / Equalization / and just about everything else" DO count as "processing" and dither should be enabled for best sound quality.

It is best to import as 32-bit float in all cases.
It is best to use dither in all cases except for the one case described above, but even for that one case it doesn't matter much if dither is applied."

Also i just saw this while reading through that post again: "32-floating doesn't overload. If you apply an effect, filter, process, or correction that causes the timeline waves to exceed 100%, that's the end of those waves. They're clipped, distorted, and permanently damaged in 16-bit. In 32-floating, the good quality work louder than 100% is still up there waiting for you to decide what to do" so am i worrying about the clipping for nothing here? Since in the third example below all the parts that where clipping are now inside the waveform again after exporting? (albeit still why higher than before)

Here's an example of a 16bit 48kHz file. I have to do another try with a 24bit file later on but i couldnt find one right now that hasnt already most of the waveform filled up so i can see the difference properly.

First image is the original 16bit 48kHz file
Second image is the same file after resampling to 44.1kHz
Third image is the same file after resampling to 44.1kHz and then exporting to 16bit with shaped dither.


Re: To dither, or not to dither?

Reply #5
Oh, I thought you were creating mixed Audio CD, my bad.
You are overthinking it. You are not going to hear any difference.
Ignore waveform display. You are using ears to listen to music, not eyes.
In your case, do what Rollin said and use foobar2000.
If you are very sceptical about resampling, why don't you use FLAC directly?

Off-topic: I don't like this at all.
Especially since many albums also come with only a few select tracks being higher than CD quality, so i'm not resampling the entire album.
gold plated toslink fan

Re: To dither, or not to dither?

Reply #6
I have encountered cases where Bandcamp lossless versions are different sample rate or bit depth, actually.  Maybe it was ALAC that was the odd one. I don't remember precisely how I found out, but it might have been a free download where I wanted to see if youtube-dl would get different metadata for MP4 vs for FLAC (yes, apparently).  Note, there is a distinction between $0 and free. Free downloads can be retrieved with downloaders without logging in. Those $0 or above will allow you to get it for free by buying it for $0 as logged-in user.

Off-topic: I don't like this at all.
Especially since many albums also come with only a few select tracks being higher than CD quality, so i'm not resampling the entire album.
You must expect that for compilations when the artist supplies the file. The label can then either just upload it, or (1) do work [bad] and (2) risk doing something wrong and get the blame for it [also bad] or (3) get an angry e-mail from the artist who wanted their file to be 96/24.

I have also seen it happen to bonus tracks.  If those were never downmixed to CDDA in the first place ...

(More off topic: be warned that Bandcamp might cancel your purchase after you have paid, without refunding you. BTDT; Bandcamp blaming piracy, got a written confirmation from the artist's manager that it was legit. So ... Boomkat, here I am.)

Re: To dither, or not to dither?

Reply #7
HA is all about blind listening tests and ToS#8. Until someone asks about dithering and we're all suddenly experts. You won't be able to tell the difference, dithered or not. To all those recommending dithering, lets see your ABX results please.

Re: To dither, or not to dither?

Reply #8
You won't be able to tell the difference, dithered or not.

That's because there happens to be so much as 16 bits at play, not because it is good practice to pretend dithering is nonsense.

If someone said "Use 18 dB headroom OR prove that 13 bits with dither is insufficient for your own very ears!", you would probably shrug them off too. And if they followed up with "To all those recommending 16 bits for CDDA ..."

Edit:
Some dither samples, haha: http://darkroommastering.com/uploads/2013/02/8.png

Re: To dither, or not to dither?

Reply #9
@NateHigs
Fair enough.
I am too lazy to make my own samples so I used the ones that I found on Audacity's website.

Dither:
Spoiler (click to show/hide)

No dither:
Spoiler (click to show/hide)

What now? 16-bit is not transparent to me but my signature clearly says that everything above 16-bit is scam. Is there something wrong with my brain/hearing?
Porcus gave you great explanation above why we use dithering.
gold plated toslink fan

Re: To dither, or not to dither?

Reply #10
-84dB in 96.3dB SNR is a case where you're going to hear the quantization noise when you amplify it back; shaping isn't going to help much if there's only 12.3dB of signal above the noise floor.

16 bit is however enough to not hear quantization noise at -84dB if it was non-linear or 16-bit floating "half-precision" sampling instead of integer linear.

Re: To dither, or not to dither?

Reply #11
Why does it clip in the first place when only resampling
By resampling you are filtering out some frequencies. This changes the waveform slightly, which means that any sample can get bigger or smaller. If it gets bigger and before it was already near the full scale, then it clips.
isnt there a way to avoid that?
In Audacity? Yes. As your quote below says, float doesn't really clip. The correct sample value is still there, only it is bigger than 1.0 and that's why it is marked as clipped. You can apply "Amplify" effect to reduce the volume to the level that avoids clipping. IIRC it will even automatically fill in correct gain value to do so.
It is best to import as 32-bit float in all cases.
Er... is it even possible to import as anything else?

 

Re: To dither, or not to dither?

Reply #12
What now? 16-bit is not transparent to me but my signature clearly says that everything above 16-bit is scam. Is there something wrong with my brain/hearing?
And that was at your usual listening volume? Impressive then (but not sure if hearing or volume ;-) )

Re: To dither, or not to dither?

Reply #13
It is best to import as 32-bit float in all cases.
Er... is it even possible to import as anything else?

Yeah by changing default sample rate, i found a chart in the manual. I think setting it to 24bit imports 24bit files a such but the others as 32bit and setting it to 16 does the same with 16bit files.

So apparantly it is preferable to use foobar2000 for resampling over audacity?
I downloaded it but so far it's only a music player. There's only one resampler on the extensions page but it's not marked as SoX, is that the correct one. And does it also work in 32bit float? So far that's the one reason i'm not sure if i should ditch audacity but batch processing does sound real nice.
Lastly if anyone can recommend me a good guide to setting it up correctly, i'm still not very good at command lines.

Re: To dither, or not to dither?

Reply #14
You can find SoX resampler here: https://hydrogenaud.io/index.php?topic=67376.0

To install it:
1. Open foobar2000
2. Click File - Preferences
3. Choose Components
4. Drag foo_dsp_resampler.fb2k-component into foobar2000
5. Apply changes and restart foobar2000

To convert files:
1. Drag and drop your music into foobar2000
2. Select all of your files and right mouse click
3. Choose Convert - ...
4. Create a new preset, name it whatever you want
5. In Output format choose FLAC and level 8 (this will give you the best compression)
-- Change output bit depth to 16-bit and dithering to always
6. Destination is self explanatory
7. In Processing add 'Resampler (SoX)', change target sample rate to 44.1 kHz (no need to play with other settings)
8. Other is self explanatory (mainly tagging)
9. Click Convert

Everything works in 32-bit float. You can also use Audacity for batch processing if you want.
Trust me, everything is transparent. You are not going to hear any difference.
gold plated toslink fan