Speex Codec Delay Problem

Thilo Köhler <[email protected]> 10 Apr 2012 22:07:20 +0200
Newsgroups gmane.comp.audio.compression.speex.devel
Message-ID <[email protected]>
Hello All!

SPEEX introduces an additional delay to the audio data,
I found out by reverse enginiering (it is NOT the lookahead time):

narrow band : delay = 200 - framesize + lookahead = 200 - 160 +  40 =  80
samples 
wide band   : delay = 400 - framesize + lookahead = 400 - 320 + 143 = 223
samples
uwide band  : delay = 800 - framesize + lookahead = 800 - 640 + 349 = 509
samples

To get the timing right, you must skip those samples before you get the
actual audio
data you have feeded into the codec.
Or, better, feed the encoder with (framesize - delay) dummy samples first,
throw away
the entire first frame, and continue encoding. This avoids that the first
data you feed in must 
share its bits with the preceeding zeros, and you get a more compact
encoding.
(this might matter if you have a lot of short samples).

This all sounds like a bad hack, and actually it is. What do the auhtor(s)
of SPEEX think,
can this be considered as a bug and be fixed?

I ran into this problem and it took me a while to work around it, and I can
observe
on the internet that other people have problems with this too.
If you encode 1000 samples, and then decode 1000 samples, you expect
to get the same 1000 samples back.
 (or, if the codec is lossy, an approximation)

Regards,

Thilo


On 10.04.2012, you wrote:
> Send Speex-dev mailing list submissions to
>   [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
>   http://lists.xiph.org/mailman/listinfo/speex-dev
> or, via email, send a message with subject or body 'help' to
>   [email protected]
>
> You can reach the person managing the list at
>   [email protected]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Speex-dev digest..."
>
>
> Today's Topics:
>
>    1. (no subject) (Bush Josh)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 10 Apr 2012 05:59:42 +0100
> From: Bush Josh <[email protected]>
> Subject: [Speex-dev] (no subject)
> To: <[email protected]>, <[email protected]>, <[email protected]>,
>   <[email protected]>, <[email protected]>,
>   <[email protected]>, <[email protected]>,
>   <[email protected]>, <[email protected]>
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset="iso-8859-1"
>
>
> 
>
http://www.bbqol-tr.com/wp-content/themes/timecrunch/rytj.html?mg=ghy.jng&amf=fh.msg&gsyj=uylp
>                      -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
>
http://lists.xiph.org/pipermail/speex-dev/attachments/20120410/c73280ab/attachment-0001.htm
>  
> ------------------------------
>
> _______________________________________________
> Speex-dev mailing list
> [email protected]
> http://lists.xiph.org/mailman/listinfo/speex-dev
>
>
> End of Speex-dev Digest, Vol 95, Issue 4
> ****************************************
> 

Regards,

Thilo Koehler
--