IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
How to downsample to 44.1kHz 16bit
darkbyte
post Sep 22 2013, 20:52
Post #1





Group: Members
Posts: 107
Joined: 14-June 11
Member No.: 91517



I've read this article yesterday: 24/192 Music Downloads and why they make no sense and also watched this video dealing with reampling and bit depth conversions: Xiph Digital Show & Tell Episode 2
I have very few audio files in other format than 44.1kHz 16bit but if it really makes no sense to have audio in higher resolution - in case the only thing i doing with them is listening - i like to downsample them. Some of them are 192kHz 24bit recordings of vinyls. I've planned to downsample them before i was reading the article but i was not sure how to do it correctly.

I'm currently experimenting with the SoX resampler of Foobar and using the internal dither of Foobar while converting to 16bit. Is this good enough? I'm using the following settings with the SoX resampler:
- Best quality
- Passband: 95%
- Not checked "Allow aliasing/imaging"
- 50% linear phase reponse

What i don't really understand is what the later two options do. Is it fine this way?

Also if i have a 44.1kHz 24 bit audio file or a 48kHz 16bit audio file does it make sense to downsample these to 44.1kHz 16bit aswell or i'm hurting the audio quality more than what i'll benefit filesize wise? These two are very close to actual 44.1kHz 16 bit audio so maybe the job of the converter is more difficult in this case. Or is it completly safe to do it?

Thanks. smile.gif

This post has been edited by darkbyte: Sep 22 2013, 21:09
Go to the top of the page
+Quote Post
saratoga
post Sep 22 2013, 21:55
Post #2





Group: Members
Posts: 4715
Joined: 2-September 02
Member No.: 3264



The settings in Sox don't really matter. Pretty much anything you pick will be overkill. I would just use the defaults.

Converting to 16 bit is not downsampling, it'll be handled separately by foobar. Assuming you've probably normalized your files so that they are not very quiet, there is no point in using 24 bit for vinyl transfers.
Go to the top of the page
+Quote Post
mjb2006
post Sep 23 2013, 20:56
Post #3





Group: Members
Posts: 706
Joined: 12-May 06
From: Colorado, USA
Member No.: 30694



QUOTE (darkbyte @ Sep 22 2013, 13:52) *
Also if i have [...] a 48kHz 16bit audio file does it make sense to downsample these to 44.1kHz 16bit aswell or i'm hurting the audio quality more than what i'll benefit filesize wise?


With a bad resampler, pretty much any sample rate change, even 48 to 44.1, is risking audible artifacts. How noticeable it is depends partly on the music, which can mask the noise sometimes.

But the SoX resampler, or the one in Audition? *kisses fingertips* Never any issues whatsoever, no matter what settings I use.

That said, I usually don't bother reducing 48 to 44.1 because it doesn't save much space. I may feel differently when my drives are all full, though.

This post has been edited by mjb2006: Sep 23 2013, 20:58
Go to the top of the page
+Quote Post
darkbyte
post Sep 24 2013, 11:32
Post #4





Group: Members
Posts: 107
Joined: 14-June 11
Member No.: 91517



I'll go with SoX then. Thanks! smile.gif
Go to the top of the page
+Quote Post
SoleBastard
post Nov 17 2013, 17:29
Post #5





Group: Members
Posts: 65
Joined: 13-August 04
Member No.: 16237



QUOTE (darkbyte @ Sep 22 2013, 21:52) *
- Not checked "Allow aliasing/imaging"


This is what I found about this option in another thread here

QUOTE
If the -a option is given, then aliasing/imaging above the pass-
band is allowed. For example, with 44.1kHz sampling rate, and a
resampling band-width of 95%, this means that frequency content
above 21kHz can be distorted; however, since this is above the
pass-band (i.e. above the highest frequency of interest/audi‐
bility), this may not be a problem. The benefits of allowing
aliasing/imaging are reduced processing time, and reduced (by
almost half) transient echo artefacts.

I see just advantages of allowing aliasing/imaging above the passband. Does anyone know why is it not then default?
Go to the top of the page
+Quote Post
saratoga
post Nov 17 2013, 17:49
Post #6





Group: Members
Posts: 4715
Joined: 2-September 02
Member No.: 3264



QUOTE (SoleBastard @ Nov 17 2013, 12:29) *
I see just advantages of allowing aliasing/imaging above the passband. Does anyone know why is it not then default?


http://en.wikipedia.org/wiki/Aliasing

Aliasing is a kind of distortion that good resamplers are designed to eliminate. There is no good reason to intentionally allow it unless you are on a machine that is too slow to properly handle it.
Go to the top of the page
+Quote Post
Wombat
post Nov 17 2013, 17:57
Post #7





Group: Members
Posts: 950
Joined: 7-October 01
Member No.: 235



QUOTE (SoleBastard @ Nov 17 2013, 18:29) *
I see just advantages of allowing aliasing/imaging above the passband. Does anyone know why is it not then default?

Most likely because aliasing can be a bad thing when used wrong and to prevent people complaining about it because aliasing is used as bad guy in many ways by audio press. Still i doubt any serious results on audibility with aliasing on/off for 44.1khz resampling is presented related to Sox so just use what makes you more happy. I use aliasing because i had some less clipping on heavily compressed material. Not audible but maximum no clipping gain changed.
Go to the top of the page
+Quote Post
saratoga
post Nov 17 2013, 18:02
Post #8





Group: Members
Posts: 4715
Joined: 2-September 02
Member No.: 3264



QUOTE (Wombat @ Nov 17 2013, 12:57) *
I use aliasing because i had some less clipping on heavily compressed material. Not audible but maximum no clipping gain changed.


Any resampler can change the maximum level of a signal, particularly if done at high precision. This is what resampling does: compute new points from old points. Because the new points aren't in the same locations as the old points, they will have different values, sometimes higher, sometimes lower.

If your sample is already clipping, its a good idea to replaygain it, or at least renormalize it so that you do not introduce even more clipping when converting back to integer PCM. Using a different resampler won't help with this though, unless the new one is secretly renormalizing for you, which would probably not be great.
Go to the top of the page
+Quote Post
skamp
post Nov 17 2013, 18:22
Post #9





Group: Developer
Posts: 1343
Joined: 4-May 04
From: France
Member No.: 13875



sox -G / --guard: Automatically invoke the gain effect to guard against clipping. I.e. sox will slightly attenuate the file when clipping may occur.

This post has been edited by skamp: Nov 17 2013, 18:26


--------------------
caudec.net
Go to the top of the page
+Quote Post
SoleBastard
post Nov 17 2013, 18:23
Post #10





Group: Members
Posts: 65
Joined: 13-August 04
Member No.: 16237



I indeed had the impression that it is disabled by default just to please people that don't understand the concepts of a lowpass filter and the upper limits of human hearing but just don't want 'aliasing' because it is considered as generally bad. However, transient echo artifacts *are* noticeable and reducing them could be a (albeit very small) advantage.


QUOTE (mjb2006 @ Sep 23 2013, 21:56) *
That said, I usually don't bother reducing 48 to 44.1 because it doesn't save much space. I may feel differently when my drives are all full, though.


I usually downsample to 44.1kHz from all sources just if I encode to MP3 since I know that LAME is specifically optimized for 44.1kHz material with -V presets.

This post has been edited by SoleBastard: Nov 17 2013, 18:25
Go to the top of the page
+Quote Post
Wombat
post Nov 17 2013, 18:31
Post #11





Group: Members
Posts: 950
Joined: 7-October 01
Member No.: 235



QUOTE (saratoga @ Nov 17 2013, 19:02) *
Any resampler can change the maximum level of a signal, particularly if done at high precision. This is what resampling does: compute new points from old points. Because the new points aren't in the same locations as the old points, they will have different values, sometimes higher, sometimes lower.

If your sample is already clipping, its a good idea to replaygain it, or at least renormalize it so that you do not introduce even more clipping when converting back to integer PCM. Using a different resampler won't help with this though, unless the new one is secretly renormalizing for you, which would probably not be great.

Thats why i do and aliasing has a slight advantage here.
Go to the top of the page
+Quote Post
Wombat
post Nov 17 2013, 18:35
Post #12





Group: Members
Posts: 950
Joined: 7-October 01
Member No.: 235



QUOTE (skamp @ Nov 17 2013, 19:22) *
sox -G / --guard: Automatically invoke the gain effect to guard against clipping. I.e. sox will slightly attenuate the file when clipping may occur.

When i remember right the guard command is not very intelligent. It simply applies a gain that sox thinks is safe for the operation. For resampling this means simply a gain of -3
Go to the top of the page
+Quote Post
Wombat
post Nov 17 2013, 18:43
Post #13





Group: Members
Posts: 950
Joined: 7-October 01
Member No.: 235



QUOTE (SoleBastard @ Nov 17 2013, 19:23) *
I indeed had the impression that it is disabled by default just to please people that don't understand the concepts of a lowpass filter and the upper limits of human hearing but just don't want 'aliasing' because it is considered as generally bad. However, transient echo artifacts *are* noticeable and reducing them could be a (albeit very small) advantage.

For 44.1kHz material and a typical filter starting above 20kHz this shouldn't be a problem. Somwhere here i once posted some spectral plots illustrating that aliasing used with Sox indeed clearly reduces the post and pre ringing.
Go to the top of the page
+Quote Post
saratoga
post Nov 17 2013, 18:44
Post #14





Group: Members
Posts: 4715
Joined: 2-September 02
Member No.: 3264



QUOTE (Wombat @ Nov 17 2013, 13:31) *
QUOTE (saratoga @ Nov 17 2013, 19:02) *
Any resampler can change the maximum level of a signal, particularly if done at high precision. This is what resampling does: compute new points from old points. Because the new points aren't in the same locations as the old points, they will have different values, sometimes higher, sometimes lower.

If your sample is already clipping, its a good idea to replaygain it, or at least renormalize it so that you do not introduce even more clipping when converting back to integer PCM. Using a different resampler won't help with this though, unless the new one is secretly renormalizing for you, which would probably not be great.

Thats why i do and aliasing has a slight advantage here.


What?

QUOTE (Wombat @ Nov 17 2013, 13:35) *
QUOTE (skamp @ Nov 17 2013, 19:22) *
sox -G / --guard: Automatically invoke the gain effect to guard against clipping. I.e. sox will slightly attenuate the file when clipping may occur.

When i remember right the guard command is not very intelligent. It simply applies a gain that sox thinks is safe for the operation. For resampling this means simply a gain of -3


According to the documentation, this is not the case. And anyway, since the resampler uses floating point, this would be pointless anyway. You can trivially renormalize FP values to be within [-1 1].
Go to the top of the page
+Quote Post
skamp
post Nov 17 2013, 18:50
Post #15





Group: Developer
Posts: 1343
Joined: 4-May 04
From: France
Member No.: 13875



I tried (on a single file, admittedly):

  • original (24 / 88.2): -0.1 dBFS peak (0.98843944 FS), -5.92 dB track gain
  • resampled to 24 / 44.1, with -G: very slightly below 0 dBFS peak (0.99999559 FS), -5.47 dB track gain
  • resampled to 24 / 44.1, without -G: 0 dBFS (1.0 FS), -5.92 dB track gain


This post has been edited by skamp: Nov 17 2013, 18:51


--------------------
caudec.net
Go to the top of the page
+Quote Post
saratoga
post Nov 17 2013, 18:58
Post #16





Group: Members
Posts: 4715
Joined: 2-September 02
Member No.: 3264



QUOTE (skamp @ Nov 17 2013, 13:50) *
I tried (on a single file, admittedly):

  • original (24 / 88.2): -0.1 dBFS peak (0.98843944 FS), -5.92 dB track gain
  • resampled to 24 / 44.1, with -G: very slightly below 0 dBFS peak (0.99999559 FS), -5.47 dB track gain
  • resampled to 24 / 44.1, without -G: 0 dBFS (1.0 FS), -5.92 dB track gain


So basically, the guard option works correctly, and if you don't use it you get clipping.

Use the guard option !
Go to the top of the page
+Quote Post
Wombat
post Nov 17 2013, 18:59
Post #17





Group: Members
Posts: 950
Joined: 7-October 01
Member No.: 235



QUOTE (skamp @ Nov 17 2013, 19:50) *
I tried (on a single file, admittedly):

  • original (24 / 88.2): -0.1 dBFS peak (0.98843944 FS), -5.92 dB track gain
  • resampled to 24 / 44.1, with -G: very slightly below 0 dBFS peak (0.99999559 FS), -5.47 dB track gain
  • resampled to 24 / 44.1, without -G: 0 dBFS (1.0 FS), -5.92 dB track gain

I know it somehow didn't work for me. How is it when you guard an album with single tracks? Does it apply different gains?
It also may have done something wrong when used with realtime resampling at my Squeezebox server. I only know i didn't use it.
Go to the top of the page
+Quote Post
saratoga
post Nov 17 2013, 19:06
Post #18





Group: Members
Posts: 4715
Joined: 2-September 02
Member No.: 3264



QUOTE (Wombat @ Nov 17 2013, 13:59) *
It also may have done something wrong when used with realtime resampling at my Squeezebox server. I only know i didn't use it.


Its impossible to perform a processing step that must scan the entire file in realtime, so no, you did not use it smile.gif

If you want to do this without processing the entire file first, use replaygain. Essentially all the guard option is doing is computing the replaygain track peak after processing. If you use replaygain, you can simply skip that step and so perform the resampling in real time.

Go to the top of the page
+Quote Post
Wombat
post Nov 17 2013, 19:28
Post #19





Group: Members
Posts: 950
Joined: 7-October 01
Member No.: 235



QUOTE (saratoga @ Nov 17 2013, 20:06) *
QUOTE (Wombat @ Nov 17 2013, 13:59) *
It also may have done something wrong when used with realtime resampling at my Squeezebox server. I only know i didn't use it.


Its impossible to perform a processing step that must scan the entire file in realtime, so no, you did not use it smile.gif

If you want to do this without processing the entire file first, use replaygain. Essentially all the guard option is doing is computing the replaygain track peak after processing. If you use replaygain, you can simply skip that step and so perform the resampling in real time.

How do you know i didn't use it? Was it not exactly that case i described? When sox doesn't have the chance to process the file twice does the guard command then simply apply a safe negative gain?

Edit: btw. why we are again discussing questions nobody asked? I simply answered what aliasing makes different with sox for me.

This post has been edited by Wombat: Nov 17 2013, 19:33
Go to the top of the page
+Quote Post
saratoga
post Nov 17 2013, 19:33
Post #20





Group: Members
Posts: 4715
Joined: 2-September 02
Member No.: 3264



I'm telling you that its logically impossible for that option to work like you want in realtime mode. I don't know what it does in that case but you can probably look it up in the manual.

Edit: yeah and I'm telling you that you are wrong about what the alaising option does in Sox.

Edit2: What I was trying to say above and I think you misunderstood is that changes in the peak value are an intrinsic part of resampling. Its not possible for one resampler to be better or worse at this. Changing the resampler to avoid this problem means that you're doing something wrong. Hence I was suggesting how to setup sox so that you do not have this problem (e.g. use replaygain or the guard option depending on what you are doing).

This post has been edited by saratoga: Nov 17 2013, 19:52
Go to the top of the page
+Quote Post
skamp
post Nov 18 2013, 16:50
Post #21





Group: Developer
Posts: 1343
Joined: 4-May 04
From: France
Member No.: 13875



QUOTE (Wombat @ Nov 17 2013, 18:59) *
How is it when you guard an album with single tracks? Does it apply different gains?


Doesn't matter, because:

  • if the guard parameter needs to do its thing in order to avoid clipping, the attenuation is very small;
  • other tracks with high peaks will be attenuated by a similar (close enough) amount;
  • even if some tracks get slightly attenuated, and others don't, the difference won't be any larger (most likely lower) than the differences in Replaygain track gains one can find in pretty much all albums (i.e. the tracks in any given album are almost never of the same perceptual loudness, as computed by Replaygain).


This post has been edited by skamp: Nov 18 2013, 16:51


--------------------
caudec.net
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 18th April 2014 - 15:42