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: Downsampling Vinyl-rips and Bandcamp downloads with SOX (Read 9434 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Downsampling Vinyl-rips and Bandcamp downloads with SOX

Hello. I would like to downsample my old 192/24 and 96/24 Vinyl rips to CD quality (44.1/16), and also some of my bandcamp downloads which came in 44.1/24 format, all this so I can free up space and still have good quality for archival.
I've read a few topics about dithering and avoiding clipping with SoX (I'm using 14.4.2), and I've decided on this command line;
Spoiler (click to show/hide)
I get 44.1/16, default dither, guard against clipping, and a log. My questions are; Is this a good way to avoid clipping? I've seen some people say you have to do it in Audacity or something like that. And can I use this exact same SoX command line setting for both Vinyl and Bandcamp stuff or is it better to change some of the settings?

Re: Downsampling Vinyl-rips and Bandcamp downloads with SOX

Reply #1
Clipping from resampling is generally inaudible. If you use guard against clipping and convert tracks separately, it can change loudness difference between tracks in album.

If transition between source tracks is gapless, you can get audible clicks between tracks after resampling.
Example. 2 source files 96/24 with gapless transition - https://www.dropbox.com/s/hvwc9mx4h77afur/96-24%20gapless.zip?dl=0
Converted to 44/16 with sox (sox.exe" %%A -b 16 "%~dp0%%~nA--.wav" rate -v 44100 dither) - https://www.dropbox.com/s/l0l0ynkyb1ga1nh/44-16%20click.zip?dl=0
Between 44/16 files there is clearly audible click. Solution for this can be merge files before conversion, then split after conversion.

Re: Downsampling Vinyl-rips and Bandcamp downloads with SOX

Reply #2
I don't use SoX, but I agree.   Your settings are fine (for both the digital and digitized vinyl).

Quote
all this so I can free up space and still have good quality for archival.
WAV files?   FLAC will cut your file size almost in half (losslessly) and tags (metadata) is better-supported.



----------------------------------------
It's very unlikely that you'll hear any very-slight and very-short duration clipping caused by re-sampling, but still, it's good practice to guard against clipping. Other processes, such as EQ or mixing are more-likely to boost the peaks/levels and that's where you have to be careful about clipping.   The vinyl may not even be 0dB normalized so there may be some headroom in those files, and they probably aren't digitally-limited so if they are normalized there should be fewer 0dB peaks to begin with.

Dither is generally also good practice when downsampling.   But, at 16-bits or better it's not audible under any normal/reasonable conditions so practically speaking, it shouldn't make any difference.    And since dither is noise, it's not necessary with (already noisy) digitized vinyl.   Theoretically, you wouldn't want to add any noise to vinyl.  But, the dither is very low level compared to the existing vinyl noise so it won't do any harm. 

Re: Downsampling Vinyl-rips and Bandcamp downloads with SOX

Reply #3
-L (linear phase response) is used by default.
-v (very high quality) seems like overkill for 16 bit, -h (also a default) should be enough:

QualityBandwidthRej dBTypical use
-hhigh95%12516-bit mastering (use with dither)
-vvery high95%17524-bit mastering
Also, regarding dither, by default it uses TPDF noise, it needs -s option to use noise shaping. I can't say which is better or if I would notice the difference between the two (or even if I would notice a lack of dither :-)), certainly not with vinyl rips.

Re: Downsampling Vinyl-rips and Bandcamp downloads with SOX

Reply #4
If transition between source tracks is gapless, you can get audible clicks between tracks after resampling.
Interesting.  I've never noticed this issue using the "Resampler (Sox)" component in foobar2000.  Typically, I'm converting FLAC 24/96 or 24/192 to 16/44.

Re: Downsampling Vinyl-rips and Bandcamp downloads with SOX

Reply #5
Interesting.  I've never noticed this issue using the "Resampler (Sox)" component in foobar2000.  Typically, I'm converting FLAC 24/96 or 24/192 to 16/44.
I guess we came across that problem more than once. Better always check the gaps.
I remember bandpass once suggested to use shorter filters so not using VHQ for no reason to minimize this effect.

Edit: Wasn't one solution to use "Don't reset DSP between tracks" in foobar? Maybe you have set this and never had to wurry.
Is troll-adiposity coming from feederism?
With 24bit music you can listen to silence much louder!

Re: Downsampling Vinyl-rips and Bandcamp downloads with SOX

Reply #6
@lvqcl, care to test how well the LPC predictor from Vorbis would mitigate this in your SoX resampler?

Re: Downsampling Vinyl-rips and Bandcamp downloads with SOX

Reply #7
Edit: Wasn't one solution to use "Don't reset DSP between tracks" in foobar? Maybe you have set this and never had to wurry.
It also moves boundaries between tracks, and resulting files will have slightly different durations.

@lvqcl, care to test how well the LPC predictor from Vorbis would mitigate this in your SoX resampler?
Unforunately, I don't have much free time now, so... maybe, but in some unknown future.

Re: Downsampling Vinyl-rips and Bandcamp downloads with SOX

Reply #8
Different sources here:

* Vinyl rips.
I'd say they "need gaplessness", as a track transition click in the surface noise is likely more annoying than the surface noise itself.
OTOH, they are usually digitized a side at the time.  If you have "image + cue" then resampling the image should avoid all gaplessness issues, eh?
Also, needledrops probably should be volume-normalized (fb2k, Album Gain avoiding peak?).  At least it would be bad practice to record them without headroom.

* Bandcamp hi-rez's:
The OP says these are 44.1/24, right? Then ... no resampling! (I have a few 48k and 96k files from Bandcamp, but if the OP does not ...)
And it has happened to me that a single track on a Bandcamp album is in a different format, but then none of these have required gaplessness anyway. YMMV.


BTW, I wonder what would be the reasons to use a less than stellar resampling. You do this once and for all, it can't cost that much on your electricity bill?

Re: Downsampling Vinyl-rips and Bandcamp downloads with SOX

Reply #9
The OP says these are 44.1/24, right? Then ... no resampling!
To dither these down to 16bit does not introduce any clicks. Just saying...
Is troll-adiposity coming from feederism?
With 24bit music you can listen to silence much louder!

Re: Downsampling Vinyl-rips and Bandcamp downloads with SOX

Reply #10
If you use guard against clipping and convert tracks separately, it can change loudness difference between tracks in album.
I tested a few tracks and I got these numbers;
Spoiler (click to show/hide)
But if (as DVDdoug said) it's good practice to use the guard option, then I would want to leave it in, better to be safe than sorry. On the other hand, when does the loudness difference caused by this clipping protection become noticable? Is it a cause for worry?
If transition between source tracks is gapless, you can get audible clicks between tracks after resampling.
I didn't hear any clicks between the linked files using f2k, but thanks for the heads up, I will surely check my files after each resample.
WAV files?
I'm using FLAC but still, even 24-bit vs 16-bit takes up twice as much space, so I'm trying to downsample everything that's bigger than CD quality, since that's my most used format anyway.
Theoretically, you wouldn't want to add any noise to vinyl.  But, the dither is very low level compared to the existing vinyl noise so it won't do any harm.
I've used ABX to check if I can notice any difference between the source file and the dithered file and I couldn't hear any difference on dead silent parts (tried both vinyl rips and bandcamp files), even with the volume set to max.
So I think I should leave dither on, to keep up the good practice!
If you have "image + cue"
I store my music as separate files for each song (gaps appended), It made more sense to me when I was not using f2k and had to choose the songs from their folder and it became a habit.
The OP says these are 44.1/24, right? Then ... no resampling!
Yes, It's weird but some of them really came in 44.1/24 instead of 44.1/16.  Also, sorry for my incorrect terminology, what I meant was "dither down" those files. I'm planning to use the same command line for them too since SoX seems to skip the unnecessary resampling process anyway.
BTW, I wonder what would be the reasons to use a less than stellar resampling. You do this once and for all
That's my thinking too, I will delete the source files after I'm done so I better do it right!

Re: Downsampling Vinyl-rips and Bandcamp downloads with SOX

Reply #11
Does "sox INFO gain: 0.534dB not reclaimed" mean that you lose half a dB and potentially go from 16 bits resolution to 15.9 bits resolution? Not sure if I would bother ;-)

By the way, it is not "weird" that Bandcamp downloads come as 44.1/24. The artist may have saved as 44.1/24, and uploaded that file. Nothing says they have ever been on CD.

 

Re: Downsampling Vinyl-rips and Bandcamp downloads with SOX

Reply #12
It's been a while since I've used Audacity but I tried out what happens when I normalize the whole album to -1.0dB to give some headroom (only normalize ticked, dither off), export it in original quality and then use SoX to downsample.
It seems to have eliminated any clipping, plus the volume difference I get when I use the guard option. Is this a recommended way to avoid clipping after resampling?

Does "sox INFO gain: 0.534dB not reclaimed" mean that you lose half a dB and potentially go from 16 bits resolution to 15.9 bits resolution? Not sure if I would bother ;-)

I went back to check the clipping part in that track and it seems that a nasty vinyl click clipped, but I can't hear the clipping itself.
Do you think it's better to ignore the reported clipping if I listen to it and can't hear it? That would save me the hassle of normalizing in Audacity, or letting SoX turn down the volume of a single track by half dB, potentially interrupting the flow of the album volume-wise, but I don't know if ignoring it can cause me more trouble in the future, for example when I want to convert to mp3 for portable use.

Re: Downsampling Vinyl-rips and Bandcamp downloads with SOX

Reply #13
I've settled on using the amplify effect in Audacity whenever I notice SoX causing clipping and it worked great so far.
I import all of the album tracks, highlight them, and with the amplify effect I seem to keep the original loudness balance of the individual tracks (normalize makes the quieter tracks loud, so I'm not using that).

One thing I noticed though is the difference between the original 192/24 and the 44.1/16 (-0.2dB, resampled and dithered via SoX) spectogram, the resampled one looks more smudged, or smeary, don't know the right word.
Is that how it's supposed to look after resampling or did I do something wrong?

Re: Downsampling Vinyl-rips and Bandcamp downloads with SOX

Reply #14
One thing I noticed though is the difference between the original 192/24 and the 44.1/16 (-0.2dB, resampled and dithered via SoX) spectogram, the resampled one looks more smudged, or smeary, don't know the right word.
Is that how it's supposed to look after resampling or did I do something wrong?
It seems normal.


Just don't forget, that for Audacity not to dither automatically when saving to 24 or 16 bit you should disable dither in settings Edit->Preferences->Quality
http://wiki.audacityteam.org/wiki/Dither

Also, if you are using Audacity anyway, the whole process can be done in Audacity. Audacity uses SoX resampler with default band-width 95% and linear phase since version 2.0.3. http://wiki.audacityteam.org/wiki/Libsoxr
In Edit->Preferences->Quality set Default sample format to 32, High-quality Conversion Sample Rate Converter to Best, High-quality Conversion Dither to Triangle (or Shaped if you prefer dither+noise shaping). After opening your files and using Amplify effect, change Project Rate (it is in left bottom corner by default) then export to 16 bit. Resampling and dither will be done automatically when exporting.

Re: Downsampling Vinyl-rips and Bandcamp downloads with SOX

Reply #15
One thing I noticed though is the difference between the original 192/24 and the 44.1/16 (-0.2dB, resampled and dithered via SoX) spectogram, the resampled one looks more smudged, or smeary, don't know the right word.
Is that how it's supposed to look after resampling or did I do something wrong?
The visual difference is caused by using the same FFT size in different sample rates. It has nothing to do with sound quality at all.