Maybe you know this and maybe not, but I've found constant delay of positive 18 ms, when converting wav 48khz to AC3.
I've reported it to Dolby and they confirm they found it at their lab as well. The only remedey they could offer me is to make changes to the audio files, prior the encode process (hence make negative delay of 18ms at the begining of the audio file and aboid placing any information at least 40ms before the end of the file).

I've made an audio test file. Took 4 sec Stereo Wave 16bit 48Khz - inserted 3 tones for 40ms each time along the file:

00:00:00:000 - 00:00:00:040 Tone (40ms length)
00:00:00:040 - 00:00:02:000 Silence
00:00:02:000 - 00:00:02:040 Tone (40ms length)
00:00:02:040 - 00:00:03:960 Silence
00:00:03:960 - 00:00:04:000 Tone (40ms length)

I've took the Wave file and put it in Apple A.Pack and in Soft Encode 1.0 - Dolby Digital 5.1 and encoded stereo AC3 with the default preset, and here what I've got:

00:00:00:000 - 00:00:00:018 Silence
00:00:00:018 - 00:00:00:058 Tone
00:00:00:058 - 00:00:02:018 Silence
00:00:02:018 - 00:00:02:058 Tone
00:00:02:058 - 00:00:03:978 Silence
00:00:03:978 - 00:00:04:000 Tone

As you can see:

a. Everything shifted 18ms forward.
b. The last tone appears for only 22ms instead of 40ms (because of the general shift).

It's very weird cause it happens with 2 different encoders on 2 different computers and OS. The question is, if the delay is native to this technology, why isn't there any automatic compensation or a tool which allow me to set a delay fix?
But as I've mentioned before, even Dolby wasn't aware to this problem.

If you want to 'play' with it and test it for you self, you can take my samples. I've attached the "before" wave file and the "after" AC3 file for you to examine.
If you have any problem download the attachment from Doom9's forum, you can try download it from this link:
http://s54.yousendit.com/d.aspx?id=3...M0AAGME9P6Q8V8

Lior

audio_delays_in_ac3.zip