[vorbis] Streaming audio to the waveout device
Stan Seibert
volsung at mailsnare.net
Fri Oct 17 17:42:48 PDT 2003
On Fri, 2003-10-17 at 18:08, Agustin Cordes wrote:
> The reason I mentioned the bitrate was because of this comment on the
> official decoding example:
>
> /* we don't bother dealing with sample rate changes, etc, but you'll
> have to*/
>
> But now that you explained what ov_instant_bitrate() I understand I
> shouldn't bother with it. About the things you mention:
Yeah, sample rate is different than bitrate. The reason for that
warning is that the spec explicitly permits several logical Vorbis
bitstreams to be chained together. So you might be playing a 44100 Hz
stereo file, and then you get to the next link and it becomes 22050 Hz
mono. Note that oggenc doesn't produce files like this, but you can
make them by putting two files together, one after the other.
<p>> * I'm not checking the ov_read() return value. In fact, I'm using a
> fixed value for the packets I stream to the waveout device, but it seems
> their size may vary. I will check this out.
This is almost certainly the problem. ov_read() is only partially
filling the buffer you pass to it, so when you play to waveout, you are
sending some actual samples, plus some garbage at the end. (Whatever
was left in the buffer that ov_read() didn't write to.)
> The garbled audio sounds very much like gaps. It looks like the
> ov_read() ret value might be it. The thing that puzzles me is that if I
> encode a file with CBR it works great but when I encode the same file
> with VBR it doesn't.
With CBR, you must be getting Vorbis packet sizes that are close to the
size you request. (This would be accidental. Nothing significant about
it.) In VBR, the packet size varies much more, so the problem becomes
more noticeable.
---
Stan Seibert
<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-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
mailing list