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: How to prevent lame from cutting the spectrum? (Read 28821 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How to prevent lame from cutting the spectrum?

Reply #25
I would like to "up" this topic - I wanted to achieve the same, that is, a full-spectrum mp3 without any lowpass filtering on any frame... I was experimenting with older versions of LAME and although the files produced by 3.90 to 3.93 are quite close at high bitrates (320 cbr being the best obviously), but as lvqcl suggested, still there is lowpass filtering on _some_ of the frames.

I wonder if it is possible to finetune LAME's psychoacoustic settings so that no masking or filtering is done on any of the frames? (sorry but I didn't read into it too much)

(I know it is advised against and can produce artifacts/ringing/etc. but my point is theoretical - by this I'm simply going for the 'perfect look' of the spectrum analysis of the file and not for optimal perceived sound transparency)

Thanks for the help!

How to prevent lame from cutting the spectrum?

Reply #26
I wonder if it is possible to finetune LAME's psychoacoustic settings so that no masking or filtering is done on any of the frames? (sorry but I didn't read into it too much)


Yes I believe it should be possible.  In principle you could make an mp3 encoder that just allocated a minimum number of bits to each frequency band. 

If you're not interested in quality, starting with a more simple MP3 encoder might be easier than LAME.  Maybe shine or the old ISO reference encoder would be easier to understand.

How to prevent lame from cutting the spectrum?

Reply #27
I wonder if it is possible to finetune LAME's psychoacoustic settings so that no masking or filtering is done on any of the frames? (sorry but I didn't read into it too much)

Try to lower the quality: -q 9.

How to prevent lame from cutting the spectrum?

Reply #28
I'm pretty sure there's an old version of LAME that will do that. Possibly Blade, too.

How to prevent lame from cutting the spectrum?

Reply #29
Thanks for the replies!

Unfortunately I didn't find the other encoders (other than Blade messes up everything above 16 kHz, suggesting that it won't do this well), however, with LAME 3.90.3, I got the best results using the --noath switch together with -k (at both CBR and VBR files). Still some frames get lowpassed.

However, for some reason I can't get the -q over 5... it works from 0 to 5 but not above it (so I wasn't able to try -q9 in 3.90.3...  :-/

How to prevent lame from cutting the spectrum?

Reply #30
As far as I can remember BladeEnc didn't do any low-pass filtering when encoding to 256 or 320 kbps CBR mp3, so you might give that another try. (just put -256 or -320 on the last line of bladeenc.cfg)

How to prevent lame from cutting the spectrum?

Reply #31
You could also look at Helix MP3 and maybe SHINE MP3

How to prevent lame from cutting the spectrum?

Reply #32
Just because you can hear a 20khz sine wave doesn't mean your ears can pick it up at reference level to a 1khz one, or that your transducers can reproduce them the same way. I don't recommend listening to 20khz waves at all without absolutely making sure its at the same amplitude as a comfortable 1khz wave. Its stupid and can damage your hearing permanently. Ask anybody with tinnitus. And for what? To get an mp3 waveform to match a lossless one? That's stupid too because it defeats the purpose of what lossy encoding is trying to achieve. There's only an octave (8 notes) between 10khz and 20khz and very little musical information in there. I've downsampled music from 44.1 to 32 before and couldn't tell the difference. Try lame -v2 and abx test against the original. You might find you don't need the inaudible frequencies above 16khz and just enjoy the music.

How to prevent lame from cutting the spectrum?

Reply #33
Well, thanks for the tips... I still would like to try to do this with LAME.

As for the 'why?' question I think it's rather a perfectionist thingy. While not audible, it is still comforting just to know that the full spectrum of the file is preserved and look at its spectrogram. I think most people who would like to do the same have the same reason.

My personal goal would be to finetune LAME to produce ~190-230 kbps VBR files that have the full audio spectrum. (As stated earlier, LAME 3.90.3 gets close with --noabr -k at 320CBR but still some frames get lowpassed).
Any further help in this would be greatly appreciated.

How to prevent lame from cutting the spectrum?

Reply #34
As for the 'why?' question I think it's rather a perfectionist thingy. While not audible, it is still comforting just to know that the full spectrum of the file is preserved and look at its spectrogram.


Hopefully you realize this, but just because a spectrogram shows you energy at those frequencies does not mean its actually the same as the audio you input.  MP3's scalefactors do not allow accurately quantizing very high frequency content very well, so you should not be looking at a spectrogram to judge these (which is what I get the impression you are doing).

If you have some irrational desire to encode that stuff, you should be using FLAC or some other lossless.

How to prevent lame from cutting the spectrum?

Reply #35
I see... yes, there were discussions about this, that is, encoding ultra high frequencies accurately is a weakness of the format itself.
Even the FFT analysis shows visible gaps in frames where no lowpassing was applied - that's the best MP3 could provide.

Nevertheless, still there is lowpass filtering applied on some of the frames, due to psychoacoustics (sorry but I didn't read into this very much) - is there a way to finetune psychoacoustics in a way that it won't apply any lowpass filtering on any of the frames?
(As suggested I tried various quality settings like -q0...9 but it didn't work)

How to prevent lame from cutting the spectrum?

Reply #36
I see... yes, there were discussions about this, that is, encoding ultra high frequencies accurately is a weakness of the format itself.


So you don't care about what is encoded, so long as it shows up on a spectrogram?  Tried adding white noise? 

Nevertheless, still there is lowpass filtering applied on some of the frames, due to psychoacoustics (sorry but I didn't read into this very much) - is there a way to finetune psychoacoustics in a way that it won't apply any lowpass filtering on any of the frames?


You mean without writing your own code to do so?

How to prevent lame from cutting the spectrum?

Reply #37
Hightype, just in case...
lame -V 0 --lowpass 22.5

How to prevent lame from cutting the spectrum?

Reply #38
Nevertheless, still there is lowpass filtering applied on some of the frames, due to psychoacoustics (sorry but I didn't read into this very much) - is there a way to finetune psychoacoustics in a way that it won't apply any lowpass filtering on any of the frames?
The whole point of using LAME and lossy encoding is to have strong psychoacoustic models to decrease the filesize while maintaining perceived fidelity. If you circumvent the models you will only get worse audio quality. I don't understand why you'd want that. If you're concerned about retaining the higher frequency content, LAME (or another psychoacoustic codec) is obviously the wrong choice. You'd likely be more happy with using FLAC, like saratoga already suggested, or using an MP3 encoder without psychoacoustic models, which will likely sound far worse than LAME.
It's only audiophile if it's inconvenient.

How to prevent lame from cutting the spectrum?

Reply #39
As for the 'why?' question I think it's rather a perfectionist thingy.

Decreasing audio quality is hardly perfectionist.

How to prevent lame from cutting the spectrum?

Reply #40
Quote
As for the 'why?' question I think it's rather a perfectionist thingy. While not audible, it is still comforting just to know that the full spectrum of the file is preserved and look at its spectrogram. I think most people who would like to do the same have the same reason.

It won't be comforting for me at all knowing that I sacrificed audio quality for a nice spectrogram image. If you are a perfectionist then you should use a lossless format such as FLAC like most people here suggested.

For a lossy format it is comforting for me to know that the encoder did its best with the limited bits to keep the quality as close as possible to the original. By doing whatever was necessary like throwing away things I would not be able to hear. More bits for other stuff.

How to prevent lame from cutting the spectrum?

Reply #41
In general, I'm aware of the fact that the very concept and purpose of MP3 is to compress audio by removing frequencies that are inaudible.
I'd like to reiterate that my point and goal is theoretical (or experimental), I'd like to 'push the envelope' in a way to see how much LAME is able to retain from the original spectrum, without applying any lowpass filter on any of the frames.
(Edit: my reasons for using LAME is the VBR option and also it seems to be the most widespread and compatible with most player software and hardware. Xing would be the other choice but its sound quality is not as good.)

Saratoga: well, if I'd be a coder, I'd probably already have solved this

Nastea: thanks for the tip! I'll see if it will work with older versions and will get back if it does.

How to prevent lame from cutting the spectrum?

Reply #42
In general, I'm aware of the fact that the very concept and purpose of MP3 is to compress audio by removing frequencies that are inaudible.


Erm, nope, you've misunderstood.

How to prevent lame from cutting the spectrum?

Reply #43
Nastea: looking into this, the problem with the --lowpass switch is that it only disables the 'global' polyphase lowpass filter, which is applied to the whole file.
Disabling this is not enough in itself because the psychoacoustic algorhythm that comes after this, still does lowpassing on certain frames (that are not too complex or contain only few highs).

My guess is that the 'ATH related' and 'PSY related' switches could be finetuned in a manner so that no lowpassing whatsoever is done. Since I'm not knowledgeable in these (and it's too complicated for me to start to learn/experiment with them), that's why I'm looking for advice or help from users who know how these work.

How to prevent lame from cutting the spectrum?

Reply #44
My guess is that the 'ATH related' and 'PSY related' switches could be finetuned in a manner so that no lowpassing whatsoever is done. Since I'm not knowledgeable in these (and it's too complicated for me to start to learn/experiment with them), that's why I'm looking for advice or help from users who know how these work.
Feel free to download the LAME sources and work on that. I doubt that someone will spend any development time to aid you in this completely pointless endeavour. But feel free to make an offer. I'd guess 4000-5000$ for two weeks of development time might be a good start, but it's really hard to tell, since I do not know about the complexity and necessary technical expertise.
It's only audiophile if it's inconvenient.

How to prevent lame from cutting the spectrum?

Reply #45
Well, it's not that important to cause controversy or anger. Maybe someone will come up with some solution in the future.

How to prevent lame from cutting the spectrum?

Reply #46
Have you looked at free format mp3? Perhaps that will do what you want.

How to prevent lame from cutting the spectrum?

Reply #47
PDQ: I did a quick test with other encoders but they don't seem to even come close to LAME in preserving the spectrum. Free format MP3 could very well do the job but it is reported to have compatibility issues (going over 320 kbps it's not hard to imagine). Thanks for the tip anyways.

How to prevent lame from cutting the spectrum?

Reply #48
Saratoga: well, if I'd be a coder, I'd probably already have solved this


This is a really weird thing to do, so the odds that anyone has written the code to make it happen are near zero.  I'd say take a look at a few other encoders, maybe one of them is close enough to what you want by chance (although I doubt you will get exactly what you're hoping for). 

Failing that, you'll have to start learning how to program.

How to prevent lame from cutting the spectrum?

Reply #49
Yep, got it. It also has the potential for abuse.