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: What is decoder delay? And why? (Read 3810 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

What is decoder delay? And why?

http://en.wikipedia.org/wiki/Gapless_playback
http://wiki.hydrogenaudio.org/index.php?title=Gapless

I've been working on the articles above, but there's one thing I don't understand that's missing from the articles.

What is decoder delay, and why does it occur? I've seen kode54 mention that it's usually 529 samples for MP3, but I'm afraid I don't have a firm grasp of the idea.

Thank you in advance.

What is decoder delay? And why?

Reply #1
I may be completely wrong on this, but I think it's because of the use of FFT's and other related things that need data "in front of and behind" the area being analyzed. The encoder thus puts a small bit of silence at the beginning and end of the audio to pad out the file so all the original audio gets encoded properly.


What is decoder delay? And why?

Reply #3
Ah, sorry, was thinking only about the encoder.  I think the decoder delay of 529 samples is because the decoder outputs audio data after processing whole frames. Thus during the first frame of data it just outputs silence. LAME compensates for the encoder and decoder delay which is how it does gapless decoding.

What is decoder delay? And why?

Reply #4
Quote
Ah, sorry, was thinking only about the encoder.  I think the decoder delay of 529 samples is because the decoder outputs audio data after processing whole frames. Thus during the first frame of data it just outputs silence. LAME compensates for the encoder and decoder delay which is how it does gapless decoding.
[a href="index.php?act=findpost&pid=347757"][{POST_SNAPBACK}][/a]

If it were a full frame of silence, it would be 1152 samples.

What is decoder delay? And why?

Reply #5
Ah, found it:

Quote
DECODER DELAY AT START OF FILE:

All *decoders* I have tested introduce a delay of 528 samples.  That
is, after decoding an mp3 file, the output will have 528 samples of
0's appended to the front.  This is because the standard
MDCT/filterbank routines used by the ISO have a 528 sample delay.  It
would be possible to write a MDCT/filterbank routine with a 0 sample
delay (see description of Takehiro's MDCT/filterbank routine used in
LAME encoding below) but I dont know that anyone has done this.
Furthermore, because of the overlapped nature of MDCT frames, the
first half of the first granule (1 granule=576 samples) doesn't have a
previous frame to overlap with, resulting in attenuation of the first
N samples.  The value of N depends on the window type.  For
"STOP_TYPE" and "SHORT_TYPE", N=96, while for
"START_TYPE" and "NORMAL_TYPE", N=288.  The first frame produced by
LAME 3.56 and up will always be of STOP_TYPE or SHORT_TYPE.
[/url]