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: Batch converting WavPack DSD to FLAC (Read 2528 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Batch converting WavPack DSD to FLAC

I want to convert my SACD collection that's in WV DSD to 16-bit 44.1 kHz FLAC for DAP use. I want the volume to be normalized by album basis.

Fastest way I've found is to use ffmpeg. Tags from WV is transfered to FLAC this way. First convert all files in folder with 0dB gain. Using sox resampler here (-precision 28 enables sox 'Very High Quality’. Linear phase is default.)

Code: [Select]
for i in *.wv; do ffmpeg -i "$i" -af "volume=0dB" -sample_fmt s16 -ar 44100 -resampler soxr -dither_method triangular -precision 28 -y "${i%.*}.flac"; done

Then use sox to find the Pk lev dB from converted files.

Code: [Select]
sox -S *.flac -n stats

             Overall     Left      Right
DC offset   0.000309 -0.000007  0.000309
Min level  -0.598694 -0.598694 -0.553558
Max level   0.591400  0.591400  0.551514
Pk lev dB      -4.46     -4.46     -5.14
RMS lev dB    -24.12    -23.94    -24.30
RMS Pk dB     -15.46    -15.46    -15.81
RMS Tr dB     -96.68    -96.68    -96.65
Crest factor       -      9.42      9.08
Flat factor     0.00      0.00      0.00
Pk count           2         2         2
Bit-depth      16/16     16/16     16/16
Num samples    92.5M
Length s    2097.573
Scale max   1.000000
Window s       0.050
Done.

Then reconvert all the files with clipping free gain.

Code: [Select]
for i in *.wv; do ffmpeg -i "$i" -af "volume=4.2dB" -sample_fmt s16 -ar 44100 -resampler soxr -dither_method triangular -precision 28 -y "${i%.*}.flac"; done

I still would like to find a more automated way of doing this.


Re: Batch converting WavPack DSD to FLAC

Reply #2
Probably my thoughts will not be helpful, because you want to transfer tags automatically but...

You can normalize in one step without need to an analyze first. Don't convert bitdepth with ffmpeg. Use pipe from ffmpeg to sox with high bitdepth and then convert bit depth, dither and normalize (with option --norm=0) in sox. Sox can do this automatically in one step, you just need enough free space for its temporary file.

When converting tracks one by one, conversion is not true gapless and there can sometimes be audible clicks between tracks.

I created .bat file that uses ffmpeg, sox, mkvmerge, find and replace and BOMremover (find and replace is needed for the case when there is apostrophe in file name and BOMremover is neded to fix txt file after find and replace) to do automatically true gapless conversion with normalization on album basis. It results in mka file with chapters and then i use foobar2000 to tag and convert resulted mka file to separated FLAC files. I know no command-line tool that can sample-accurately split mka..

Re: Batch converting WavPack DSD to FLAC

Reply #3
For DAP use, consider lossy - even MP3 decoding must be expected to drain the battery more than FLAC decoding does.

AFAIUnderstand, clipping is a potential issue from DSD; SACD is regularly mastered "hotter" than CD, and apparently DSD can go much higher if not on SACD.
And, ffmpeg does not guard against clipping - at least, if you try to convert a floating-point source that exceeds 0 dBFS to an integer format, it is just going to clip it off without warning you.
Since MP3 is floating-point, it avoids that. If you use foobar2000 for Win(e)dows to convert to MP3, either with RG transfers if the DSDs have RG tags, or with the scan-as-albums post-conversion option, then you can as a second step apply album gain to the files (without re-encoding).

 

Re: Batch converting WavPack DSD to FLAC

Reply #4
AFAIUnderstand, clipping is a potential issue from DSD; SACD is regularly mastered "hotter" than CD, and apparently DSD can go much higher if not on SACD.
DSD decoded to PCM with proper high-frequency noise filtering usually needs at least +6 dB. As you can see, topicstarter is resampling to 44100, so high-frequency noise will not be problem at all. There are some broken SACDs like Michael Jackson - Thriller, yes, but these are pathological cases.