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 <p>--- >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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
On Tue, 18 May 2004, Adriano Almeida wrote:> How can I encode a mono file in 22050 and 44100?> ret=vorbis_encode_init_vbr(&vi,1,22050,.5) ;That's ok.> // uninterleave samples > for(i=0;i<bytes/2;i++) > { > buffer[0][i]=((readbuffer[i*2+1]<<8)| > (0x00ff&(int)readbuffer[i*2]))/32768.f; > }Ummm, that's also ok. Are you sure the problem isn't on the decoding end (i.e. a player that assumes stereo)? --- >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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
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? > > thanksYour 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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.