IPB

Welcome Guest ( Log In | Register )

Wavegain vs. MP3Gain, Why the former might be better...
Jebus
post Jun 21 2003, 21:34
Post #1





Group: Developer
Posts: 1289
Joined: 17-March 03
From: Calgary, AB
Member No.: 5541



Yes, I know that MP3Gain is lossless. No, I am not talking about how MP3Gain is limited to 1.5dB steps (though this is another reason).
What I am thinking is this:

Psychoacoustic models tend to encode louder signals with more bits, right? This is why remasters (compressed) tend to use higher bitrates than older versions. Correct?

If we are then encoding a VERY LOUD album with LAME -aps for instance, then normalizing it down say 10.5dB (for a really bad one), aren't we wasting bits? Wouldn't we be able to save some bits by normalizing it down to 89dB FIRST, then encoding it?

I know wavegain is NOT LOSSLESS, but I am (incorrectly) assuming that this is just a theoretical lossiness, not a perceptible one. If this is the case, couldn't we argue that wavegained tracks will be of lower bitrates while still maintaining transparency (the goal, afterall, of -aps)?


---------------------------------
| UPDATE (May 21st, 2005) |
---------------------------------

The discussion below basically concludes that running a wavegain analysis, then applying the recommended scalefactor to lame (via the --scale switch) will save bits due to high-frequency bloat inherent in the mp3 format. Lots of people have since chosen to use this method over mp3gain, and in fact it can be automated now from within EAC using Wack, or my own Omni Encoder. Read on!

This post has been edited by Jebus: Jul 18 2006, 14:05
Go to the top of the page
+Quote Post
 
Start new topic
Replies
DickD
post Jul 1 2003, 16:36
Post #2





Group: Members
Posts: 265
Joined: 12-January 03
Member No.: 4542



Thanks for the clarification about how the adaptive ATH works, Gabriel.

For most people, we'll either use the volume control to tame excessively loud tracks, or we'll use some form of ReplayGain to do so automatically.

The adaptive ATH is being conservative, however, in assuming that ATH is actually higher and that the loudest parts of the music are the exception (e.g. the loud transients in dynamic music) so the ATH shouldn't be raised. That's a good reason that the current model of ATH should be retained, so we don't start hearing artifacts in highly dynamic music that uses sudden loudness for artistic effect (e.g. classical or older rock/pop) but briefly enough that we don't turn down the volume or our ears don't adjust to the volume (like they do in a loud club).

That's why we possibly should not change LAME's default ATH behaviour.

If we listen to music like overcompressed music so that it's persistently near to the pain threshold, then we should probably encode with LAME as it is. I don't think that's many of us.

However, if we let ReplayGain or our volume control adjust it so that the perceived volume is about normal, the fact it's overcompressed will just mean there aren't loud transients any more - it's all at the maximum already and we've turned down the volume knob, so there's nowhere louder to go - it's already dialled up to 11, as Spinal Tap would say.

So all of us except those who really turn it up to levels where their hearing is at risk, should probably use --scale if they want to save bits but remain transparent in their listening environment. Those who have highly dynamic music will find that it remains transparent because it will be recorded with more headroom (i.e. ReplayGain doesn't need to adjust it much with --scale) and the adaptive ATH will still work fine.

I'm not offering to do it, just sharing my thoughts, but...

I'd have thought that this functionality would be ideally automated in software like Lame with .APE and Cuesheet support (available on Rarewares). For album gain you need to have the whole album ripped before encoding to measure the RG.

This can deal with a whole album ripped using EAC's Create CD Image, for example.

Imagine this process:

1. Rip album in EAC to a single .APE (Monkey's Audio) with .CUE sheet or multiple .APEs with APEv2 tags (created by using wapet as the External Encoder)

2. Load .CUE into Foobar2000 and calculate Track & Album Gain and add the info to the Cuesheet metadata and/or APEv2 tag. Alternatively this scan could be included in the Lame with .APE/.CUE executable.

3. Run Lame with .APE/.CUE/ReplayGain --scale support with a switch that says "apply ReplayGain Album/Track gain using --scale".
This can do all that LAME/APE/CUE can do
- encoding as a single MP3 image with CUEsheet
- encoding to separate MP3s with gaps
- encoding to separate 'near-gapless' MP3s with or without adding the Xing/Lame VBR header frame that helps seeking/time/bitrate display but breaks gapless playback in most dumb decoders that treat it as a silent audio frame.
The non-zero RG value for the other RG mode could be written to the APEv2 tag (APEv2 tagging would be another worthwhile modification to this special Lame compile) or CUE along with similar Undo data as mp3gain uses currently (rounded appropriately if mp3gain requires it).

4. Either LAME/APE/CUE/RG could scan for track peak and album peak on the fly and write it to tags (quick) or you could rescan for ReplayGain in FB2K (slower).


This is achievable. It would be an alternative for people with lots of modern metal and other highly compressed music that encodes to >220 kbps most of the time and feel this bitrate is excessive (esp after reading the stickies, claiming 180-210) but don't want to use the -Y switch.

I can't say I'd be a frequent user though - I usually use Musepack --standard --xlevel and I don't have a portable.

It might also be possible to enable this potential "Lame with APE/CUE/RG support" as a one-stop commandline encoder for EAC's Create Image with CUE (compressed), and as a track-gain only one-stop encoder in the separate tracks mode.

EAC would then pass it a CUEsheet and an uncompressed WAV and the commandline options necessary. In one pass of the program it could then do all the required steps: scan for RG, apply the appropriate --scale for each track in the required RG mode/preamp setting, split into separate tracks if required, gaplessly if required, apply tagging (ID3v1, ID3v2, APEv2 at user's choice), etc.

This wouldn't be a trivial bit of programming (e.g. it might have to search for a CUEsheet in the same folder as the source file to detect whether it was called from EAC's Image or Copy Selected Tracks mode - the latter supporting Track Gain only), but it would probably only achieve a worthwhile user base if it integrated neatly with EAC so it could be used as the default mp3 encoder as simply as Lame can (i.e. not going via wapet and mac.exe). I suspect EAC's ID3 tagging would have to be off.

A name such as lamegain.exe would differentiate it from lame.exe. It would be slower than lame thanks to the RG process, but probably no slower than running LAME then running mp3gain.

This approach is probably safer (regarding ATH in highly dynamic music) than bypassing the existing automatic ATH method in Lame, but it seemingly reduces the sfb21 problem's bitrate impact from modern overloud music.

EAC's commandline options would need to pass over all tagging information to lamegain - i.e. %g %a %t %n etc. Lamegain would use the cuesheet metadata if it found the cuesheet.

Lamegain's options would need to include the naming scheme. There's no way to specify alternative Various Artist naming, so 01 - Artist - Title.mp3 would have to be recommended in FAQs.

Easy near-Gapless encoding would be a bonus. The -t option of lame/CUE (as used by Lame --nogap) is more gapless for most decoders but breaks seeking/timing by removing the Xing/lame VBR header frame. If lamegain gapless mode became popular it might encourage more decoders to skip the lame VBR header frame and become more gapless.

APEv2 tagging would be a bonus too, for FB2K/mp3gain users. ID3v1 would suffice for legacy support (e.g. portables). The APEv2 tag is flexible enough to store the original RG volume levels and peaks and even the Lame version, commandline options and encoding parameters. The comment can then be kept short enough for the ID3v1.1 limit (28 chars), or an additional APEv2 tag can be used to indicate that some ID3v1.1 tags are truncated. (FB2K might in future use this knowledge to suppress display of duplicate Title Tags when the ID3v1.1 title differs by being truncated or abbreviated, for example).

One other possibility offered by the APEv2 tag would be a standard tag for the encoder to indicate the offset silence at start and end of the MP3 so it can be made sample-accurate, so that true gapless playback would be possible with MP3 if this tag is supported by the decoder without breaking anything.

That's a thought about what could be programmed to make a version of lame that's
easier for MP3 users who already use mp3gain, fb2k or gapless MP3 encoding because it all happens during the ripping phase.
rather less likely to suffer from VBR bitrate bloat from the sfb21 workaround.
usable as people's standard MP3 encoder for all albums - not just for special situations like live/mix gapless albums.

It wouldn't necessarily need to support Monkey's Audio either, though it would be nice.

I'd imagine a few sub-presets for the most common types of operation would be useful, e.g. --rgscanonly --rgalbum and --rgtrack as well as --autocuesheet, --albumimage (which retains the cuesheet with one big MP3), --gapless, --id3v1apev2 (which would curtail id3v1 if necessary). The 'scan only' would save a second operation for FB2K users and could also store RG info in the CUEsheet, but it would only work when APEv2 tags are enabled.

Any thoughts on how worthwhile / difficult / implementable this could be?
Go to the top of the page
+Quote Post

Posts in this topic
- Jebus   Wavegain vs. MP3Gain   Jun 21 2003, 21:34
- - Garf   Why not test the theory?   Jun 21 2003, 21:56
- - Jebus   Doing that right now... ETA 5min on the encode   Jun 21 2003, 22:02
- - Echizen   *lol* a new way to save bits. first decrease the v...   Jun 21 2003, 22:10
- - john33   The theory does work in practice, although I don...   Jun 21 2003, 22:12
- - M   Hmmm... I'll hazard a simple guess and say ...   Jun 21 2003, 22:13
- - Jebus   Here are the exciting results: "Mer De Noms...   Jun 21 2003, 22:20
- - HansHeijden   For mp3, it would be an idea if wavegain could pas...   Jun 21 2003, 22:22
- - Canar   QUOTE (Jebus @ Jun 21 2003 - 12:34 PM)Psychoa...   Jun 21 2003, 22:23
- - Jebus   QUOTE (HansHeijden @ Jun 21 2003 - 01:22 PM)F...   Jun 21 2003, 22:25
- - john33   QUOTE (HansHeijden @ Jun 21 2003 - 09:22 PM)F...   Jun 21 2003, 22:35
- - Jebus   QUOTE (john33 @ Jun 21 2003 - 01:35 PM)QUOTE ...   Jun 21 2003, 22:39
- - john33   QUOTE (Jebus @ Jun 21 2003 - 09:39 PM)QUOTE (...   Jun 22 2003, 00:12
- - Jebus   ah but i need to manually calculate scalefactor fr...   Jun 22 2003, 00:35
- - mrosscook   Jebus, In a problem like yours it can help to co...   Jun 22 2003, 03:48
- - westgroveg   The question of whether wavgain artifacts are perc...   Jun 22 2003, 04:03
- - Jebus   Well as it stands, I have just ripped a couple of ...   Jun 22 2003, 04:23
- - mrosscook   Westgroveq, I think it might be better to say th...   Jun 22 2003, 04:35
- - Canar   QUOTE (Jebus @ Jun 21 2003 - 07:23 PM)As reco...   Jun 22 2003, 05:14
- - Jebus   QUOTE (Canar @ Jun 21 2003 - 08:14 PM)QUOTE (...   Jun 22 2003, 05:33
- - Jebus   QUOTE (mrosscook @ Jun 21 2003 - 07:35 PM)Jeb...   Jun 22 2003, 05:37
- - indybrett   Geez... Does this mean I have to re-encode everyt...   Jun 22 2003, 06:29
- - Garf   QUOTE (Jebus @ Jun 22 2003 - 06:37 AM)(doesn...   Jun 22 2003, 08:12
- - tigre   - to avoid loss due to applying wavegain (= loweri...   Jun 22 2003, 08:16
- - Hanky   It does not surprise me that files get lower bitra...   Jun 22 2003, 11:11
- - HansHeijden   --scale is applied to float values so the lower vo...   Jun 22 2003, 11:53
- - john33   When applying the gain, WaveGain converts the inpu...   Jun 22 2003, 12:06
- - john33   QUOTE (Jebus @ Jun 21 2003 - 11:35 PM)ah but ...   Jun 22 2003, 12:45
- - M   QUOTE (john33 @ Jun 22 2003 - 06:45 AM)I just...   Jun 22 2003, 12:58
- - de Mon   May be I misunderstood something... If we are goin...   Jun 22 2003, 14:17
- - Xenno   Any non-zero value will be raised by the same amou...   Jun 22 2003, 14:39
- - mrosscook   Tigre, Hanky, HansHeijden, and John33, I don...   Jun 22 2003, 14:44
- - Hanky   After using the search function and finally realiz...   Jun 22 2003, 17:57
- - Jebus   QUOTE (john33 @ Jun 22 2003 - 03:45 AM)QUOTE ...   Jun 22 2003, 19:19
- - ibm2080   QUOTE (mrosscook @ Jun 22 2003 - 05:44 AM)Tig...   Jun 22 2003, 20:27
- - Jebus   The thing is, when you MP3gain a file down a few d...   Jun 22 2003, 20:56
- - mmortal03   QUOTE (Jebus @ Jun 22 2003 - 12:19 PM)4) sign...   Jun 22 2003, 21:08
- - Jebus   I personally can't ABX a difference, but my ea...   Jun 22 2003, 21:58
- - _Shorty   don't certain portions of the mp3 encoding pro...   Jun 23 2003, 10:10
- - 2Bdecided   In most of this thread, the real problem is only j...   Jun 23 2003, 10:57
- - john33   QUOTE (2Bdecided @ Jun 23 2003 - 09:57 AM)Joh...   Jun 23 2003, 11:10
- - ibm2080   QUOTE (2Bdecided @ Jun 23 2003 - 01:57 AM)The...   Jun 23 2003, 13:14
- - dev0   Let's just take a look at the current possibil...   Jun 23 2003, 14:45
- - 2Bdecided   QUOTE (dev0 @ Jun 23 2003 - 01:45 PM)1. Origi...   Jun 23 2003, 15:33
- - john33   These are the results from using one track only. I...   Jun 23 2003, 16:59
- - dev0   Could you please decode the test files and verify ...   Jun 23 2003, 17:07
- - tigre   QUOTE (dev0 @ Jun 23 2003 - 08:07 AM)Could yo...   Jun 23 2003, 17:22
- - mrosscook   In light of 2Bdecided's comments about the pos...   Jun 23 2003, 17:32
- - Jebus   Lets forget the actual wavegaining, as 2bdecided s...   Jun 23 2003, 18:54
- - M   From a simple numeric comparison (considering the ...   Jun 24 2003, 02:53
- - 2Bdecided   If Dibrom, JohnV, Gabriel etc etc are reading this...   Jun 24 2003, 11:52
- - john33   QUOTE (2Bdecided @ Jun 24 2003 - 10:52 AM)Fro...   Jun 24 2003, 12:16
- - 2Bdecided   Thanks john. That much I'd assumed. It's h...   Jun 24 2003, 14:58
- - ff123   QUOTE (2Bdecided @ Jun 24 2003 - 05:58 AM)Tha...   Jun 24 2003, 16:01
- - Garf   Vorbis should give identical results if scale is a...   Jun 24 2003, 16:13
- - ErikS   QUOTE (Garf @ Jun 24 2003 - 04:13 PM)Vorbis s...   Jun 24 2003, 17:15
- - /\/ephaestous   Vorbis test: CODEX:\Burn\TEST>di...   Jun 24 2003, 19:20
- - Garf   Does wavgain dither? Edit: the SCF clipping makes...   Jun 24 2003, 19:30
- - Jebus   I uploaded a bunch of samples for ABX testing on t...   Jun 24 2003, 20:04
- - sony666   My humble experiences with this topic: http://www....   Jun 24 2003, 20:20
- - john33   QUOTE (Garf @ Jun 24 2003 - 06:30 PM)Does wav...   Jun 24 2003, 20:52
- - Jebus   QUOTE (sony666 @ Jun 24 2003 - 11:20 AM)My hu...   Jun 24 2003, 21:33
- - ErikS   QUOTE (sony666 @ Jun 24 2003 - 08:20 PM)My hu...   Jun 24 2003, 21:46
- - AstralStorm   Does the -Y --scale version sound worse than --sca...   Jun 24 2003, 21:48
- - ff123   I believe the issue was adjusting the ath curve ba...   Jun 24 2003, 21:55
- - Jebus   ff123 That's a 40kbps change in total, 39kbps ...   Jun 24 2003, 22:40
- - /\/ephaestous   QUOTE (john33 @ Jun 24 2003 - 02:52 PM)QUOTE ...   Jun 25 2003, 01:56
- - ErikS   QUOTE (ff123 @ Jun 24 2003 - 09:55 PM)I belie...   Jun 25 2003, 06:08
- - mmortal03   I guess we just need to roll out some ABX tests. ...   Jun 25 2003, 10:27
- - 2Bdecided   Some answers (but not enough!)... ErikS, Re...   Jun 25 2003, 10:42
- - DickD   Finally reached the end of this thread (to date), ...   Jun 25 2003, 15:10
- - Jebus   Okay, so in summary we need people with good ears ...   Jun 25 2003, 19:12
- - Gabriel   My opinion is that if you intend to always play yo...   Jun 28 2003, 12:39
- - Garf   If it is purely an sfb21 problem, why does Vorbis ...   Jun 28 2003, 13:05
- - Garf   QUOTE (ErikS @ Jun 24 2003 - 10:46 PM)But how...   Jun 28 2003, 13:07
- - _Shorty   QUOTE (Gabriel @ Jun 28 2003 - 04:39 AM)It se...   Jun 29 2003, 03:20
- - Jebus   Thank you for your response Gabriel. I had already...   Jun 29 2003, 07:55
- - DickD   Thanks for the clarification about how the adaptiv...   Jul 1 2003, 16:36
- - mmortal03   I think it would be very worthwhile.   Jul 2 2003, 07:21
- - 2Bdecided   DickD, Life is very difficult if you have ideas, ...   Jul 2 2003, 11:12
- - john33   Give me a couple of days, or so, and I'll post...   Jul 2 2003, 11:46
- - RaWShadow   After using WaveGain, monkeys audio compress the w...   Jul 2 2003, 12:42
- - Jebus   QUOTE (RaWShadow @ Jul 2 2003 - 03:42 AM)Afte...   Jul 2 2003, 19:58
- - _Shorty   rawshadow, well, a 16bit per sample file can only ...   Jul 3 2003, 03:00
- - Jebus   QUOTE (_Shorty @ Jul 2 2003 - 06:00 PM)In oth...   Jul 3 2003, 03:50
- - Differenciam   Damn, this is a good idea.. I'm surprised no o...   Jul 3 2003, 04:08
- - mmortal03   QUOTE (john33 @ Jul 2 2003 - 04:46 AM)Give me...   Jul 3 2003, 09:58
- - flloyd   QUOTE (Differenciam @ Jul 2 2003 - 11:08 PM)D...   Jul 3 2003, 16:04
- - Jebus   QUOTE (flloyd @ Jul 3 2003 - 07:04 AM)QUOTE (...   Jul 3 2003, 17:13
- - DickD   QUOTE (john33 @ Jul 2 2003 - 11:46 AM)Give me...   Jul 3 2003, 18:11
- - john33   QUOTE (DickD @ Jul 3 2003 - 05:11 PM)@John33,...   Jul 3 2003, 18:23
- - DickD   QUOTE (john33 @ Jul 3 2003 - 06:23 PM)Yes, it...   Jul 3 2003, 19:17
- - john33   @DickD: I haven't forgotten this!!...   Jul 7 2003, 21:23
- - Mike Giacomelli   Any word? A search turned up this topic by accide...   Jul 15 2003, 04:54
- - john33   Sorry, I still intend doing this, but the weather ...   Jul 15 2003, 15:46
- - Mike Giacomelli   Thanks John. Also, I wouldn't mind the UK too...   Jul 15 2003, 23:07
- - john33   QUOTE (Mike Giacomelli @ Jul 15 2003, 10:07 P...   Jul 16 2003, 12:42
- - mmortal03   How can one compare our portable's volume outp...   Jul 17 2003, 09:57
- - DickD   QUOTE (mmortal03 @ Jul 17 2003, 09:57 AM)How ...   Jul 17 2003, 17:19
- - mmortal03   What I am getting at is the situation about losing...   Jul 18 2003, 09:07
2 Pages V   1 2 >


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 17th April 2014 - 23:19