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 29434 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How to prevent lame from cutting the spectrum?

Reply #50
A: My JPEGs sound weird. How to fix?
B: You can try to XYZ, but your images will actually look worse.
A: Yes, but I want my JPEGs to sound good. I am a perfectionist.

Same principle; equally absurd.

How to prevent lame from cutting the spectrum?

Reply #51
FYI. my goal had nothing to do with preserving so-called 'spectrogram images' (popularized in the '90s & early 2000s by experimental electronic musicians), even though in theory the more accurate a compressed file's FFT image is, the more gets preserved from such images... (but this is way off topic)

How to prevent lame from cutting the spectrum?

Reply #52
even though in theory the more accurate a compressed file's FFT image is, the more gets preserved from such images...


This is kind of, true, but its a pretty dumb way to think about it.  You can't really judge the accuracy of an FFT from the image of the log of the intensity.  You've already thrown away 99% of the information before you even begin, and the part you keep isn't necessarily the most relevant. 

How to prevent lame from cutting the spectrum?

Reply #53
The best way to preserve extremely high frequencies with lame is to use a very high lowpass value, as was said before. This prevents the a priori cut-off in the encoding process.
Sure the encoding processes itself eliminates part of the spectrum, everywhere in the spectrum. It's its very purpose. This is much more of concern with frequencies which are audible well, not at the high end of the spectrum. Adressing this feature as a frequency cut-off process is wrong thinking. Instead it is a process which potentially covers every frequency (including the high end of course).
The losses at the high end are just more easily to see in a spectogram, chance for audibility of these losses however is much lower compared to the bulk of frequencies containing musical content.
So you're looking at the wrong thing and thinking of the wrong thing only because it's easy to have a look at it.
 
But if you insist in optically keeping the extreme high end: the lossyWAV compressing mechanism doesn't use the extreme high end of the spectrum and doesn't use a lowpass at all, AFAIK. The overall procedure might still affect the high end though (not sure about it).
So you might give lossyWAV (followed by FLAC) a try. A great intelligent encoding scheme anyway.
lame3995o -Q1.7 --lowpass 17

 

How to prevent lame from cutting the spectrum?

Reply #54
FWIW, lossyWAV can only affect the noise level in the high-end, which is likely to be essentially invisible on a spectrogram. I never filters frequencies out of the audio, just reduces the bit-depth smartly so should look essentially identical on a spectrogram. The -X setting even achieves less than 320 kbps typically.

Regarding the OP, I understand most of what you want. I think you want MP3 for the utmost in compatibility, you want LAME to encode it for about the best quality and perhaps for gapless support, yet desptie its inaudibility you also want a spectrogram that looks like the original CD's for some warm fuzzies in your heart and will accept the potential for harming audio quality slightly in rare circumstances in return.

Essentially, you want to retain the high-frequencies coarsely but to waste relatively few bits on encoding them as they are inaudible and don't need to be accurately reproduced. No developer is likely to modify the psychoacoustic model to provide this purely visual feature to an MP3 encoder unless they have a "business case" for it in attempting to sell it to gullible audiophools.

The way to reduce bit-wastage on high frequencies in LAME is to use the -Y switch (search the Knowledgebase Wiki). This still allows accurate encoding of 0-16kHz material which is what matters to the sound in almost all real music. It allows the psychoacoustic model to represent the higher frequencies much more coarsely, which should be inaudible in the vast majority of real music, thereby avoiding the huge waste of bits normally required, but it will just lower the precision, which will rarely cause holes in the spectrogram or a visible change in spectrogram intensity or colour.

Test this setting:
lame -V 0 -Y --lowpass 22.05
and see how it "looks". (or 22.5 maybe, if allowed)

Also, there were changes to the VBR algorithm in LAME 3.98 / 3.99 / 3.100 so you could try LAME 3.97 which is also a very good encoder just in case it might not be quite as clever at omitting inaudible high frequencies when available bitrate is restrictive and thus cause dips in the visible spectrogram.

Doing this will hopefully only degrade sound quality significantly on really hard problem samples - maybe fatboy (Kalifornia) and few others where 320kbps bitrate is too limiting and will otherwise just cause higher bitrates in exchange.
Dynamic – the artist formerly known as DickD