A while back Mans Rullgard added support to SoX for DSD resampling. It applies the SoX resampling to 1bit DSD directly. https://github.com/mansr/sox

A cursory glance at that computeraudiophile thread shows that someone found this link from which the file sox-dsd-win32-MSVC.zip can be downloaded. I downloaded a DSD64 (which I believe is the kind of encoding SACD's use; correct me if I am mistaken) file from here and managed to convert it to FLAC with the included SoX.exe executable included in the ZIP file (extract all of the compressed file first).

I used the following batch file in Windows 10 with the executable in question:

Re: SACD to FLAC

I had to include the "-D" parameter to stop SoX from dithering; I'm not sure why it was automatically doing this. Maybe it's better? I'm not too sure.

SoX does dither when going to 16bit because it is common practise and not because it is bad. If you ask mathematical skilled people they even recommend 24bit to be dithered when coming from the 32bit integer SoX routines.

Is troll-adiposity coming from feederism?With 24bit music you can listen to silence much louder!

Re: SACD to FLAC

I had to include the "-D" parameter to stop SoX from dithering; I'm not sure why it was automatically doing this. Maybe it's better? I'm not too sure.

SoX does dither when going to 16bit because it is common practise and not because it is bad. If you ask mathematical skilled people they even recommend 24bit to be dithered when coming from the 32bit integer SoX routines.

Yes -- that's when going from 32-bit PCM to 24-bit PCM. But this is PDM to PCM; is dither still justified here? I'm admittedly not familiar with the ins and outs of PDM so maybe SoX's default behavior is acceptable.

EDIT: I think I see what you mean; so because SoX uses a 32-bit internal routine (regardless of the *actual* source being PDM, it uses 32-bit PCM internally), and you request 16-bit, this is why it dithers?

Re: SACD to FLAC

Thank you both...I have been playing around with that "other" file but wasn't sure if it was "official" or trusted. Was literally just about to write how I got it working.

Thanks for the responses.

After playing a bit, a couple more questions of advice. When doing what I'll call a standard convert:sox 01.dsf -b 16 01.wav rate -v -s 44100

I get output files that when looked at in Audacity the peaks never go above or below 0.5 (see attached "normal").I've read that PDM to PCM converting always loses volume and therefore it could be added back in.Do you think it's worth trying to boost them a little bit - in theory could anything be gained other than having to turn the volume knob a little less?

I tried using both gain and volume adjustments but any positive number yields clipping. When looking at the output files in audacity...the gained and clipped files look identical to the not gained ones and doesn't show any clipping. When looking at the command prompt side of (attached "gain6") it looks like the input file was gained...not the output. I guess I'm wondering how to gain the output file.sox 01.dsf -b 16 01.wav gain 6 rate -v -s 44100or sox 01.dsf -b 16 01.wav vol 6dB -v -s 44100

The only thing I could do that wouldn't clip was use --normsox --norm=-1 01.dsf -b 16 01.wav vol 1dB -v -s 44100

Re: SACD to FLAC

Last question: Is there a way to get sox to create a log file so I can check for errors later in case I accidentally hit a key and close the batch script...for example when waking the computer from a screen saver if I walk away after a big batch.

I tried adding > log.txt but that yielded and empty text file and I couldn't find any options in the Sox command line help section.

Re: SACD to FLAC

Last question: Is there a way to get sox to create a log file so I can check for errors later in case I accidentally hit a key and close the batch script...for example when waking the computer from a screen saver if I walk away after a big batch.

I tried adding > log.txt but that yielded and empty text file and I couldn't find any options in the Sox command line help section.

Try adding ">> output.txt", with two > symbols, at the end of the main loop of the script.

Re: SACD to FLAC

No dice but thanks for idea. I can't remember if command prompt has a mode to write everything to a text file. I know for Lame, FLAC and robocopy for example, the .exe file itself has a "logging" option.

I noticed that if you just run it silent, then errors are quite obvious - so I'll do that I guess.

Re: SACD to FLAC

No dice but thanks for idea. I can't remember if command prompt has a mode to write everything to a text file. I know for Lame, FLAC and robocopy for example, the .exe file itself has a "logging" option.

I noticed that if you just run it silent, then errors are quite obvious - so I'll do that I guess.

Hm, I just tried it and it doesn't seem to work. However, if you remove the "pause" at the end and have it write both standard output and standard error from the command prompt or PowerShell, you can have a log file.

Now log.txt will have all the output that was generated (but there's no console output in real time; this is why the "pause" part was removed, so when you get back the command prompt, you know it's finished).

Re: SACD to FLAC

You can also convert to WavPack and maintain the DSD format, and the WavPack libraries also support DSD -> PCM conversion by default in apps that don't request the DSD format on decode. Probably not what you were concerned about, though.