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: ReplayGain OFF, why are my files K-leveled ? (Read 3267 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

ReplayGain OFF, why are my files K-leveled ?

Hello, it's my turn to be on the newbie side, as I today used Replaygain for the first time on some MPC files.

I use

MPC Batch encoder 2.2.6
Replaygain 0.84
Winamp 2.91
In_mpc.dll 0.98
Nullsoft DiskWriter plugin 2.0c

There is one thing I don't understand : why is the K setting used when ReplayGain is off and clipping prevetion on ?
When I apply clipping prevention, I'm not interested in gain adjustment, I'm just interested in leveling the whole album so as it doesn't clip.

Here are the replaygain results for my test album :

Quote
   Level Adjustment   |   Peak Level   (Adjst)|  Filename
----------------------+-----------------------+-------------------------------
+0.00 dB => -8.16 dB |     0 => 35641 (13929)| Arcana -- 2003 -- Inner Pale Sun -- 01 My cold sea.mpc
+0.00 dB => -7.65 dB |     0 => 34623 (14350)| Arcana -- 2003 -- Inner Pale Sun -- 02 Lovelorn.mpc
+0.00 dB => -6.86 dB |     0 => 35305 (16026)| Arcana -- 2003 -- Inner Pale Sun -- 03 Icons.mpc
+0.00 dB => -8.12 dB |     0 => 39797 (15626)| Arcana -- 2003 -- Inner Pale Sun -- 04 We rise above.mpc
+0.00 dB => -7.92 dB |     0 => 36065 (14490)| Arcana -- 2003 -- Inner Pale Sun -- 05 Innocent child.mpc
+0.00 dB => -7.90 dB |     0 => 35211 (14180)| Arcana -- 2003 -- Inner Pale Sun -- 06 Song of the dead sun.mpc
+0.00 dB => -8.43 dB |     0 => 35231 (13348)| Arcana -- 2003 -- Inner Pale Sun -- 07 Season of thought.mpc
+0.00 dB => -6.87 dB |     0 => 34089 (15456)| Arcana -- 2003 -- Inner Pale Sun -- 08 Closure.mpc
          => -7.86 dB |       => 39797 (16100)|


The default K value is 20
With gain OFF / clipping prevention OFF, the output file given by the discwriter is bitwise identical before and after replaygain, and Soundforge states that it is clipped, while the original wave is not. Both the original and the decoded MPCs have a peak level of 0.00 db.  So far I'm ok.

With gain OFF / clipping prevention ON, both album and track based, the decoded MPC for track 4 have a peak level of -4.31 db according to SoundForge's statistics, why ?
If I decrease the K value to 14, the peak level is raised to 0.00 db. That's what I want, but not like this, because a less dynamic recording with a higher average loudness might still be normalized below 0 db, even at K=14.

With gain ON album based, K=20, the peak level is -12.16 db, with gain ON title based, it is -12.42 db, with or without clipping prevention (obviously, they are not clipped !).

[span style='font-size:8pt;line-height:100%']Edit : replaced "more dynamic" with "less dynamic"[/span]

ReplayGain OFF, why are my files K-leveled ?

Reply #1
You probably want to set the K-value to maximum loudness (smallest number, like K-2) while employing clipping prevention. This will play the song/album at the maximum loudness without allowing clipping.

I think mppdec.exe's command-line help has/had an example of this. I remember one commandline that had something like "--scale 20 --prev" which made the song as long as possible without allowing it to clip.

I'm not really sure why the Winamp MPC plugin works this way, but then again, I don't really understand the K-value system either, so who am I to complain? Edit: I guess that, since you were looking for a "why" and not a "how", this information isn't very helpful. Sorry.

ReplayGain OFF, why are my files K-leveled ?

Reply #2
FWIW I don't know either.



However, IIRC Frank said something about different levels of accuracy in determining the peak sample. Least accurate is just using the peak of the input .wav. Most accurate is a perfect decode to, say, 24-bit accuracy. But, MAYBE, he's made most accurate equal to this plus oversampling.

Most DACs oversample. Many "nearly clipped" audio signals are actually clipped in the oversampled domain (the peaks, between sample points, go above digital full scale using sync interpolation).

If it's using this definition of clipped, then the maximum value of a 16-bit 44.1kHz decode with clipping attenuation enabled could be much less than digital full scale. But the oversampled version may well just peak at digital full scale, as required.


It sounds unlikely that this is what is happening, but I just thought I'd mention it. Maybe someone else has a definitive answer. Frank?

Cheers,
David.

ReplayGain OFF, why are my files K-leveled ?

Reply #3
Hi Pio,
I'll try and explain the way I understand.

The K-setting is used to "calibrate" the replaygain functions. Clipprotect is one of them. The default of 20 is not what most people want to use, it matches a replaygain level of 83 dB SPL, which Frank prefers. When you set it to 14 it corresponds with replaygain target 89, which is now commonly used in other replaygain implementations as well.
Note that with K-14 it is not always completely clip free, but the occasional remaining clipping is hardly problematic.

Clipprotect is not normalize, it only lowers the gain when the peak level would otherwise clip.

If normalisation is what you're after you could try Sometime Warriors's tip.
--
Ge Someone
In theory, there is no difference between theory and practice. In practice there is.

ReplayGain OFF, why are my files K-leveled ?

Reply #4
Thank you for your answers.

Quote
You probably want to set the K-value to maximum loudness (smallest number, like K-2) while employing clipping prevention. This will play the song/album at the maximum loudness without allowing clipping.


This would do it for this album, but for a CD with a peak level of 70 %, for example, it would boost it to 100% without reason.

Quote
If it's using this definition of clipped, then the maximum value of a 16-bit 44.1kHz decode with clipping attenuation enabled could be much less than digital full scale. But the oversampled version may well just peak at digital full scale, as required.

So -4.13 db would be the right clip protect value. Then why am I allowed to mess it up with the K setting, that reset the peak level to 0 when lowered ? The clipping would be no more prevented in this case. Furthermore, the peak level calculated was 39767, that is +1.69 db, not +4.13 db.

Quote
The K-setting is used to "calibrate" the replaygain functions. Clipprotect is one of them.

I understand that the K setting is used to calibrate the replaygain, and that the result is prone to clipping according to the reference chosen, but I don't see any sense in "calibrating" pure clipping prevention when replaygain is disabled. Why calculating the peak value in the first place if at the end we can arbitrarily choose the scalefactor ? And if the scalefactor comes after peak adjustment, what is the K value that leaves the level of non clipped files unchanged ?

Quote
If normalisation is what you're after you could try Sometime Warriors's tip.

Right, but I'm not looking for normalisation, I'm looking for something like a smart --scale preset, that would only scale when needed and no more than needed.


[span style='font-size:8pt;line-height:100%']Edit : replaced "that puts the peak to 0 db" with "that leaves the level of non clipped files unchanged"[/span]

ReplayGain OFF, why are my files K-leveled ?

Reply #5
Pio,

In your reply to me, you're right - it can't be what I said, for the reason you said. As I said, I didn't think it was the right answer anyway!


However, maybe this is the answer:

It's doing clip-protection by album, and you're just looking at the maximum peak in one track.

I know you said that you get the same results by-album and by-track clip protection. Maybe there's a bug or something.

Check the whole album and see if there's a louder peak on it somewhere that's causing what you report. If so, that kind of explains what's happening. If not, then it doesn't!


I'm not going to give explanations of replay gain, K-levels, or whatever because I'm sure you've either followed all this, or can find it out for yourself. This specific bug/feature hasn't been mentioned before - maybe no one else thought to look. Try emailing Frank.

Cheers,
David.