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: Is there any way to use the aac format to cut off only frequencies above 20 KHz? (Read 7122 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Is there any way to use the aac format to cut off only frequencies above 20 KHz?

I've already tested several formats, but they either don't cut above 20 KHz or cut below 20 KHz, like 16 KHz. I know that Opus does that. But I would like aac like that, with only frequencies equal to or less than 20 KHz. So that you don't waste bits with frequencies above that, as they are inaudible. For example, the aac apple encoder maintains all of them. If I only use up to 20KHz, I can have more bits at the most audible frequencies (20 Khz or less). Is there any way to create aac files like that? ;D

Re: Is there any way to use the aac format to cut off only frequencies above 20 KHz?

Reply #1
No sane lossy encoder is spending any bits above 20khz unless you are doing something wrong. They may emit some noise above 20k, but that isn't costing you bitrate.

Re: Is there any way to use the aac format to cut off only frequencies above 20 KHz?

Reply #2
Its also not really true to say that Opus cuts at 16kHz.  Assuming you give it a sensible number of bits, it encodes using frequencies from 3(?) to 20,000 Hz.  However it does allocate bits based on frequency bands, once of which is near 16kHz and upwards.  That top band usually gets a pretty sparse allocation, simply because most people can't hear at all and the ones that can hear it barely notice what it sounds like.

For AAC, the FDK encoder will do what you want with certain settings.  Other encoders I'm not sure.

Re: Is there any way to use the aac format to cut off only frequencies above 20 KHz?

Reply #3
Well, most formats will gradually increase the lowpass when the bitrate is increased.

The Lame mp3 encoder is well documented and you can see the lowpass for each settings here:
http://wiki.hydrogenaud.io/index.php?title=LAME#Recommended_settings_details

Qaac -V 91 produces files with a lowpass around 19khz and -V100 around 20khz.


I think Opus (and ogg vorbis?) is an exception though, it encodes the full spectrum even at low/medium bitrates. And sbr/he-aac codecs as well. :)

Re: Is there any way to use the aac format to cut off only frequencies above 20 KHz?

Reply #4
No sane lossy encoder is spending any bits above 20khz unless you are doing something wrong. They may emit some noise above 20k, but that isn't costing you bitrate.

I wouldn't say that. Many encoders are keeping full spectrum contents (22.05 KHz) when —very— high bitrate is requested by user. I get this results with: iTunes (TVBR max), FDKAAC (VBR max), FHGAAC (VBR max & CBR max), NeroAAC (VBR max), Vorbis (VBR max), MPC (VBR max). The encoders are sane but maybe the users aren't ;).
Formats like WavPack lossy, OptimFrog DualStream, lossyWAV also maintains spectrum but we know these formats are different (and high bitrate only).

Opus behavior is indeed different: it never keeps content higher than 20 KHz. There's a frequency cut-off at 20 KHz even at 500 kbps on stereo tracks. But is it really a good choice?

@Arlong13 > as Mark7 said, if you lower the bitrate a lowpass will appear with these encoders. Then you'll save some space and keep perceptual quality at the same time.

Re: Is there any way to use the aac format to cut off only frequencies above 20 KHz?

Reply #5
500 kbps on stereo tracks is often not enough to losslessly encode 0..20 kHz range, and >20kHz range is not possible to hear, so it kind of makes sense to spend bits on the hearable range until it's completely useless. 
There's also such a thing as generational loss. Spending bits on hearable range theoretically can reduce generational loss. Spending bits on >20kHz range is just that... nobody will hear it anyway (assuming normal playback speed).
a fan of AutoEq + Meier Crossfeed

Re: Is there any way to use the aac format to cut off only frequencies above 20 KHz?

Reply #6
500 kbps on stereo tracks is often not enough to losslessly encode 0..20 kHz range, and >20kHz range is not possible to hear, so it kind of makes sense to spend bits on the hearable range until it's completely useless. 
It makes some sense, yes.
On the other side, modern encoders start to become transparent at ~120 kbps (if not below). At ~200 kbps they should be fully transparent except maybe minor issues on very rare problem samples. At 250…300 kbps those minor issues are solved. So what's the point of using 250 additional kbps and still remove original frequencies? Making more transparent what already transparent is? There's also no audible benefit on it.
To be honest, I don't see many people using 512 kbps lossy encoding for Red Book content. And if such people exists, I'm pretty sure many of them will take a look on a spectral analysis. For me it makes more sense to keep 20…24KHz content at higher bitrate when transparency is already reached and secured than increasing quality below when nobody can hear it or simply see it.

Quote
There's also such a thing as generational loss. Spending bits on hearable range theoretically can reduce generational loss. Spending bits on >20kHz range is just that... nobody will hear it anyway (assuming normal playback speed).
Theoretically, yes.
I made long ago a re-coding test, and LAME MP3 was the worst basis for that task:
https://hydrogenaud.io/index.php?topic=32440.0
There was a debate about frame boudaries and quality while re-coding to MP3. For that reason I'm sure that other factors exists for maintaining quality on generational loss.

Re: Is there any way to use the aac format to cut off only frequencies above 20 KHz?

Reply #7
Quote
So that you don't waste bits with frequencies above that, as they are inaudible.
The main idea behind perceptual encoding (AAC & MP3, etc.) is to throw-away things you can't hear but it's a LOT more advanced than simply throwing-away the highest frequencies. 

The programmers have done a lot of testing and the default settings usually do the best job with most program material.

Re: Is there any way to use the aac format to cut off only frequencies above 20 KHz?

Reply #8
What I think is like opus works. Let's compare 320 kbps for example, If one file called A has this bitrate limited to 20 KHz and another file called B also 320 kbps limited for 22,5 KHz, the first file will have more audible quality, because the A file don't is spending bits above of 20 Khz. The opus is the file A, and the apple aac encoder is the file B. My question is: There is a way to encoder aac files into 320 kbps limited to 20 Khz? Sorry for the bad english, I'm not a native.

Re: Is there any way to use the aac format to cut off only frequencies above 20 KHz?

Reply #9
Let's compare 320 kbps for example, If one file called A has this bitrate limited to 20 KHz and another file called B also 320 kbps limited for 22,5 KHz, the first file will have more audible quality, because the A file don't is spending bits above of 20 Khz.

I doubt either encoder is spending any bits at all on frequencies above 20 kHz.

My question is: There is a way to encoder aac files into 320 kbps limited to 20 Khz? Sorry for the bad english, I'm not a native.

See if your encoder has a lowpass filter option.

Re: Is there any way to use the aac format to cut off only frequencies above 20 KHz?

Reply #10
What I think is like opus works. Let's compare 320 kbps for example, If one file called A has this bitrate limited to 20 KHz and another file called B also 320 kbps limited for 22,5 KHz, the first file will have more audible quality, because the A file don't is spending bits above of 20 Khz.
No, audible quality won't increase. At 320 kbps it's already transparent. A and B will sound the same.

Re: Is there any way to use the aac format to cut off only frequencies above 20 KHz?

Reply #11
What I think is like opus works. Let's compare 320 kbps for example, If one file called A has this bitrate limited to 20 KHz and another file called B also 320 kbps limited for 22,5 KHz, the first file will have more audible quality, because the A file don't is spending bits above of 20 Khz. The opus is the file A, and the apple aac encoder is the file B. My question is: There is a way to encoder aac files into 320 kbps limited to 20 Khz? Sorry for the bad english, I'm not a native.
I have a bit more time to answer.
Let's do the same comparison, but at 80 kbps with a imaginary modern lossy perceptual format we will call OPAAC format).
File A: 80 kbps opaac with lowpass at 16 KHz
File B: 80 kpbs opaac with lowpass at 22.05 KHz

File A is good but not transparent. It's quite easy to ABX on many samples.
File B is audibly worse: it spends extra bitrate on inaudible spectrum; it tries to maintain high frequency when possible which lead to ringing or other artifacts, etc…
So what happens? Opaac developer will set by default a lowpass to 16 KHz for 80 kbps encoders and will progressively increase the lowpass with bitrate/quality inflation.

There is no need to reinvent the wheel: many developers spent several years on tweaking their encoders. They are usually highly tuned. A basic approach like yours (no offense meant) is unlikely to work because if it would work it would already be implemented.
So if an encoder keeps the full frequency spectrum at a certain bitrate it's likely because a different bitrate allocation (focused on audible spectrum only) won't bring any audible improvement.

Re: Is there any way to use the aac format to cut off only frequencies above 20 KHz?

Reply #12
No sane lossy encoder is spending any bits above 20khz unless you are doing something wrong. They may emit some noise above 20k, but that isn't costing you bitrate.

I wouldn't say that. Many encoders are keeping full spectrum contents (22.05 KHz) when —very— high bitrate is requested by user. I get this results with: iTunes (TVBR max), FDKAAC (VBR max), FHGAAC (VBR max & CBR max), NeroAAC (VBR max), Vorbis (VBR max), MPC (VBR max). The encoders are sane but maybe the users aren't ;).
Formats like WavPack lossy, OptimFrog DualStream, lossyWAV also maintains spectrum but we know these formats are different (and high bitrate only).

Opus behavior is indeed different: it never keeps content higher than 20 KHz. There's a frequency cut-off at 20 KHz even at 500 kbps on stereo tracks. But is it really a good choice?

@Arlong13 > as Mark7 said, if you lower the bitrate a lowpass will appear with these encoders. Then you'll save some space and keep perceptual quality at the same time.

Hello, I converted a song from itunes and dbpoweramp to AAC, while it encodes 20khz and above completely in itunes, it does not encode 20khz and above in dbpoweramp, it seems to me that I encode with itunes has better quality.
However , itunes is difficult to use compared to other programs , is there a simple program that encodes up to 22khz ?

https://i.hizliresim.com/5uu9bwj.png


https://i.hizliresim.com/rg8mg4c.png

Re: Is there any way to use the aac format to cut off only frequencies above 20 KHz?

Reply #13
Quote
Hello, I converted a song from itunes and dbpoweramp to AAC, while it encodes 20khz and above completely in itunes, it does not encode 20khz and above in dbpoweramp, it seems to me that I encode with itunes has better quality.

Here at HydrogenAudio we DO NOT judge sound quality by looking at spectrograms.     We judge sound quality by listening,    You can have a pretty spectrum and bad sound.   

Please see TOS #8.

Looking at the spectrum is an easy way to sometimes see some of the effects of lossy compression but it usually doesn't show what's important to the sound.    It's a common mistake in statistics and data analysis...     Looking at what's easy to measure instead of looking at (or in this case listening to) what's important.  

I think I'm repeating what was said above but with lossy compression information is being thrown-away to make a smaller file.   You have a limited number of bits-per-second and those limited-valuable bits shouldn't be wasted on sounds that are above the hearing range. *  

But, it's more complicated than that because even if you can hear to 20kHz in a hearing test, with music those highest frequencies are normally masked (drowned out) by slightly-lower frequencies.   Perceptual encoders like MP3 and AAC analyze the sound moment-to-moment and they try to throw-away sounds that are masked while keeping the sounds you can actually hear.  

At most settings MP3 takes a "shortcut" and instead of carefully analyzing the masking above 16kHz, it just filters them out.   And it seems to work!    In cases where people hear MP3 compression artifacts at high bitrates, it's NOT the loss of high frequencies that they hear.    (I don't think AAC does that.)


*  Some encoders may be able to keep some high frequency information without "wasting bits", maybe without worrying about the accuracy/quality of those high frequencies, but I don't know those details.

Re: Is there any way to use the aac format to cut off only frequencies above 20 KHz?

Reply #14
AAC can employ https://wiki.hydrogenaud.io/index.php?title=Perceptual_Noise_Substitution
The idea is that - at least in the presence of music - high-frequency hiss sounds like high-frequency hiss. A library of "only a few" hisses can cover the top frequency range in a lot of musical signals.

Those can go beyond human hearing without "any" cost in terms of bitrate.

Re: Is there any way to use the aac format to cut off only frequencies above 20 KHz?

Reply #15
Yes with the command line with qaac. You need use
Code: [Select]
--lowpass 20000
for cut frequencies above 20kHz.

Unfortunately it isn't able in Mac with afconvert

I tell that if someone don't know that, you will need to install itunes for qaac works.

Re: Is there any way to use the aac format to cut off only frequencies above 20 KHz?

Reply #16
--lowpass 20000 means that qaac will remove audio above 20000 Hz.
But it doesn't mean that the encoder won't remove audio below 20000 Hz.

Re: Is there any way to use the aac format to cut off only frequencies above 20 KHz?

Reply #17
--lowpass 20000 means that qaac will remove audio above 20000 Hz.
But it doesn't mean that the encoder won't remove audio below 20000 Hz.

Yes, I know, if someone reads the complete documentation of qaac, it tells that first apply the low pass filter and then it encodes, I tested many years ago with Yanni Truth of Touch and these files filtered was bigger than no filtered.

Also I tried with audacity high-pass filter and the files has minimum changed storage size. I tried emulate the pass-band filter from MP3 LAME.