View Full Version : hybridgain or -athlower 10, -G max; no risk of clipping
nuked
4th August 2003, 03:25
The issue(skip to question if your familiar with it):
I got to thinking about teh phsycoacoustic stuff used in lame, specifically the lower threshold known as ATH, and I asked myself, well what is is this threshold relative to? Then I saw the -athlower option which allows you to change it and from what the manual says... you may want to lower it for quite sound tracks. Hence it would seem to be relative to nothing but simply an absolute threshold with some assumption that the track is set to some reasonable gain and that your stereo is set to a level that won't tear your ear-drums presumably.
I'd had previously wondered if it's better to use post gain or pre-gain when encoding and put together that hey... this threshold is one reason it would matter. Post gain will of course cause a lower threshold cuttoff and then an increase in volume, making the cuttoff now too high. So I searched and found a post by DSPGuru in some thread saying use hybrid gain which adds 10db pre-gain and the rest in post gain to solve this.
The questions:
1) What is the intended recording level for use with the default cuttoff curve. Is it max gain, -31db rms,...? What is the assumption about the volume it will be played back at on the stereo.. 100db max, 130db max?
2) is the result of hybridgain any diferent than just using -athlower 10 and then post-gain? Isn't this a safer trick with no risk of clipping?
nuked
4th August 2003, 17:40
unfortunately -G max seems to automatically do hybrid gain anyway. I can't do auto post-gain without azid adding 10db of gain first. What's with that? This seems kinda like a bug to me. Even -g 0 in azid (not ota) doesn't seem to prevent this behaviour. I found an old thread complaining of this same problem awhile ago. DSPguru said try the latest beta version. It seems 1.5b19 still has the problem. Is there some switch I'm missing?
DSPguru
4th August 2003, 19:23
Originally posted by nuked
Is there some switch I'm missing? -ota( -G 1 ) ;)
ps,
why don't you use BeSweetGUI ?
nuked
4th August 2003, 19:56
Yay.. he's not really gone :).
that's perfect, thanks. My apologies.. I was using Besweet-Gui but not the latest version...duh
any thoughts on adjusting ATH instead of pre-gain in hybrid mode? probably doesn't matter often, but in some rare cases where less than 10db is needed it would save someone a small headache. Plus you could use a slightly better guess... like 14db and get even closer with still no risk of clipping..
nuked
5th August 2003, 23:03
okay I just found a DVD where the AC3 after downmixing to stereo with -3db LFE included could only take 6db of post gain (no pre-gain). This would have been severely clipped with hybrid gain. I used my
-lame(-athlower 10) -ota(G 1)
settings when I transcoded it.
it encoded fine, fast(no pre-gain pass), got the correct gain, didn't clip, and will lack no quality at all due threshold cuttoffs. The only problem is the ath floor is now a little lower than it could be so I could probably redistribute a few bits if I really wanted to encode again by setting -athlower 6... but since I'm not a compulsive type and it won't drive me to insantiy in later years wondering what if I'd done it better, then I am not forced to re-transcode it as I would be if I had used hybrid gain. This is the second time I've seen an example like this recently.
DSPguru
5th August 2003, 23:17
don't forget that on hybridgain, i also enable the dialoge normalization.
please post the two logfiles (1=pregain max. 2=hybridgain), so i could see the problems you met.
nuked
6th August 2003, 00:01
good, point... I thought I was still using dialog normalization but I was not, my mistake again(not surprisingly). I haven't done the actual hybrid gain encode yet... was just calculating that it should clip... but with the wrong asumption now obviously. Still seems less garaunteed though if you have a track with a big dynamic range; 21 db (-31 +21 +10(pregain) =clipping right?) above dialog level for an effect doesn't seem like something that would never happen, as for this particular example, I'll definitely give it another shot and then post logs if I can produce an actual example of a problem. I guess one thing I like about my trick is I can err on the side of an ATH floor which is likely to be too low if I want, where as hybrid gain will always effectively err slightly towards too high... I'd rather have sub-par bit distribution than threshold artifacts, but then I use pretty high bit-rates for sound if I bother to compress at all. I'm not saying hybridgain is bad... just wondering if this would be more or less equivilant and maybe slightly more robust.
nuked
6th August 2003, 00:32
Ok, turned out with -c normal and with the dialogue normalization I was ok but only BARELY. Here's results with not unreasonable settings using no dynamic range compression. This time there is a big problem.
I did not let the encodes finish, but it's clear I didn't need to in order to see the problem.
The fist log shows that the pre-gain method gives a gain of 4.6db.
The second log shows that dialog normalization is -4 db making a total needed gain of 8.6db in hybrid mode. Of course this is surpassed right from the start with a pregain of 10.
BeSweet v1.5b19 by DSPguru.
--------------------------
Using azid.dll v1.8 (b825) by Midas (midas@egon.gyaloglo.hu).
Using lame_enc.dll v1.28 (4/6/2002), Engine 3.92 <http://www.mp3dev.org/>.
Logging start : 08/05/03 , 20:07:48.
C:\Program Files\GordianKnot\BeSweet.exe -core( -input d:\ripped\THE_RECRUIT Track 1 English DELAY 0ms.ac3 -output d:\ripped\test2.mp3 -logfilea C:\Documents and Settings\All Users\Start Menu\Programs\Media Editing\BeSweetGui\BeSweet.log ) -azid( -s stereo -L -3db ) -ota( -g max ) -lame( --scale 1 -q 5 --abr 192 )
[00:00:00:000] +------- BeSweet -----
[00:00:00:000] | Input : d:\ripped\THE_RECRUIT Track 1 English DELAY 0ms.ac3
[00:00:00:000] | Output: d:\ripped\test2.mp3
[00:00:00:000] | Floating-Point Process: Yes
[00:00:00:000] | Overall Track Gain: 4.602dB
[00:00:00:000] +-------- AZID -------
[00:00:00:000] | Input Channels Mode: 3/2, Bitrate: 448kbps
[00:00:00:000] | Output Stereo mode: Stereo
[00:00:00:000] | Total Gain: 0.000dB, Compression: None
[00:00:00:000] | LFE levels: To LR -3.0dB, To LFE 0.0dB
[00:00:00:000] | Center mix level: BSI
[00:00:00:000] | Surround mix level: BSI
[00:00:00:000] | Dialog normalization: No
[00:00:00:000] | Rear channels filtering: No
[00:00:00:000] | Source Sample-Rate: 48.0KHz
[00:00:00:000] +-------- LAME -------
[00:00:00:000] | Bitrate method : ABR
[00:00:00:000] | Avarege Bitrate : 192
[00:00:00:000] | MP3 Min bitrate : 128
[00:00:00:000] | MP3 Max bitrate : 320
[00:00:00:000] | Channels Mode : Joint Stereo
[00:00:00:000] | Error Protection: No
[00:00:00:000] +---------------------
BeSweet v1.5b19 by DSPguru.
--------------------------
Using azid.dll v1.8 (b825) by Midas (midas@egon.gyaloglo.hu).
Using lame_enc.dll v1.28 (4/6/2002), Engine 3.92 <http://www.mp3dev.org/>.
Logging start : 08/05/03 , 20:14:22.
C:\Program Files\GordianKnot\BeSweet.exe -core( -input d:\ripped\THE_RECRUIT Track 1 English DELAY 0ms.ac3 -output d:\ripped\test2.mp3 -logfilea C:\Documents and Settings\All Users\Start Menu\Programs\Media Editing\BeSweetGui\BeSweet.log ) -azid( -s stereo -L -3db ) -ota( -hybridgain ) -lame( --scale 1 -q 5 --abr 192 )
[00:00:00:000] +------- BeSweet -----
[00:00:00:000] | Input : d:\ripped\THE_RECRUIT Track 1 English DELAY 0ms.ac3
[00:00:00:000] | Output: d:\ripped\test2.mp3
[00:00:00:000] | Floating-Point Process: Yes
[00:00:00:000] | PostGain normalize to : 0.97
[00:00:00:000] +-------- AZID -------
[00:00:00:000] | Input Channels Mode: 3/2, Bitrate: 448kbps
[00:00:00:000] | Output Stereo mode: Stereo
[00:00:00:000] | Total Gain: 10.000dB, Compression: None
[00:00:00:000] | LFE levels: To LR -3.0dB, To LFE 0.0dB
[00:00:00:000] | Center mix level: BSI
[00:00:00:000] | Surround mix level: BSI
[00:00:00:000] | Dialog normalization: -4dB
[00:00:00:000] | Rear channels filtering: No
[00:00:00:000] | Source Sample-Rate: 48.0KHz
[00:00:00:000] +-------- LAME -------
[00:00:00:000] | Bitrate method : ABR
[00:00:00:000] | Avarege Bitrate : 192
[00:00:00:000] | MP3 Min bitrate : 128
[00:00:00:000] | MP3 Max bitrate : 320
[00:00:00:000] | Channels Mode : Joint Stereo
[00:00:00:000] | Error Protection: No
[00:00:00:000] +---------------------
DSPguru
8th August 2003, 18:49
Originally posted by nuked
Ok, turned out with -c normal and with the dialogue normalization I was ok but only BARELY. Here's results with not unreasonable settings using no dynamic range compression.in one of the older v1.5 betas (can't recall which), the hybridgain's pregain value also took the drc status in care, i.e., the lighter the compression is - the lower the pregain value will be. i can't recall why i had removed it (it was about the same time midas was "back" and we discussed azid v1.9). anyway, i guess i'll re-enable it in the next build . (the code still exists. i just need to enable it).
ps,
cheers for your tests and devotion.
i hope you find my hybridgain approach correct.. :o
--> keep in mind that this unique approach of one-pass normalization applies transperently to vorbis & mp2, due to BeSweet's inner structure.
--ath-lower isn't applicable for those, and it doesn't seem to achieve better results.
nuked
8th August 2003, 21:21
I would not have even thought of my trick if I hadn't seen yours and thought about why it matters.
yah.. some correction for drc makes sense. Still kinda requires some assumptions, like it could break on badly normalized homeade ac3s but then I guess you can't cover everything at once. Maybe a warning in the log file if no post gain gets applied would be useful. Since I'm sticking with mp3 and high bit rates (where I'd rather err towards a low threshold), I'll probably stick with my trick just for the comfort of knowing it's impossible for it to clip one day when I'm not looking(even if highly unlikely with the drc corrections you suggest), but I hear what you're saying about hybridgain working better with more formats. Hard to make one fix to do everything all the time, your hybridgain comes pretty close. Of course it is to besweets credit that I can do it my way if I want to.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.