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: Need some advice on resampling 192Khz/32bit float. (Read 2542 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Need some advice on resampling 192Khz/32bit float.

Hello, I'm seeking advice on the optimal method to convert 192kHz/32-bit Float WavPack files to 44.1kHz/16-bit FLAC. After researching forums for several days, I've found two potential approaches:

1.Using sox:
Code: [Select]
sox -S 192khz_32bit_Float.wv -b 16 out.flac rate -v -L 44100 dither

2.Using  ffmpeg:
Code: [Select]
aresample=44100:resampler=soxr:precision=33:osf=s16:dither_method=shibata

Which method would produce the best results with minimal artifacts when both resampling and reducing bit depth? also I have seen many conflicting opinions like some suggests always using noise shaping while others say never to use it which makes deciding quite hard. also sox doesn't support 32 bit float internally.

Re: Need some advice on resampling 192Khz/32bit float.

Reply #1
The SoX line looks fine.  I think -v is overkill because -h already calculates values beyond flat 16bit dither 125dB down. You also may add -a behind dither to prevent unnecessary dither on silence.
I am not familar what ffmpeg spits out exacty.
Is troll-adiposity coming from feederism?
With 24bit music you can listen to silence much louder!

Re: Need some advice on resampling 192Khz/32bit float.

Reply #2
The SoX line looks fine.  I think -v is overkill because -h already calculates values beyond flat 16bit dither 125dB down. You also may add -a behind dither to prevent unnecessary dither on silence.
I am not familar what ffmpeg spits out exacty.
Thank you, should I worry about sox not supporting 32 bit float internally?

Re: Need some advice on resampling 192Khz/32bit float.

Reply #3
Sure. When i see clipping i reduce gain before resampling. SoX does 32bit integer. A completely automatic solution may be suggested by others, sorry.
Is troll-adiposity coming from feederism?
With 24bit music you can listen to silence much louder!

Re: Need some advice on resampling 192Khz/32bit float.

Reply #4
Sure. When i see clipping i reduce gain before resampling. SoX does 32bit integer. A completely automatic solution may be suggested by others, sorry.

I appreciate your help, Thank you for replying!

Re: Need some advice on resampling 192Khz/32bit float.

Reply #5
Just to ease your mind, I've NEVER heard any difference with re-sampling as long as I stayed above "CD quality"'.   (I don't claim to have golden ears.)

If the floating point goes over 0dB, of course you need to lower the volume (or normalize) before conversion.

The "rule" is dither when down-sampling the bit depth.    But, it's not a big deal because you can't normally hear dither or the lack of dither) at 16-bits anyway.  (You CAN hear quantization noise at 8-bits and dither noise is supposed to sound better.    I've heard 8-bit quantization but I've never tried dither...  I don't care about 8-bit audio.)

Quote
You also may add -a behind dither to prevent unnecessary dither on silence.
I didn't know about that...    That's a cool feature!   It's best not to add dither noise to digital silence.

Re: Need some advice on resampling 192Khz/32bit float.

Reply #6
Just to ease your mind, I've NEVER heard any difference with re-sampling as long as I stayed above "CD quality"'.   (I don't claim to have golden ears.)

If the floating point goes over 0dB, of course you need to lower the volume (or normalize) before conversion.

The "rule" is dither when down-sampling the bit depth.    But, it's not a big deal because you can't normally hear dither or the lack of dither) at 16-bits anyway.  (You CAN hear quantization noise at 8-bits and dither noise is supposed to sound better.    I've heard 8-bit quantization but I've never tried dither...  I don't care about 8-bit audio.)

Quote
You also may add -a behind dither to prevent unnecessary dither on silence.
I didn't know about that...    That's a cool feature!   It's best not to add dither noise to digital silence.
Thanks! Any opinion on noise shaping?

Re: Need some advice on resampling 192Khz/32bit float.

Reply #7
If you will convert each track individually and will lower volume to prevent clipping individually for each track, this can change volume difference between tracks in album.

If source tracks in album have seamless transition between them which is not silence and you are converting each track individually, resampling can cause audible click on this transition.

Re: Need some advice on resampling 192Khz/32bit float.

Reply #8
Yes, in that case you would need to concat all files, resamples and split back again.

Re: Need some advice on resampling 192Khz/32bit float.

Reply #9
If you will convert each track individually and will lower volume to prevent clipping individually for each track, this can change volume difference between tracks in album.

If source tracks in album have seamless transition between them which is not silence and you are converting each track individually, resampling can cause audible click on this transition.
Yes, in that case you would need to concat all files, resamples and split back again.
I will make sure concatenate and create a cue file if I have to resample seprated files, Thanks!

Re: Need some advice on resampling 192Khz/32bit float.

Reply #10
...and if you source  files have unwhole quantity of frames (cue counts time in frames - 75 frames per second, so for 192 kHz, 1 whole rame contains 2560 samples) then merging them to image+cue will change duration of tracks slightly. Problems are everywhere :D Some software can even pad unwhole frames with silence, making situation much worse than possible clicks from resampling.

To avoid possible clicks between tracks, while keeping exact duration of tracks, you can use for conversion foobar2000 audio player converter with SoX resampler component and option "Don't reset DSP between tracks".

Re: Need some advice on resampling 192Khz/32bit float.

Reply #11
To avoid possible clicks between tracks, while keeping exact duration of tracks, you can use for conversion foobar2000 audio player converter with SoX resampler component and option "Don't reset DSP between tracks".
Sadly due to the massive size of the files (compared to my bandwidth) I use Google Colab as intermediate to process my files before downloading them so I can't use foobar, maybe I should keep them whole without splitting them (flac +cue)

Edit: sorry my bad I will just split the flac files after downloading, I need some sleep.

Re: Need some advice on resampling 192Khz/32bit float.

Reply #12

[Thanks! Any opinion on noise shaping?
Some years back i played around with noise shaping and found the shibata shapes indeed sounding very pleasant to my ears when amplified. There must be some samples in the upload section.
I checked many years on many recordings if it is worth to apply but all the music i seem to listen never needs full 16 bits leave alone needing it noise shaped.
For the sake of doing at least something to lower the possibility of perceived noise i now use the sloped dither inside SoX with dither -S -a.
Is troll-adiposity coming from feederism?
With 24bit music you can listen to silence much louder!

Re: Need some advice on resampling 192Khz/32bit float.

Reply #13

[Thanks! Any opinion on noise shaping?
Some years back i played around with noise shaping and found the shibata shapes indeed sounding very pleasant to my ears when amplified. There must be some samples in the upload section.
I checked many years on many recordings if it is worth to apply but all the music i seem to listen never needs full 16 bits leave alone needing it noise shaped.
For the sake of doing at least something to lower the possibility of perceived noise i now use the sloped dither inside SoX with dither -S -a.
I think I have enough information now to start redoing my collection, thank you!

Re: Need some advice on resampling 192Khz/32bit float.

Reply #14
If source tracks in album have seamless transition between them which is not silence and you are converting each track individually, resampling can cause audible click on this transition.
Forgot to mention when using high (-h) instead of -v these audible clicks between tracks are clearly mitigated.
Is troll-adiposity coming from feederism?
With 24bit music you can listen to silence much louder!

Re: Need some advice on resampling 192Khz/32bit float.

Reply #15
Maybe to some degree, but there could be still small distortions in high end on track join.

Re: Need some advice on resampling 192Khz/32bit float.

Reply #16
The OP seems to only want command line solutions, but I'll mention anyway that several resampler DSPs for foobar2000, including SoX Resampler, will extrapolate the signal at track transitions which pretty much fully eliminates all glitching. Faster option than the "Do not reset DSP" option mentioned by Bogozo.
Also Advanced Limiter DSP will eliminate any potential clipping in a smart way without messing up loudness.

Re: Need some advice on resampling 192Khz/32bit float.

Reply #17
The OP seems to only want command line solutions, but I'll mention anyway that several resampler DSPs for foobar2000, including SoX Resampler, will extrapolate the signal at track transitions which pretty much fully eliminates all glitching. Faster option than the "Do not reset DSP" option mentioned by Bogozo.
Also Advanced Limiter DSP will eliminate any potential clipping in a smart way without messing up loudness.
After some thinking and testing, I found that I like a CD release instead of a Vinyl one (more clear, no clicks nor noise and save me a headache of resampling) as long as they have the same mastering as for those which exist in Vinyl only I will download them locally and follow your advice. Also thank you for updating the Sox component for 64bit Foobar2000, I'm currently using it.  

Re: Need some advice on resampling 192Khz/32bit float.

Reply #18
Also Advanced Limiter DSP will eliminate any potential clipping in a smart way without messing up loudness.
Sorry for hijacking - what if we used RG-DSP->Resampler in our chain, would you recommend Advanced Limiter after every stage or just after the resampler? I just don't see clearly here. And another one: Do we have a risk of tracks starting with a non zero crossing and would advanced limiter fix that?

Re: Need some advice on resampling 192Khz/32bit float.

Reply #19
You should only have once instance of a limiter and only at the very end. Normally as the last step but if you do dithering, dither should be the last.

Advanced Limiter will not touch the signal unless it would clip. Zero-crossing or non-zero crossing will go through as-is, unless it's so loud that it would clip. SRC, SoX and RetroArch resampler components should handle non-zero crossing track boundaries nicely. They extrapolate the existing signals, do the resampling, and then cut away the extrapolated bits which should produce virtually perfect transitions.

Re: Need some advice on resampling 192Khz/32bit float.

Reply #20
You should only have once instance of a limiter and only at the very end. Normally as the last step but if you do dithering, dither should be the last.

Advanced Limiter will not touch the signal unless it would clip. Zero-crossing or non-zero crossing will go through as-is, unless it's so loud that it would clip. SRC, SoX and RetroArch resampler components should handle non-zero crossing track boundaries nicely. They extrapolate the existing signals, do the resampling, and then cut away the extrapolated bits which should produce virtually perfect transitions.

This is nonsense. resampling single sample takes samples before and after, and at track boundary there are not such samples, so it uses silence instead probably. This still can be heard if not processed with keeping state between tracks.

Re: Need some advice on resampling 192Khz/32bit float.

Reply #21
The extrapolation feature is special bonus added to foobar2000 components. It's not bullshit. I tested it in the early 2018 with good results and it was implemented in SoX component soon afterwards.

Re: Need some advice on resampling 192Khz/32bit float.

Reply #22
If this is closed source 'feature'. I have 0 trust.


Re: Need some advice on resampling 192Khz/32bit float.

Reply #24
The extrapolation feature is special bonus added to foobar2000 components. It's not bullshit. I tested it in the early 2018 with good results and it was implemented in SoX component soon afterwards.
Thank you. I was noticing clicks right at the beginning of resampled files (SoX). First I thought there may be an issue in the foo_dsd component, but now this sample is a conversion from a 192k flac file. Guys please have a look, can we agree the first few samples are problematic? I am not 100% sure. In a spectogram I see high energy at its start. Double clicking on the file in fb2k gives a tiny click. When I have some time I will check source and target. Here's the converted file, 2 seconds: https://drive.google.com/file/d/1EW-yeBYOC-jkdYwvOHsXwIKEyCZOOhcq/view?usp=sharing