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: Scale option in LAME (Read 6874 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Scale option in LAME

Hi there, I'm converting part of my collection (FLACs mainly) to mp3 using LAME 3.98.2. When I convert a loseless file using the --clipdetect switch, it says some info in the end about detected clipping. It also shows me a value I could use to reencode the file in order to avoid clipping.

The question is, in your opinion, should I reencode the files (as I still have the loseless ones) using the --scale switch to avoid clipping?

Thank you very much for your time and answers.

Scale option in LAME

Reply #1
No.

Cheers, Slipstreem. 

Scale option in LAME

Reply #2
This is really a two-part question. Should you reencode your files, and if you do should you do it by using the --scale switch.

The answer to the first question is that I personally wouldn't bother. The likelihood that you will actually hear a difference is small.

If you decide that it is worth reencoding, or that you want to rescale for any further encoding that you do, then using the --scale switch is an excellent choice. Unlike mp3gain, you are not limited to increments of 1.5 dB in gain, and unlike replaygain, your files are compatible with all players, not just the ones that apply replaygain.

Scale option in LAME

Reply #3
Thank you very much for your quickness.

I'm making some tests as I still have to convert some files (not enough space to have them all encoded with a loseless codec). Here is the output of the same file regarding that switch:

Switches: --verbose --clipdetect -q0 -V0 -p
Code: [Select]
ReplayGain: -8.3dB
WARNING: clipping occurs at the current gain. Set your decoder to decrease the  gain  by  at least 1.5dB or encode again using  --scale 0.85 or less (the value under --scale is approximate).


Switches: --verbose --clipdetect --scale 0.81 -q0 -V0 -p
Code: [Select]
ReplayGain: -6.9dB
WARNING: clipping occurs at the current gain. Set your decoder to decrease the  gain  by  at least 0.4dB or encode again using --scale <arg> (For a suggestion on the optimal value of <arg> encode with  --scale 1 first)


So... I still have to use ReplayGain when playing that song (it happens with some more I've tried too). The source was a FLAC file, ripped directly from the original CD so "--scale 1" would give the same results.

(@pdq:) If you had to encode some files (and if you had time too, as in order to apply the --scale switch you must go track by track) would you use it?

@Slipstreem: Why not? Will some detail be lost?

Thank you very much for your time and answers once more.

Scale option in LAME

Reply #4
Sorry. It looked as though you were after a straight "yes" or "no" answer. As pdq so rightly suggests, unless you can actually hear the results of the clipping, it's a needless process. I can understand someone wanting to do it purely out of correctness though. There's nothing wrong with doing it, per se.

Cheers, Slipstreem. 

Scale option in LAME

Reply #5
Your first encode, where you omitted --scale, is indeed equivalent to using --scale 1.0.

When it says that the factor of 0.85 is approximate, it means that value may be too much, or it may be too little. Only further experimenting will tell you for sure because changing the scale changes too many other factors in the encode to be totally predictable.

When it says that an additional 0.4 dB is needed, this is a VERY small adjustment and I don't think you need to go that extra step (Of coures, I personally wouldn't have bothered with the initial 1.5 dB adjustment).

However, I think that far more important than looking for tiny amounts of clipping, you should be more interested in adjusting all of your files to make them equal loudness, using either mp3gain or replaygain. If you do this then most likely all of you clipping issues will disappear, because those files that are clipping are also probably too lound and will be adjusted down naturally to match your other files.

Scale option in LAME

Reply #6
I also have my collection in lossless formats.
And I use the scale option in my mp3 encodes to apply the replaygain values stored in the lossless files.
So I don't have to worry about different DAPs that don't support reading replaygain.

Scale option in LAME

Reply #7
Is that an automated process or do you do it manually?

Scale option in LAME

Reply #8
However, I think that far more important than looking for tiny amounts of clipping, you should be more interested in adjusting all of your files to make them equal loudness, using either mp3gain or replaygain. If you do this then most likely all of you clipping issues will disappear, because those files that are clipping are also probably too lound and will be adjusted down naturally to match your other files.
I wouldn't recommend that approach personally. It destroys the relative dynamic levels of tracks per album and can ruin the whole feel of an album in my opinion. You're also likely to get audible jumps in volume between tracks when they're intended to be (and are) played back gaplessly.

I'd either leave the tracks alone or apply gain adjustment in the style of ReplayGain album gain myself.

Cheers, Slipstreem. 

Scale option in LAME

Reply #9
Quote
Is that an automated process or do you do it manually?

I once found a VB script here in HA (I think its name was flac2lame.vbs or something...). I used that for quite a while...

Quote
It destroys the relative dynamic levels of tracks per album and can ruin the whole feel of an album in my opinion
Yes, of course, I'll apply replaygain-album values just because of that! So the resulting mp3s have an album gain of 0dB and various track gain values.

Scale option in LAME

Reply #10
Thank you very much for all of your answers and your time!

I see things clearer right now, I'll look for that script as it seems to be quite useful and I have ReplayGain calculated for all of the files in my collection.

I'll make more tests before deciding what to do though. I'll apply the ReplayGain album values using that script and then I'll see. I would like to lose the less detail possible.

I have almost discarded mp3gain, I wouldn't like to normalize the files, though I'll take some tests with that too.

What I still don't understand... Why the values stored in RG tags are so high? For example, according to the second encoding in my last post, the decoder should be set to decrease the gain by 0.4dB, but the RG tag stored is -6.9dB. And so the album values.

Thanks once more for everything.

Scale option in LAME

Reply #11
The ReplayGain Value is targeting at an average loudness impression which has to be pretty low (compared to pop/rock music on CD) in order to be able to achieve this loudness target also with tracks of rather low loudness on average but strong peaks within.
As loudness of usual pop/rock CDs usually is very high RG value easily is -7.0 db or below.

This has nothing to do with reducing loudness for the purpose of preventing clipping. For this purpose a value pretty close to 0 usually is sufficient.

I personally use mp3Gain after encoding for achieving both goals. This eliminates the (very small) error of preprocessing the track before encoding and thus keeps the full resolution of the input for the encoding process. It makes the encoding result indepent of specific RG playback features of the DAP used, and I can take care of clipping in case I want to (I usuallly do).
lame3995o -Q1.7 --lowpass 17