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: Clipping detection based on RG values? (Read 3258 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Clipping detection based on RG values?

I wanted to indicate in foobar, if track with "RG track gain" applied to it would clip:

Code: [Select]
$ifgreater(
$add(
$muldiv($num($left($replace(%replaygain_track_peak%,.,),5),),89,100),
$num($replace(%replaygain_track_gain%,.,),)),
8899,Yes,No)

which basically means PEAK * 89 + GAIN (and multiplied by 100), but the result is incorrect: it doesn't shows correctly if the track is clipping

What's wrong here?

Clipping detection based on RG values?

Reply #1
Assuming clipping prevention and limiting etc are disabled, then for a given replaygain_track_gain and preamp_setting (fb2k preferences), the track will be scaled by

scale = 10^((replaygain_track_gain+preamp_setting)/20)


new_peak = replaygain_track_peak*scale


Does this help?

Cheers,
David.

Clipping detection based on RG values?

Reply #2
Yes, it helped. It cleared two things:

1. how to calculate clipping based on RG (I searched HA a lot and didn't find this)
2. it can't be made with foobar TF, as it doesn't support such math

thanks

Clipping detection based on RG values?

Reply #3
With reasonable accuracy David's clipping eq. can be approximated with simple 2-nd order polynomial over custom range:

10^(x/20) ~ 0.01*x^2 + 0.12*x +1

[a href="http://img682.imageshack.us/img682/9071/89234612.png" target="_blank"]