• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!
OP
Saidera

Saidera

Senior Member
Joined
Jul 18, 2020
Messages
388
Likes
309
Location
Adelaide, South Australia, Australia
Ok... For a start I would not believe ANYTHING on computeraudiophile.com.

DSD will not, cannot, improve the sound quality.

'ANYTHING' except threads with mansr's posts from a long time ago, I might suggest?
 

djh1697

New Member
Joined
Jan 2, 2022
Messages
2
Likes
2
I have found that my ears can appreciate is DSD256 over PCM less than 48/24.
 

Cbdb2

Major Contributor
Joined
Sep 8, 2019
Messages
1,553
Likes
1,534
Location
Vancouver
Proof? New here, please read the following, it applies to you.

 

hyperknot

Active Member
Joined
Aug 17, 2019
Messages
260
Likes
166
I converted my whole DSD collection to PCM with SoX DSD. I used rate -ub74 88200 gain 6 sinc -25k.

Full command for reference: soxdsd -V3 sample.dsf --bits 24 sample.flac rate -ub74 88200 gain 6 sinc -25k

I'm not saying these are the "best" settings, but for me personally these made the most sense. Also in RMAA these generated very high quality results.

I made a Python script which batch-converts and find the best gain (+6, +5, +4, etc.) for each directory.
 

MRC01

Major Contributor
Joined
Feb 5, 2019
Messages
3,482
Likes
4,106
Location
Pacific Northwest
Here's my unsolicited code review :)

Looking at the script, I wonder if there is any text in the output of the 'soxdsd' command that gives the resulting peak amplitude. If so, instead of looking for the text 'decrease volume', you could use the peak value to compute a new gain value that will give a specific peak value, and set it to something like -1 dB to help prevent intersample overs. In this case, always start with a low gain value like -15 dB to avoid clipping. For example if it said the resulting peak value was -3.4 dB, you add 2.4 dB to the original value of -15 for a gain of -12.6 dB, knowing the resulting will have exactly -1.0 dB peak value. Then it would always convert to PCM having a specific peak amplitude (instead of any amplitude short of 0 dB), and always run exactly twice, never more.
 

hyperknot

Active Member
Joined
Aug 17, 2019
Messages
260
Likes
166
Here's my unsolicited code review :)

Looking at the script, I wonder if there is any text in the output of the 'soxdsd' command that gives the resulting peak amplitude. If so, instead of looking for the text 'decrease volume', you could use the peak value to compute a new gain value that will give a specific peak value, and set it to something like -1 dB to help prevent intersample overs. In this case, always start with a low gain value like -15 dB to avoid clipping. For example if it said the resulting peak value was -3.4 dB, you add 2.4 dB to the original value of -15 for a gain of -12.6 dB, knowing the resulting will have exactly -1.0 dB peak value. Then it would always convert to PCM having a specific peak amplitude (instead of any amplitude short of 0 dB), and always run exactly twice, never more.
It tells how many samples there are but not the peak. There must be a way to find the peak though, but this script is not about performance. For example when it finds a peak at track 5 it'll always re-transcode 1,2,3,4 even thought they are not problematic.

Considering how rare DSD albums are, the script was perfect for me and it converted my whole collection within a few hours.
 

dadregga

Active Member
Joined
May 27, 2021
Messages
154
Likes
340
There is if you stick a "stats" at the end of the effects chain.

Thanks for that (and thanks for @hyperknot for the script!) - twiddled it a bit for my purposes and changed it so that it uses `stats` to scan every file once to calculate optimum gain, and then does the actual conversion with that gain.

Not terribly optimal (could just assume +6db and only do a second pass if that's a problem) but at least this way it will only ever do 2 passes per file.


Thus far, I've found a few albums where every track but one or two is Scarlet Book compliant in terms of levels, and those two are like +4/+5, which is weird.
 

mansr

Major Contributor
Joined
Oct 5, 2018
Messages
4,685
Likes
10,703
Location
Hampshire
Thanks for that (and thanks for @hyperknot for the script!) - twiddled it a bit for my purposes and changed it so that it uses `stats` to scan every file once to calculate optimum gain, and then does the actual conversion with that gain.
You can do that automatically by adding "gain -n" as the last effect.
 

pLudio

Member
Forum Donor
Joined
Dec 8, 2020
Messages
95
Likes
86
Location
Sweden
Interesting, I'll have to try that, it's not documented in the SoX man page as far as I can see.
Code:
gain [-e|-B|-b|-r] [-n] [-l|-h] [gain-dB]

The -n option normalises the audio to 0dB FSD; it is often used in conjunction with a negative gain-dB to the effect that the audio is normalised to a given level below 0dB.  For example,
                 sox infile outfile gain -n
normalises to 0dB, and
                 sox infile outfile gain -n -3
normalises to -3dB.

But don't you want an album gain per folder instead of single track gain?
 
Last edited:

mkt

Senior Member
Joined
Jan 6, 2020
Messages
338
Likes
465
I do iso -> dff -> flac (single file) to figure out the album gain, though I just realized I don't check that multidisc albums have the same gain. (My least favorite conversion process :mad:)
 

dadregga

Active Member
Joined
May 27, 2021
Messages
154
Likes
340
Code:
gain [-e|-B|-b|-r] [-n] [-l|-h] [gain-dB]

The -n option normalises the audio to 0dB FSD; it is often used in conjunction with a negative gain-dB to the effect that the audio is normalised to a given level below 0dB.  For example,
                 sox infile outfile gain -n
normalises to 0dB, and
                 sox infile outfile gain -n -3
normalises to -3dB.

But don't you want an album gain per folder instead of single track gain?

I'll look at that - but I want to maintain the level of the output PCM relative to the level of the source file, not relative to 0db.

AFAIK you should be able to add +6b to the level of the output PCM and get that IF the source DSD was mastered according to Scarlet Book spec."Relative to 0db" should == "applying 6db boost during PCM conversion".

If it was not mastered to spec such that a +6db boost gets you a PCM leveled relative to 0db, however, then I'd want to preserve the (relative) difference.

You would think that if one track in the album was normalized to Scarlet Book spec (such that we can apply the normal +6db gain on PCM conversion), all the tracks in the album would be.

But the first SACD album I ran this on had some tracks that were mastered to spec, and at least one that was not (according to SoX), which would have clipped during conversion if I assumed it also was mastered to spec like the rest of the tracks in the album, and applied +6db without checking.

So that's why it's per-file - an excess of paranoia and at least one example where apparently not all tracks within the album were mastered to the DSD reference level.

My (imperfect) understanding is that the way DSD and PCM handle clipping is fundamentally different, and the "penalty" for it is much more severe with PCM.
 
Last edited:

danadam

Addicted to Fun and Learning
Joined
Jan 20, 2017
Messages
992
Likes
1,538
I'll look at that - but I want to maintain the level of the output PCM relative to the level of the source file, not relative to 0db.
"gain" without additional switches does that.
You would think that if one track in the album was normalized to Scarlet Book spec (such that we can apply the normal +6db gain on PCM conversion), all the tracks in the album would be.
Why would you think that? One track could be quieter than other track, because that was an artistic intention, and only by chance it would get more than 6 dB headroom.

You should analyze the whole album first, to decide if it is safe to apply +6dB boost and only then do the conversion of all tracks with or without the boost.

Or you could not worry about it that much, do the conversion without the boost, analyze the resulting files and apply the boost to those files if necessary. They are 24 bits, so plenty of room for manipulations, why not use that?
 

Destroid

Member
Joined
Mar 31, 2022
Messages
13
Likes
18
If your player support ReplayGain, then converting with zero gain may be best.
Using the script to scan and add album ReplayGain metadata would be quicker than with an app manually.
 

dadregga

Active Member
Joined
May 27, 2021
Messages
154
Likes
340
"gain" without additional switches does that.

Why would you think that? One track could be quieter than other track, because that was an artistic intention, and only by chance it would get more than 6 dB headroom.
DSD, as per the spec, as I understand it, mandates 6db of headroom at a minimum, regardless of content dynamic range.

Some DSD content is incorrectly mastered and violates this spec - but DSD, by the spec, should always tolerate a 6db boost in conversion to PCM regardless of content dynamic range - it's different than PCM in this regard.

You should analyze the whole album first, to decide if it is safe to apply +6dB boost and only then do the conversion of all tracks with or without the boost.

Actually, the best thing to do would be to scan all the files in the album and pick the lowest boost that could safely be applied to all resulting PCM files, I guess.

Which still wouldn't be exactly quite the same thing as how levels and peaks are handled in the source files - but would be close enough. This is one of the spots where PDM and PCM are just fundamentally different and the concepts do not really translate 1:1.
 
Last edited:

danadam

Addicted to Fun and Learning
Joined
Jan 20, 2017
Messages
992
Likes
1,538
Some DSD content is incorrectly mastered and violates this spec
Yes, and if we know that such content may exist, then there is no reason to expect, that if one track on an album is mastered to the spec then all tracks will be mastered to the spec.
 
Top Bottom