HydrogenAudio

Lossy Audio Compression => MP3 => MP3 - Tech => Topic started by: leethedj on 2015-03-12 07:40:38

Title: Did LAME lowpass filters change?
Post by: leethedj on 2015-03-12 07:40:38
I recently came back to an encoding project I sat aside for a year or so.  I've been encoding hundreds of hours of .wav files (digitized from VHS h-fi recordings of FM radio broadcasts) to mp3s using the LAME V6 preset.  Since building a new computer system and getting the latest versions of Exact Audio Copy and LAME, one tiny aspect of encoding seems different.  I could have sworn the default lowpass filter at V6 was around 15.5KHz, which is perfect for FM radio recordings, but now as I use LAME, I see the lowpass band at V6 is around 17kHz.  I don't recall specifying a lowpass of 15.5 last year with my old computer setup.  Seems like I recall being happy that V6 preset fit FM radio so perfectly.

Anyway, I can add the -lowpass 15.5 term to my LAME command line, but I'm just wondering if I'm nuts or if the default lowpass for V6 was different before.
Title: Did LAME lowpass filters change?
Post by: mjb2006 on 2015-03-12 09:23:49
--vbr-new (vbr_mtrh) became the default in LAME 3.98. From looking at lame.c starting around line 700, I think this means the lowpass thresholds are a little higher. V6 is now 16500, was 15600.

http://lame.cvs.sourceforge.net/viewvc/lam...amp;view=markup (http://lame.cvs.sourceforge.net/viewvc/lame/lame/libmp3lame/lame.c?revision=1.368&view=markup)

We need to update the wiki.
http://wiki.hydrogenaud.io/index.php?title...ettings_details (http://wiki.hydrogenaud.io/index.php?title=LAME#Recommended_settings_details)

How do you calculate the filter's full range from the center frequency?
Title: Did LAME lowpass filters change?
Post by: Aleron Ives on 2015-03-12 17:59:08
Other settings also changed, didn't they? Lame 3.98.4 has a lowpass of 19.5 kHz for V0, but IIRC 3.99.5 has no lowpass for V0 (which the wiki supports).
Title: Did LAME lowpass filters change?
Post by: leethedj on 2015-03-12 19:30:06
--vbr-new (vbr_mtrh) became the default in LAME 3.98. From looking at lame.c starting around line 700, I think this means the lowpass thresholds are a little higher. V6 is now 16500, was 15600.


mjb2006:

Thank you for that info!  Nice to know my memory isn't fooling me.

Quick lowpass question for you or anyone else...  If you use a simple lowpass frequency (e.g.: -lowpass 15.5) does that create a small cutoff bandwidth like 15.3 to 15.7 to avoid potential "ringing" or would I need to use the "width" parameter to be sure?  It might not matter too much in my case since the frequencies available in FM roll off pretty hard at 15kHz.
Title: Did LAME lowpass filters change?
Post by: leethedj on 2015-03-12 19:45:17
Well, I pretty much answered my own question by trying it.  Using --lowpass 15.5 creates a 533Hz bandwidth of 15115-15648 Hz.  The default at V6 is 16538-17071 Hz, also a bandwidth of 533!  If 533 Hz is a good enough bandwidth for the default, it's good enough for me and my piece of mind.

I also see where my file size got smaller for a lowpass of 15.5kHz.  My test file of 56m13s makes a mp3 of 49,216 kB with the default lowpass, and 48,008 kB with my lowpass of 15.5.  Interesting.  I wonder what decisions the algorithm is making there?  In any event, a smaller file size that sounds the same or better in my specific case is wonderful since I have so many hours to encode.  :-)
Title: Did LAME lowpass filters change?
Post by: saratoga on 2015-03-12 21:36:37
My test file of 56m13s makes a mp3 of 49,216 kB with the default lowpass, and 48,008 kB with my lowpass of 15.5.  Interesting.  I wonder what decisions the algorithm is making there?  In any event, a smaller file size that sounds the same or better in my specific case is wonderful since I have so many hours to encode.  :-)


You're bypassing the sfb21 problem with mp3 by excluding those frequencies.  See:  http://wiki.hydrogenaud.io/index.php?title=LAME_Y_switch (http://wiki.hydrogenaud.io/index.php?title=LAME_Y_switch)
Title: Did LAME lowpass filters change?
Post by: 2Bdecided on 2015-03-13 10:23:41
The filtering in your FM receiver would be somewhere between nearly perfect and non-existent. I have seen both extremes in real receivers, as well as performance in between. VHS hi-fi stereo recordings are pretty faithful (though with interesting noise mostly hidden by an aggressive but near-perfectly reversed compander), with a flat frequency response usually beyond 20kHz. Hence it's likely there's something above 15.5kHz in your recordings, even though it's not anything useful. The filtering in lame is digitally "perfect" - what I mean is, it ensures there is essentially nothing present above the transition band. Hence filtering in lame leaves less junk to encode, which is a good thing.

I do have recordings where V6 is good enough, but for FM recordings I'd use something better. Adding too much psycho-acoustic based compression on top of typical FM dynamic range compression can make the sound too mushy IMO. I've tried lossless 32kHz 12-bit compressed to FLAC and lossyFLAC, and just normal lame V2. I can't hear a difference either way. Even so, I've kept lossless copies of everything so far. The size of cheap HDDs is expanding more quickly that I have time to digitise things for now. 4000-5000 hours on a single 2TB drive the size of a wallet. I didn't record that many things off the radio.

Cheers,
David.
Title: Did LAME lowpass filters change?
Post by: leethedj on 2015-03-13 22:06:19
saratoga,

Thanks for the link.  Makes me even happier with my lowpass 15.5 decision.


David,

Don't worry, I'm keeping every single original 3 hour .wav file.  This was a radio show I used to do so I'm obsessive.  :-)  My choice of the V6 preset was my own subjective judgement of where I began to notice the difference, and balancing that with my desire to upload as many of them as possible to some web space I will purchase.

Regarding FM and VHS hi-fi, I can verify everything you said about those formats by looking at a spectrum analysis of my recordings.  The FM receiver I was using back in the day did not filter out the 19kHz carrier tone for stereo and you can see the little peak in the spectrum.  The VHS hi-fi preserved that, and so did my sound card.  The only negative with all my VHS hi-fi tapes is a very subtle head switching noise during quiet passages, which may be due to playing the tapes back on a machine different than the recording machine.  When reception was particularly good, you can see clearly in the spectrum that there is nothing useful above 15kHz.  I considered using a 32kHz sample rate for the mp3s, but a couple of friends I sent samples to previously said the 44.1kHz files sounded better on whatever device they were using.  I presume some playback devices don't handle 32kHz files properly.  So just in case, since I want to make these mp3s available as a retro podcast, I've opted for 44.1kHz.  I'm pretty happy with the results.  The quality is really quite good, despite jumping around between 96 and 160 kbps, and works for all but the most critical listening scenarios.  As my Dad would say, "Close enough for government work!" 
Title: Did LAME lowpass filters change?
Post by: 2Bdecided on 2015-03-16 11:00:10
It's a shame that, to my knowledge, there is no restoration software available to reduce the head switching noise from VHS HiFi Stereo recordings.

Even at its best, if you have an audio signal with plenty of high frequency sounds but no bass, and an audio system with good bass response, the rumble is quite audible. Even so, it was the least bad option available to me 20+ years ago. Thanks to the frequency response, lack of wow and flutter, lack of Dolby and azimuth issues, and the fact it could record for up to 8 hours non-stop, the results are still better to listen to than most old cassette tapes. Depends which faults the content itself is better at hiding.

At least the drop outs, which manifest themselves as clicks or sequences of crackly/rumbly clicks, are mostly easily fixed these days.

If only we'd had affordable digital recording about a century earlier.

Cheers,
David.
Title: Did LAME lowpass filters change?
Post by: mjb2006 on 2015-04-02 02:38:53
As far as fixing the table in the wiki...

LAME's console output shows whether the polyphase lowpass filter was enabled, what its transition bands are, and any resampling. For LAME 3.99.5 I get the following results:

Code: [Select]
With 44.1 kHz stereo input:

-b320 = 20094–20627 Hz
-V0 = polyphase lowpass disabled
-V1 = 19383–19916 Hz
-V2 = 18671–19205 Hz
-V3 = 17960–18494 Hz
-V4 = 17249–17782 Hz
-V5 = 16538–17071 Hz
-V6 = same as -V5
-V7 = polyphase lowpass disabled, resampled to 32 kHz
-V8 = polyphase lowpass disabled, resampled to 24 kHz
-V9 = polyphase lowpass disabled, resampled to 22.05 kHz
-V9.999 = polyphase lowpass disabled, resampled to 8 kHz

With the same 44.1 kHz stereo input, but with --vbr-old:

-V0 = 19383–19916 Hz
-V1 = 18671–19205 Hz
-V2 = same as -V1
-V3 = 17960–18494 Hz
-V4 = 17249–17782 Hz
-V5 = 15826–16360 Hz
-V6 = 15115–15648 Hz
-V7 = 14581–14968 Hz, resampled to 32 kHz
-V8 = 12516–12903 Hz, resampled to 32 kHz
-V9 = 9774–10065 Hz, resampled to 24 kHz
-V9.999 = 3903–4000 Hz, resampled to 8 kHz

With 48 kHz stereo input:

-b320 = 20323–20903 Hz
-V0 = polyphase lowpass disabled
-V1 = 19548–20129 Hz
-V2 = 18000–18581 Hz
-V3 = same as V2
-V4 = 17226–17806 Hz
-V5 = 16452–17032 Hz
-V6 = same as V5
-V7 = polyphase lowpass disabled, resampled to 32 kHz
-V8 = polyphase lowpass disabled, resampled to 24 kHz
-V9 = polyphase lowpass disabled, resampled to 22.05 kHz
-V9.999 = polyphase lowpass disabled, resampled to 8 kHz

With the same 48 kHz stereo input, but --vbr-old:

-V0 = 19548–20129 Hz, no resampling
-V1 = 18774–19355 Hz, no resampling
-V2 = same as -V1
-V3 = 18000–18581 Hz, no resampling
-V4 = 17226–17806 Hz, no resampling
-V5 = 15677–16258 Hz, no resampling
-V6 = 15115–15648 Hz, resampled to 44.1 kHz
-V7 = 14581–14968 Hz, resampled to 32 kHz
-V8 = 12516–12903 Hz, resampled to 32 kHz
-V9 = 9774–10065 Hz, resampled to 24 kHz
-V9.999 = 3903–4000 Hz, resampled to 8 kHz

LAME 3.98.4 has different results as well. Stereo 44.1 kHz input:

-b320 = 20094–20627 Hz
-V0 = 19383–19916 Hz
-V1 = 18671–19205 Hz
-V2 = same as -V1
-V3 = 17960–18494 Hz
-V4 = 17249–17782 Hz
-V5 = 16538–17071 Hz
-V6 = 15115–15648 Hz
-V7 = 14581–14968 Hz, resampled to 32 kHz
-V8 = 12516–12903 Hz, resampled to 32 kHz
-V9 = 9336–9602 Hz, resampled to 22.05 kHz
-V9.999 = 3903–4000 Hz, resampled to 8 kHz

And stereo 48 kHz input:

-b320 = 20323–20903 Hz
-V0 = 19548–20129 Hz
-V1 = 18774–19355 Hz
-V2 = 18000–18581 Hz
-V3 = same as -V2
-V4 = 17226–17806 Hz
-V5 = 16452–17032 Hz
-V6 = 15115–15648 Hz, resampled to 44.1 kHz
-V7 = 14581–14968 Hz, resampled to 32 kHz
-V8 = 12516–12903 Hz, resampled to 32 kHz
-V9 = 9336–9602 Hz, resampled to 22.05 kHz
-V9.999 = 3903–4000 Hz, resampled to 8 kHz

48 kHz and --vbr-old:
-V0 = 19548–20129 Hz
-V1 = 18774–19355 Hz
-V2 = same as -V1
-V3 = 18000–18581 Hz
-V4 = 17226–17806 Hz
-V5 = 15677–16258 Hz
-V6 = 15115–15648 Hz, resampled to 44.1 kHz
-V7 = 14581–14968 Hz, resampled to 32 kHz
-V8 = 12516–12903 Hz, resampled to 32 kHz
-V9 = 9774–10065 Hz, resampled to 24 kHz
-V9.999 = 3903–4000 Hz, resampled to 8 kHz

LAME 3.97, 44.1 kHz stereo input:

-b320 = 20094-20627
-V0 = 19383–19916 Hz
-V1 = 18671–19205 Hz
-V2 = same as -V1
-V3 = 17960–18494 Hz
-V4 = 17249–17782 Hz
-V5 = 15826–16360 Hz
-V6 = 15115–15648 Hz
-V7 = 14581–14968 Hz, resampled to 32 kHz
-V8 = 12516–12903 Hz, resampled to 32 kHz
-V9 = 9774–10065 Hz, resampled to 24 kHz
-V9.999 = 9774–10065 Hz, resampled to 24 kHz

LAME 3.96, 44.1 kHz stereo input:

-b320 = 20094–20627 Hz
-V0 = 19383–19916 Hz
-V1 = 18671–19205 Hz
-V2 = same as -V1
-V3 = 17960–18494 Hz
-V4 = same as -V3
-V5 = 16538–17071 Hz
-V6 = 15826–16360 Hz
-V7 = 14581–14968 Hz, resampled to 32 kHz
-V8 = 12516–12903 Hz, resampled to 32 kHz
-V9 = 9774–10065 Hz, resampled to 24 kHz
-V9.999 = 9774–10065 Hz, resampled to 24 kHz


They're all different.

Some things I don't understand:
Title: Did LAME lowpass filters change?
Post by: saratoga on 2015-04-02 03:15:23
If the filter is disabled, nothing is filtered. Its not even possible for a lowpass to remove above Nyquist. A filter with its cutoff at Nyquist is called an all pass.
Title: Did LAME lowpass filters change?
Post by: mjb2006 on 2015-04-02 04:07:34
Sorry, I was asking about the 3.99.5 -V7 and up with 44.1 kHz input. This input is downsampled to 32, 24, 22.05 or 8 kHz. The polyphase filter is disabled for those. But to avoid aliasing, there must be a filter with a cutoff at the Nyquist frequency, right? Does it not have a transition band?
Title: Re: Did LAME lowpass filters change?
Post by: Kraeved on 2021-04-15 02:22:27
Indeed, why there is no lowpass filter with V7 and below? Wouldn’t it be beneficial to add at least --lowpass 15.5 which was mentioned?