IPB

Welcome Guest ( Log In | Register )

7 Pages V   1 2 3 > »   
Reply to this topicStart new topic
Wavegain vs. MP3Gain, Why the former might be better...
Jebus
post Jun 21 2003, 21:34
Post #1





Group: Developer
Posts: 1294
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
Garf
post Jun 21 2003, 21:56
Post #2


Server Admin


Group: Admin
Posts: 4885
Joined: 24-September 01
Member No.: 13



Why not test the theory?
Go to the top of the page
+Quote Post
Jebus
post Jun 21 2003, 22:02
Post #3





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



Doing that right now... ETA 5min on the encode smile.gif
Go to the top of the page
+Quote Post
Echizen
post Jun 21 2003, 22:10
Post #4





Group: Members
Posts: 70
Joined: 22-April 03
Member No.: 6122



*lol* a new way to save bits. first decrease the volume, encode and then increase with mp3gain wink.gif
Go to the top of the page
+Quote Post
john33
post Jun 21 2003, 22:12
Post #5


xcLame and OggDropXPd Developer


Group: Developer
Posts: 3760
Joined: 30-September 01
From: Bracknell, UK
Member No.: 111



The theory does work in practice, although I don't believe the difference was huge. But then you wouldn't expect it to be that large would you? I should be quoting numbers here, but I don't have any to hand without retesting! wink.gif


--------------------
John
----------------------------------------------------------------
My compiles and utilities are at http://www.rarewares.org/
Go to the top of the page
+Quote Post
M
post Jun 21 2003, 22:13
Post #6





Group: Members
Posts: 964
Joined: 29-December 01
Member No.: 830



Hmmm... I'll hazard a simple guess and say "yes," since I know that you can save bits by first using WaveGain and then compressing with a lossless algorithm (tested extensively for FLAC, Shorten and WavPack, although I suspect Monkey's audio and the rest would exhibit similar behavior).

- M.
Go to the top of the page
+Quote Post
Jebus
post Jun 21 2003, 22:20
Post #7





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



Here are the exciting results:

"Mer De Noms" by "A Perfect Circle"

MP3Gain wanted to do a -9dB adjustment, so this albums is pretty loud, though not the loudest by any means.

The files repaygained after the fact (MP3Gain) totalled 70.6MB
The files replaygained before encoding (Wavegain) totalled 63.4MB

So, using --alt-preset standard, you end up with about a 10% savings for a relatively loud modern recording. I assume the savings will be less for older recordings and more for hypercompressed drivel like they release today.

I think this is pretty significant...
My only thought it, are the files ABXable against eachother? I don't have the ears to do the test unfortunately... Anyone care to try? I certainly hope they are indistinguishable.
Go to the top of the page
+Quote Post
HansHeijden
post Jun 21 2003, 22:22
Post #8





Group: Members
Posts: 159
Joined: 30-September 01
Member No.: 75



For mp3, it would be an idea if wavegain could pass on just the replaygain value to lame's --scale, thereby avoiding the rounding to 16 bits.
Go to the top of the page
+Quote Post
Canar
post Jun 21 2003, 22:23
Post #9





Group: Super Moderator
Posts: 3361
Joined: 26-July 02
From: princegeorge.ca
Member No.: 2796



QUOTE (Jebus @ Jun 21 2003 - 12:34 PM)
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?

I believe that assertion may be false. If I understand correctly, the overall loudness of a track should have little effect on the encoding. The total amount of perceptible detail in a track is what affects bitrate. The remastered bitrates are probably like that because the process of compression brings previously inaudible details up to the level of audibility.

By decreasing the volume level, you decrease the amount of detail available overall, with some small-amplitude details being obliterated by the noise floor. Thus, saved bits.

Edit: This is my theory, anyhow... Any knowledgeable rebuttals?

This post has been edited by Canar: Jun 21 2003, 22:25


--------------------
You cannot ABX the rustling of jimmies.
No mouse? No problem.
Go to the top of the page
+Quote Post
Jebus
post Jun 21 2003, 22:25
Post #10





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



QUOTE (HansHeijden @ Jun 21 2003 - 01:22 PM)
For mp3, it would be an idea if wavegain could pass on just the replaygain value to lame's --scale, thereby avoiding the rounding to 16 bits.

Dude, that is a wonderful idea! Any LAME/wavegain developers listening?? This would be SO AWSOME!
Go to the top of the page
+Quote Post
john33
post Jun 21 2003, 22:35
Post #11


xcLame and OggDropXPd Developer


Group: Developer
Posts: 3760
Joined: 30-September 01
From: Bracknell, UK
Member No.: 111



QUOTE (HansHeijden @ Jun 21 2003 - 09:22 PM)
For mp3, it would be an idea if wavegain could pass on just the replaygain value to lame's --scale, thereby avoiding the rounding to 16 bits.

You can do that manually by just having the gain calculated.


--------------------
John
----------------------------------------------------------------
My compiles and utilities are at http://www.rarewares.org/
Go to the top of the page
+Quote Post
Jebus
post Jun 21 2003, 22:39
Post #12





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



QUOTE (john33 @ Jun 21 2003 - 01:35 PM)
QUOTE (HansHeijden @ Jun 21 2003 - 09:22 PM)
For mp3, it would be an idea if wavegain could pass on just the replaygain value to lame's --scale, thereby avoiding the rounding to 16 bits.

You can do that manually by just having the gain calculated.

yeh but what a pain! And AFAIK, replaygain won't display an album --scale value, so I'd have to calculate it manually, then apply this with --scale to every encoded MP3 i do. That's pretty time consuming...

This post has been edited by Jebus: Jun 21 2003, 23:06
Go to the top of the page
+Quote Post
john33
post Jun 22 2003, 00:12
Post #13


xcLame and OggDropXPd Developer


Group: Developer
Posts: 3760
Joined: 30-September 01
From: Bracknell, UK
Member No.: 111



QUOTE (Jebus @ Jun 21 2003 - 09:39 PM)
QUOTE (john33 @ Jun 21 2003 - 01:35 PM)
QUOTE (HansHeijden @ Jun 21 2003 - 09:22 PM)
For mp3, it would be an idea if wavegain could pass on just the replaygain value to lame's --scale, thereby avoiding the rounding to 16 bits.

You can do that manually by just having the gain calculated.

yeh but what a pain! And AFAIK, replaygain won't display an album --scale value, so I'd have to calculate it manually, then apply this with --scale to every encoded MP3 i do. That's pretty time consuming...

WaveGain will display the Album Gain value in calculation mode and if you have it write the log file, all the values will be saved in the log file for future reference.

BTW, I am the author of WaveGain. wink.gif


--------------------
John
----------------------------------------------------------------
My compiles and utilities are at http://www.rarewares.org/
Go to the top of the page
+Quote Post
Jebus
post Jun 22 2003, 00:35
Post #14





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



ah but i need to manually calculate scalefactor from that number right?

AFAIKT, this is simply 10E(replaygain * 0.05)

am I correct? So an album with a recommended gain adjustment of -10.02dB should have a --scale applied to lame that is 3.17? Seems to be roughly 10x too large. I'm going to write a script to automate this process now (once i figure this calc out), since I think this is all-around preferable to using MP3Gain.

EDIT: Nevermind, got it. I forgot to make the replaygain value negative (duh!).

This post has been edited by Jebus: Jun 22 2003, 01:05
Go to the top of the page
+Quote Post
mrosscook
post Jun 22 2003, 03:48
Post #15





Group: Members
Posts: 82
Joined: 14-December 02
From: Amherst MA
Member No.: 4077



Jebus,

In a problem like yours it can help to consider the asymptotic case, i.e., take the process to its logical conclusion. Suppose that we first wavegain the file to zero volume (digital silence). Then it takes only 1 bit to encode it. (Or is it 0 bits? Anyhow, it is a pretty good savings in file size). But if we try to gain back the volume of the encoded file, we find that we've lost all the information.

It's reasonable to expect that for intermediate amounts of wavegain, we should get intermediate savings in file size, and also lose intermediate amounts of information. (Of course, there's no guarantee that the process is linear or even monotonic; but we know where it has to start and end, so it has to pass through the points in between.)
Go to the top of the page
+Quote Post
westgroveg
post Jun 22 2003, 04:03
Post #16





Group: Members
Posts: 1236
Joined: 5-October 01
Member No.: 220



The question of whether wavgain artifacts are perceptible still remains
Go to the top of the page
+Quote Post
Jebus
post Jun 22 2003, 04:23
Post #17





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



Well as it stands, I have just ripped a couple of trial albums...

As recommended, what I did was extract using EAC, then run a wavegain ANALYSIS ONLY on the album. From the resulting suggested album gain adjustment I did 10E(gain * 0.05) to get the scalefactor, then ran LAME using:

lame --alt-preset standard --scale 0.3155 (for example - this is By The Way by the Red Hot Chili Peppers)

The resulting files are 10% smaller than if I had used MP3Gain after the encode, there is no theoretically lossy wavegaining being done, and I get much better than 1.5dB per step precision (the above files are 0.02dB over the ideal as set by replaygain).

I can't think of any reason why this is not the best possible way to encode MP3s. Not even much more work. Anyone have comments?
Go to the top of the page
+Quote Post
mrosscook
post Jun 22 2003, 04:35
Post #18





Group: Members
Posts: 82
Joined: 14-December 02
From: Amherst MA
Member No.: 4077



Westgroveq, I think it might be better to say that the question is not whether wavgain artifacts are perceptible, but when they become perceptible.

If we wavgained all the way to silence, anybody could ABX that as an artifact. But of course practical values of wavegain are going to lose much less information, and it wouldn't surprise me if 99.9% of all actual wavgain applications were impossible to ABX, by even the battiest of bat-ears on the forum.

It would be interesting to know when the information loss in wavgain becomes great enough to ABX, and it probably depends on the style of music, degree of compression and clipping in the original file, dynamic range of the music, etc. Any volunteers?

Jebus, Are you sure that --scale isn't lossy in itself? You could in principle use it to reduce the volume to zero, couldn't you, just as wavgain could do?
Go to the top of the page
+Quote Post
Canar
post Jun 22 2003, 05:14
Post #19





Group: Super Moderator
Posts: 3361
Joined: 26-July 02
From: princegeorge.ca
Member No.: 2796



QUOTE (Jebus @ Jun 21 2003 - 07:23 PM)
As recommended, what I did was extract using EAC, then run a wavegain ANALYSIS ONLY on the album. From the resulting suggested album gain adjustment I did 10E(gain * 0.05) to get the scalefactor, then ran LAME using:

lame --alt-preset standard --scale 0.3155 (for example - this is By The Way by the Red Hot Chili Peppers)

So, just to be absolutely certain, you are not altering the source WAV file in any way, yet are getting smaller file sizes?

There should be no difference between the MP3 files, or very, very little at most, if my understanding is correct.

This post has been edited by Canar: Jun 22 2003, 05:15


--------------------
You cannot ABX the rustling of jimmies.
No mouse? No problem.
Go to the top of the page
+Quote Post
Jebus
post Jun 22 2003, 05:33
Post #20





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



QUOTE (Canar @ Jun 21 2003 - 08:14 PM)
QUOTE (Jebus @ Jun 21 2003 - 07:23 PM)
As recommended, what I did was extract using EAC, then run a wavegain ANALYSIS ONLY on the album. From the resulting suggested album gain adjustment I did 10E(gain * 0.05) to get the scalefactor, then ran LAME using:

lame --alt-preset standard --scale 0.3155 (for example - this is By The Way by the Red Hot Chili Peppers)

So, just to be absolutely certain, you are not altering the source WAV file in any way, yet are getting smaller file sizes?

There should be no difference between the MP3 files, or very, very little at most, if my understanding is correct.

Yes that is correct. No modification of the source wave. They are quite a bit smaller. I've done a number of albums now from the last 10 years and they are coming out an average of 10% smaller.

This post has been edited by Jebus: Jun 22 2003, 05:34
Go to the top of the page
+Quote Post
Jebus
post Jun 22 2003, 05:37
Post #21





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



QUOTE (mrosscook @ Jun 21 2003 - 07:35 PM)
Jebus,  Are you sure that --scale isn't lossy in itself?  You could in principle use it to reduce the volume to zero, couldn't you, just as wavgain could do?

--scale is absolutely lossy, as is the entire encoding/quantization process during which it is set to a particular --scale anyhow (doesn't --aps use a scalefactor of 0.98 anyhow?). By using wavegain you are introducing an extra lossy step which involves additional dithering. This cuts that step out.
Go to the top of the page
+Quote Post
indybrett
post Jun 22 2003, 06:29
Post #22





Group: Members (Donating)
Posts: 1350
Joined: 4-March 02
From: Indianapolis, IN
Member No.: 1440



Geez...

Does this mean I have to re-encode everything again blink.gif


--------------------
flac>fb2k>kernel streaming>audiophile 2496>magni>dt990 pro
Go to the top of the page
+Quote Post
Garf
post Jun 22 2003, 08:12
Post #23


Server Admin


Group: Admin
Posts: 4885
Joined: 24-September 01
Member No.: 13



QUOTE (Jebus @ Jun 22 2003 - 06:37 AM)
(doesn't --aps use a scalefactor of 0.98 anyhow?).

No, only the CBR presets.
Go to the top of the page
+Quote Post
tigre
post Jun 22 2003, 08:16
Post #24


Moderator


Group: Members
Posts: 1434
Joined: 26-November 02
Member No.: 3890



- to avoid loss due to applying wavegain (= lowering volume at 16 bit res.) you could use fb2k's diskwriter @ 24 bit and encode the resulting .wav files with lame

- in my MP3 vs. MPC vs. Ogg: Low volume test I got similar results, but I focussed on quality problems not on bitrate.

- I *think* messing with lame ATH settings could have the same effect (--althlower switch with negative values).


--------------------
Let's suppose that rain washes out a picnic. Who is feeling negative? The rain? Or YOU? What's causing the negative feeling? The rain or your reaction? - Anthony De Mello
Go to the top of the page
+Quote Post
Hanky
post Jun 22 2003, 11:11
Post #25





Group: Members (Donating)
Posts: 531
Joined: 18-November 01
From: The Netherlands
Member No.: 481



It does not surprise me that files get lower bitrates when encoding to mp3 after first wavgaining them.
The simple fact that I throw away something like 0.5 to 1.0 bit of digital resolution could explain the lower bitrate easiliy.
For example a full range 16 bit signal scaled with let's say a 0.7 factor gives ~15.48 bits digital resolution left.
In general the loss of bits can be expressed as:
CODE
n=-2log(scalefactor)


Where n = the loss of bit depth of the signal, 2log is the 2 based logarithm

Of course this effect could be avoided by first resampling to 24 bit wav as mentioned in another post

This post has been edited by Hanky: Jun 22 2003, 11:21
Go to the top of the page
+Quote Post

7 Pages V   1 2 3 > » 
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: 20th September 2014 - 04:30