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: Order: Changing sampling format and sampling rate of Audio. (Read 677 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Order: Changing sampling format and sampling rate of Audio.

If I want to change the sampling format and sampling rate of an audio file is there a particular order I have to follow? Or does it not matter?

Re: Order: Changing sampling format and sampling rate of Audio.

Reply #1
Suppose you want to convert a 24/96 file to 16/44.1...
1. Convert to a higher bit-depth (e.g. 32/64-bit float)
2. Resample to 44.1k
3. If the resampling process introduced sample values beyond 1.0 (0dBFS), apply a negative gain
4. Dither
5. Convert to 16-bit

Intermediate steps are all done in the highest possible bit-depth supported by the application's internal data path to minimize quantization error, and to prevent clipping.

Re: Order: Changing sampling format and sampling rate of Audio.

Reply #2
What is sampling format?

To convert sample rate, just convert sample rate. No dithering is relevant for sample rate conversions, only for bit rate conversions, mainly when decreasing bit depth.
I don't believe there is any value in an intermediate step if you want to reduce bit depth.

If you want to both change sample rate and reduce bit depth, do the sample rate conversion first. The programs I've used automatically apply the steps in the proper order (sample rate, dither, bit depth) when you order them as a single step but, possible, this is not true of all application programs.

If you are doing this as the end product of a multiple step processing (e.g. compressions, mixing tracks, equalizing, applying other effects, adjusting level, etc. you really are better off (or rather the audio is) if you are working in floating point format to begin with.

 

Re: Order: Changing sampling format and sampling rate of Audio.

Reply #3
Proper resampling requires a low pass filter to eliminate aliasing. The filter will generate intermediate amplitude values which cannot be exactly represented by the file's original bit-depth (e.g. 16).

Dither is irrelevant only when the destination format is float. If you resample from 16/48 to 16/44, dithering is still required to eliminate correlated quantization error.

Original file, -80dBFS tone at 16/48
X

16/44, without dither
X

16/44, with dither
X

Relevant settings from Adobe Audition 1.5 that made the difference:
X

Re: Order: Changing sampling format and sampling rate of Audio.

Reply #4
Suppose you want to convert a 24/96 file to 16/44.1...
1. Convert to a higher bit-depth (e.g. 32/64-bit float)
2. Resample to 44.1k
3. If the resampling process introduced sample values beyond 1.0 (0dBFS), apply a negative gain
4. Dither
5. Convert to 16-bit

Intermediate steps are all done in the highest possible bit-depth supported by the application's internal data path to minimize quantization error, and to prevent clipping.



What if I want to convert from 16/44.1 to 32/48 ? Should I follow the same method? Also what you said seems to conflict with Andy who says do the sample rating conversion first!

Your post of explaining the use of dither is very helpful thank you!

Re: Order: Changing sampling format and sampling rate of Audio.

Reply #5
https://izotope-rx.livejournal.com/4971.html
You can see how resampling can change, and especially, increase the amplitude of a signal, as well as adding intermediate amplitude values. Since integer (8/16/24 bits) formats will clip any signal beyond 0dBFS, you need to convert to floating point BEFORE resampling to prevent this to happen. If a specific program does not support float, then you need to have some speculation about potential clipping, and apply a negative gain to the signal prior to resampling. If you do this, you still need to increase the signal to a higher integer bit-depth to minimize quantization error BEFORE applying a negative gain.

For 16/44.1 to 32/48, if the 32 is float, there is no way to dither because dithering relies on fixed quantization steps, but floating point formats don't use fixed quantization steps. If the 32 is integer, some software may still allow dithering, but not all software offer this option as it is unimportant anyway, the quantization error in this bit-depth is too small to begin with.

Re: Order: Changing sampling format and sampling rate of Audio.

Reply #6
Thank you this helped!!!

Re: Order: Changing sampling format and sampling rate of Audio.

Reply #7
1. Convert to a higher bit-depth (e.g. 32/64-bit float)
Actually, most of modern audio editing/converting software will can automatically do conversion to 32 bit float when doing any processing.

Re: Order: Changing sampling format and sampling rate of Audio.

Reply #8
1. Convert to a higher bit-depth (e.g. 32/64-bit float)
Actually, most of modern audio editing/converting software will can automatically do conversion to 32 bit float when doing any processing.

Yes, but not all of them, if you look at the screenshot of my old Adobe Audition. It is important to point it out because some people don't aware that the software they use do that automatically, and assume it is not necessary to increase the bit depth prior to subsequent processing.

A real example:
https://hydrogenaud.io/index.php?topic=113972.0

SoX for example, works in integer, users either need to use the -G switch to guard against clipping, or manually attenuate the signal to provide headroom.


Re: Order: Changing sampling format and sampling rate of Audio.

Reply #10
I made the highlighted comment about MP3 decoding. Maybe that behavior has since changed. Izotope does promote the file to 32-bit before resampling.

It was reasonable to list all the steps in order without knowing what the precise intent of the OP was. Maybe he wanted to write a program and do perform those actions manually. I've heard that some people reduce the bit depth first, and the sound editor can't guess if that is wrong.

 
SimplePortal 1.0.0 RC1 © 2008-2021