[vorbis-dev] encode example
Michael Smith
msmith at xiph.org
Tue May 18 18:06:42 PDT 2004
On Wednesday 19 May 2004 05:45, Adriano Almeida wrote:
> Hi,
> I am testing the encoder example and I have a question about it... How can
> I encode a mono file in 22050 and 44100? I've changed the init values to:
> ret=vorbis_encode_init_vbr(&vi,1,22050,.5) ;
>
> and in the loop:
> // uninterleave samples
> for(i=0;i<bytes/2;i++)
> {
>
> buffer[0][i]=((readbuffer[i*2+1]<<8)|(0x00ff&(int)readbuffer[i*2]))/32768.f
>; }
>
> .. what happened is that my file came 2x accelerated (originalsamples/2).
> Why this happened?
>
> thanks
Your code looks fine. However: are you sure your input file is a 22050 Hz mono
file? This sounds like you're encoding the same (44100 Hz) audio, but you're
telling libvorbis that it's 22050 Hz. You'll need to resample it before
submitting to libvorbis if you want that to work.
Mike
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Vorbis-dev
mailing list