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: AAC frame lengths (Read 12159 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

AAC frame lengths

Hello. Does AAC support frame lengths other than the longest and shortest ones? If yes, which exact frame lengths are supported?


Re: AAC frame lengths

Reply #2
Standard AAC-LC only supports two lengths.  Some of the oddball extensions supported others, although they're effective depreciated at this point.  See here for the allowed lengths:

https://github.com/gypified/libfaad/blob/200ac175e58e5703385d6c9c104d54c9247d8a67/libfaad/mdct.c#L62

Thanks, but what about HE-AAC v1/v2 and xHE-AAC?

But I wonder why they did not include intermediate lengths such as 256 / 240 samples and 512 / 480 samples, does anyone have an idea about that?

Re: AAC frame lengths

Reply #3
The link above is for an HEv1/v2 compatible decoder.  No idea about xHE (USAC).

Normal transform codecs support two transform lengths at a time, so that is what AAC provides.  The WMA codecs were the only ones I am aware of that has supported more than 2 lengths in the same file, and 25 years later that idea seems to have been forgotten along with WMA. 


Re: AAC frame lengths

Reply #4
The link above is for an HEv1/v2 compatible decoder.  No idea about xHE (USAC).

Normal transform codecs support two transform lengths at a time, so that is what AAC provides.  The WMA codecs were the only ones I am aware of that has supported more than 2 lengths in the same file, and 25 years later that idea seems to have been forgotten along with WMA. 



I couldn't understand what the link gives. But, do you have an idea about why normal transform codecs support two transform lengths at a time?

Re: AAC frame lengths

Reply #5
The shorter length is used to handle transients while the longer length is used to improve resolution on non-transient blocks.  WMA added various lengths, probably to try and optimize that trade off, but it didn't use the additional sizes that much and newer codecs haven't adopted that approach so presumably it isn't that effective.

Re: AAC frame lengths

Reply #6
I think it would be better to include intermediate lengths for semi-transient signals, is it possible to modify AAC to support intermediate lengths (2x and 4x considering the shortest one is 1x, or maybe 3x and a time-domain mode)?

I mean, there is too much difference between sizes of long and short frames...

Also, I think it would be better to define 1x as 96, 112, 128, and 144 samples (or 96 and 144 samples if there's not enough space for 4 variations). And, I think supporting arbitary bitrates is not a good thing and it would be better if only 16 bitrates were supported (but these bitrates should have been selected more wisely than in MP3).

Re: AAC frame lengths

Reply #7
Dun, dun, dun!

And that based on which psychoacoustic model??
• Listen to the music, not the media it's on
• The older, the 'lossier'


Re: AAC frame lengths

Reply #9
I think it would be better to include intermediate lengths for semi-transient signals, is it possible to modify AAC to support intermediate lengths (2x and 4x considering the shortest one is 1x, or maybe 3x and a time-domain mode)?

You can always stick to WMA. 

Re: AAC frame lengths

Reply #10
I think it would be better to include intermediate lengths for semi-transient signals, is it possible to modify AAC to support intermediate lengths (2x and 4x considering the shortest one is 1x, or maybe 3x and a time-domain mode)?

You can always stick to WMA. 

But I found that AAC is more efficient than WMA. Also, WMA creates noise in some bitrate-samplerate combinations and I don't like that.

Re: AAC frame lengths

Reply #11
Dun, dun, dun!

And that based on which psychoacoustic model??

Sorry, I couldn't understand you, can you explain a little more @includemeout ?
What I meant is that, as you know, MDCT/sub band-based lossy codecs are wild beasts built from the ground up around specific psychoacoustic models.

In fact, this community abounds with cases where even tweaking their settings excessively has been proven to wreak havoc on audio quality and end up causing more problems than the initial ones they were meant to solve - and I'm as guilty as the next guy for having tried a couple dozens of them - ugh! including -r3mix for MP3 and -mnt for customizing MPC's noise shaping back in 2001/02 and such and such.

So, I'm not trying to be disrespectful and doubt your programming skills and what-not, but what makes you think such changes won't be, for starters, an uphill task and that they will end up improving a codec as established as AAC?

• Listen to the music, not the media it's on
• The older, the 'lossier'

Re: AAC frame lengths

Reply #12
Some people here are confusing frame lengths with block lengths. In AAC, frames are always 1024 (or 960) samples long, or twice these values when SBR is used.

In MPEG-H Audio's AAC-like core, I've added an intermediate 2x512 block length (with low window overlap) between the 1x1024 (for quasi-stationary waveform parts) and 8x128 (for transient parts). The benefit was, indeed, quite small.

Chris
If I don't reply to your reply, it means I agree with you.

Re: AAC frame lengths

Reply #13
Dun, dun, dun!

And that based on which psychoacoustic model??

Sorry, I couldn't understand you, can you explain a little more @includemeout ?
What I meant is that, as you know, MDCT/sub band-based lossy codecs are wild beasts built from the ground up around specific psychoacoustic models.

In fact, this community abounds with cases where even tweaking their settings excessively has been proven to wreak havoc on audio quality and end up causing more problems than the initial ones they were meant to solve - and I'm as guilty as the next guy for having tried a couple dozens of them - ugh! including -r3mix for MP3 and -mnt for customizing MPC's noise shaping back in 2001/02 and such and such.

So, I'm not trying to be disrespectful and doubt your programming skills and what-not, but what makes you think such changes won't be, for starters, an uphill task and that they will end up improving a codec as established as AAC?



I think 1024/960 samples is too long and 128/120 samples is too short for some sounds. I think having an intermediate length will make a big benefit.

Some people here are confusing frame lengths with block lengths. In AAC, frames are always 1024 (or 960) samples long, or twice these values when SBR is used.

In MPEG-H Audio's AAC-like core, I've added an intermediate 2x512 block length (with low window overlap) between the 1x1024 (for quasi-stationary waveform parts) and 8x128 (for transient parts). The benefit was, indeed, quite small.

Chris

Thanks for solving my confusement. But I want to ask that why you added just one intermediate value @C.R.Helmrich ? Even if only 2 bits are used for giving the block length, this adds enough space for 2 intermediate values. Also, what does "with low window overlap" means? And, what is MPEG-H and how can I get it?

Also, I wonder why these block lengths are selected (and no intermediate values are added) and especially why 1024 and 960 samples are selected as frame lengths (they have a very small difference between them, so why not for example 1024 and 768?).

Re: AAC frame lengths

Reply #14
Also, I wonder why these block lengths are selected (and no intermediate values are added) and especially why 1024 and 960 samples are selected as frame lengths (they have a very small difference between them, so why not for example 1024 and 768?).

Frames are basically the packets of compressed data that go into the encoder.  The 960 size is (i think?) only used by some digital radio standards, and I believe they wanted exactly 960 so that AAC streams would fit into the frame size of the previous MP2 standard which is also used in digital radio.  They wanted the small difference so it would be a close to normal AAC with 1024 samples as possible and 960 was the closest value that fit both requirements. 

Re: AAC frame lengths

Reply #15
Also, I wonder why these block lengths are selected (and no intermediate values are added) and especially why 1024 and 960 samples are selected as frame lengths (they have a very small difference between them, so why not for example 1024 and 768?).

Frames are basically the packets of compressed data that go into the encoder.  The 960 size is (i think?) only used by some digital radio standards, and I believe they wanted exactly 960 so that AAC streams would fit into the frame size of the previous MP2 standard which is also used in digital radio.  They wanted the small difference so it would be a close to normal AAC with 1024 samples as possible and 960 was the closest value that fit both requirements. 

Thanks, then I think it would be better if they were selected 1280 samples as the longer value. In my idea, the possible block lengths will be [120,240,480,960] for the short mode and [160-320-640-1280] for the long mode, and this would also make getting the sound color of MP3 easier as there's a little difference between 160&192 and 640&576. How can I increase the possibility of introduction of a new (enhanced) AAC variation that uses my idea and some other improvements? (This would not be something like HE-AAC, this would be a variation of LC-AAC and this variation would also have HE-AAC v1&v2 and xHE-AAC profiles too. I think the best way to indicate this variation is making the last bit of the sync word zero, just like MP3 does with MPEG-2.5 mode. Further clarifying: the low-complexity profile of this mode would have a complexity that is very similar to the low-complexity profile of the standard AAC, and the HE v1&v2 and xHE profiles of this variation would use the same improvements (SBR, SBR+PS, Enhanced SBR+PS) as the HE v1&v2 and xHE profiles of the standard AAC.)

Re: AAC frame lengths

Reply #16
You can design a new audio compression format that works however you. You're about 30 years too late to influence how AAC works though, so not much you can do there without a time machine.

Re: AAC frame lengths

Reply #17
You can design a new audio compression format that works however you. You're about 30 years too late to influence how AAC works though, so not much you can do there without a time machine.

Thanks, but I realized that if the same frame sizes are used for all sample rates then frames of a 8kHz stream would be as long as (at least roughly) 6 times of frames of a 48kHz stream, right? Does AAC use the same frame sizes for all sample rates? If not, which frame sizes are used for which sample rates?

Re: AAC frame lengths

Reply #18
Some codecs change the transform block size with sampling rate, but as far as I know there is no way to do that with AAC. 

Re: AAC frame lengths

Reply #19
Some codecs change the transform block size with sampling rate, but as far as I know there is no way to do that with AAC. 

Thanks. (I asked this to ChatGPT before you answer just for curiosity and it gave a weird table, but I trust people in this forum while I don't trust ChatGPT at all.)


Re: AAC frame lengths

Reply #21
AC-4 have various frame lengths that  change with sample rate.

Re: AAC frame lengths

Reply #22
You can design a new audio compression format
Please let that person first start with a for-loop. Then we talk.

Why do you think I can't write code? I can write basic things in C++, JavaScript, and ActionScript (I learned them in this order with C++ and JavaScript being at a very small age).

AC-4 have various frame lengths that  change with sample rate.

Thanks.

Re: AAC frame lengths

Reply #23
Then you probably know there's much more to programming (abstraction, problem-solving...) than just coding/writing scripts.

Naturally, don't take my word for it: read posts - old and new - by proper developers like David Bryant, Gabriel Bouvigne, Nick.C, Peter etc. to see what I mean.

Edit: Is it only me who thinks this thread's dragged itself for way longer than it should?
• Listen to the music, not the media it's on
• The older, the 'lossier'

Re: AAC frame lengths

Reply #24
Then you probably know there's much more to programming (abstraction, problem-solving...) than just coding/writing scripts.

Naturally, don't take my word for it: read posts - old and new - by proper developers like David Bryant, Gabriel Bouvigne, Nick.C, Peter etc. to see what I mean.

Edit: Is it only me who thinks this thread's dragged itself for way longer than it should?

I know. And, you're right for the last sentence. Thanks.