Skip to main content

Topic: ReplayGain, MP3Gain & clipping (Read 4466 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
ReplayGain, MP3Gain & clipping
I plan on encoding a replaygained (tagged) FLAC'ed music collection to LAME APS for listening on a new DAP. The plan is to produce mp3 files that have an average level of 92dB in order to get a bit more volume out of the DAP when required (my DAP has the EU SPL cap applied). I see 2 possible approaches:

1. Set foobar2k's ReplayGain preamp to 92dB during encoding.

2. Encode at an 89dB preamp level, then apply MP3Gain with a 92dB setting.

My hunch is that method 1 would introduce additional clipping by applying the gain prior to encoding, while the 2nd approach would not. In other words, method 2 is reversible back to 89dB, while method 1 is not.

I assume (and accept) that method 2 will still introduce clipping once decoded on the DAP. I just prefer to have a reversible, unclipped process.

Is this logic correct?

ReplayGain, MP3Gain & clipping
Reply #1
You'll get more clipping with #2. 

Go with one.  Monst albums will still not clip at 92dB, and een the one's that do will probably hardly be noticable on a DAP.
"You can fight without ever winning, but never win without a fight."  Neil Peart  'Resist'

ReplayGain, MP3Gain & clipping
Reply #2
Quote
You'll get more clipping with #2. 

Go with one.  Monst albums will still not clip at 92dB, and een the one's that do will probably hardly be noticable on a DAP.
[a href="index.php?act=findpost&pid=314101"][{POST_SNAPBACK}][/a]


Thanks for the info. I was under the impression that MP3Gain did not introduce clipping. To clip, doesn't the MP3 need to be decoded (since MP3 can represent values beyond -32768 to 32767)?

I was under the impression that the 2nd method might be the better, reversible process.

Edit: By reversible, I mean MP3Gaining back to 89dB.
  • Last Edit: 17 July, 2005, 10:58:29 AM by pigsflynow

  • Lyx
  • [*][*][*][*][*]
ReplayGain, MP3Gain & clipping
Reply #3
Unless your music is already heavily compressed(in the original recording) you will may get clipping anyways - No matter if you use mp3gain or replaygain.

You could tell mp3gain/replaygain to avoid clipping, but that means that it will just not increase the volume that much.

Or in short, if your music is not squashed, then you cannot increase the volume without introducing clipping - unless you add a compressor to the DSP-chain, which will lower the dynamic range in your music (read, make it more squashed).

In case all this sounds like abra-kadabra to you, then there are 3 possibilities:
- buy a small portable preamp for your portable, and stop worrying.
- inform yourself more about how sound works and what compressors do - then recognize that compressors suck and buy a portable preamp.
- inform yourself more about how sound works and what compressors do - and recognize that you dont care about squashed music if that makes it louder -> you use a compressor-DSP while encoding to MP3.

also see here:
http://www.hydrogenaudio.org/forums/index....showtopic=31148
http://www.hydrogenaudio.org/forums/index....topic=35591&hl= (near end of thread)
- Lyx
  • Last Edit: 17 July, 2005, 11:04:53 AM by Lyx
I am arrogant and I can afford it because I deliver.

ReplayGain, MP3Gain & clipping
Reply #4
Quote
Unless your music is already heavily compressed(in the original recording) you will may get clipping anyways - No matter if you use mp3gain or replaygain.

You could tell mp3gain/replaygain to avoid clipping, but that means that it will just not increase the volume that much.

Or in short, if your music is not squashed, then you cannot increase the volume without introducing clipping - unless you add a compressor to the DSP-chain, which will lower the dynamic range in your music (read, make it more squashed).

In case all this sounds like abra-kadabra to you, then there are 3 possibilities:
- buy a small portable preamp for your portable.
- inform yourself more about how sound works and what compressors do - then recognize that compressors suck and buy a portable preamp.
- inform yourself more about how sound works and what compressors do - and recognize that you dont care about squashed music if that makes it louder -> you use a compressor-DSP while encoding to MP3.

- Lyx
[a href="index.php?act=findpost&pid=314108"][{POST_SNAPBACK}][/a]


Thanks. Again, I'm trying to find out which process is more reversible. I'm aware that MP3 will always introduce some clipping under normal conditions when decoding. I am by no means interested in minimizing clipping when decoding via the DAP. I don't really care if the decoded files clip during playback in the DAP

It's solely in the 3dB boost to the MP3 files that I'm trying to avoid additional, permanent, irreversible clipping (the kind that I suspect might be introduced in method 1 because the gain may be applied to the decoded WAV before encoding to MP3 (via Diskwriter)).

To make a long story short, I want these MP3s to be "archivable".

I hope I'm making sense... 

Edit: typo
  • Last Edit: 17 July, 2005, 11:10:53 AM by pigsflynow

  • Lyx
  • [*][*][*][*][*]
ReplayGain, MP3Gain & clipping
Reply #5
i'm not 100% sure, but in this case mp3gain may be the only "reversible" solution for a DAP. But that will only work if you do *not* use a compressor and live with your music getting clipped on playback.
  • Last Edit: 17 July, 2005, 11:15:07 AM by Lyx
I am arrogant and I can afford it because I deliver.

ReplayGain, MP3Gain & clipping
Reply #6
Quote
i'm not 100% sure, but in this case mp3gain may be the only "reversible" solution for a DAP. But that will only work if you do *not* use a compressor and live with your music getting clipped on playback.
[a href="index.php?act=findpost&pid=314115"][{POST_SNAPBACK}][/a]


I think we're on the same page now. I'm willing to live with whatever clipping the 3dB boost adds to the decoded audio on the DAP. I would, however, like the MP3 files to "reverse-archivable".

I guess the main question is: When transcoding from FLAC to MP3 with a 3dB boost via the ReplayGain preamp, is the 3dB boost applied to the decoded WAV or to the encoded MP3?

  • Lyx
  • [*][*][*][*][*]
ReplayGain, MP3Gain & clipping
Reply #7
to the mp3. Thats why your idea will only work with mp3gain.

Explanation: all DSPs and preamp you set in fb2k's diskwriter are applied to the decoded audiodata itself before encoding (your FLACs will of course stay unchanged - diskwriting means original-format -> decoded audio -> target-format)

Mp3Gain does not really change the audiodata itself. An mp3 consists of "frames"(like sectors on a CD). Every of those frames has a preamp-modifier-variable. This modifier is stored in *addition* to the audiodata in the frame, and it can exceed the max volume. Thus, the modifier can be higher than the max volume and therefore can be reversed - if the undo-data is stored somewhere(mp3gain stores them in tags)
  • Last Edit: 17 July, 2005, 11:34:55 AM by Lyx
I am arrogant and I can afford it because I deliver.

ReplayGain, MP3Gain & clipping
Reply #8
Quote
to the mp3. Thats why your idea will only work with mp3gain.
[a href="index.php?act=findpost&pid=314118"][{POST_SNAPBACK}][/a]


If the 3dB gain is applied to the encoded mp3, how does clipping occur? I would expect gain applied after encoding to mp3 to be pretty much identical to how mp3gain works. Is there a different mechanism for applying gain (in diskwriter after encoding?

I was guessing that replaygain preamp gain was applied to the decoded WAV (ie. how a normal preamp usually functions), and that clipping was already present before encoding to mp3...

Edit: I think you meant to say "to the WAV" in your first sentence. Your explanation in your edit makes perfect sense to me.
  • Last Edit: 17 July, 2005, 11:38:40 AM by pigsflynow

  • Lyx
  • [*][*][*][*][*]
ReplayGain, MP3Gain & clipping
Reply #9
Quote
If the 3dB gain is applied to the encoded mp3, how does clipping occur?
[a href="index.php?act=findpost&pid=314119"][{POST_SNAPBACK}][/a]

Clipping means that the volume of the audiodata exceeds its max value. Since this is not possible, it is cut off(flattened).

The difference between is just if the "clipping" happens before encoding(and is permanent), or is introduced when decoding. Read my addendum in my previous post: when using mp3gain, then it is the modifier-value which introduces clipping while decoding - the audiodata itself does not clip - it only clips when the modifier is applied while decoding.
I am arrogant and I can afford it because I deliver.

ReplayGain, MP3Gain & clipping
Reply #10
Quote
Quote
If the 3dB gain is applied to the encoded mp3, how does clipping occur?
[a href="index.php?act=findpost&pid=314119"][{POST_SNAPBACK}][/a]

Clipping means that the volume of the audiodata exceeds its max value. Since this is not possible, it is cut off(flattened).

The difference between is just if the "clipping" happens before encoding(and is permanent), or is introduced when decoding. Read my addendum in my previous post: when using mp3gain, then it is the modifier-value which introduces clipping while decoding - the audiodata itself does not clip - it only clips when the modifier is applied while decoding.
[a href="index.php?act=findpost&pid=314121"][{POST_SNAPBACK}][/a]


See my previous edit. Your last post threw me off in the first sentence. Everything else makes perfect sense.

To sum it up. The plan is to avoid "permanent" clipping. You've confirmed my fears about using method 1. Thanks!