[Speex-dev] Speex granulepos definition

Conrad Parker conrad at metadecks.org
Mon Jun 20 17:16:50 PDT 2005


On Sun, Jun 19, 2005 at 08:07:50PM -0400, Jean-Marc Valin wrote:
> Hi Ralph,
> 
> What speexenc does (Speex itself does not know about Ogg) is that it gives
> packet N the granulepos "N*frame_size - lookahead". In the case of narrowband,
> the first frame would have granulepos "1*160 - 80", so 80. I can't say about
> your example because Speex cannot encode a frame of one sample, which is a good
> thing becuse otherwise, the granulepos would be -79. BTW, the reason for the "-
> lookahead" is that it allows gapless playback (because the first samples in the
> first frame are zeros). Hope that clarifies things (and doesn't break too much
> stuff).

so is the following correct, for the example you gave (narrowband):

1) decoding the first packet produces 80 samples, and it has a granulepos
of 80.

2) decoding any subsequent packet produces 160 samples, and has a
granuelpos "N*160 - 80"

?

Conrad.


More information about the Speex-dev mailing list