[Vorbis-dev] decoding vorbis bytes into floats

Gunter Königsmann gunter at peterpall.de
Thu Oct 3 00:09:16 PDT 2013


The last time I had I decode ogg the source code of oggdec did nearly read like documentation. If I remember it right it basically ran a batch of initialization functions from libogg and libvorbis (the first three packets are the header containing the info that the file uses the vorbis codec, the metadata and everything the vorbis codec needs to know in order to to decode the data; Libogg's task is to divide the steam into packets). After the decoder has been informed about the header it can decide any packet libogg will output. You can even leave out any number of packets or throw in a "end-of-file" packet followed by a new header at any time.

If you write the encoder as well there is one thing I would ask you to ask: there is a so-called granulepos field in every packet telling how much time has passed since the beginning of the steam to help with seeking. The unit this information is given in is basically irrelevant. It might be milliseconds, samples or something similar. But it has to steadily increase all the time or else some players will crash - or get lost when attempting to seek in the steam.

Kind regards

Gunter.



Andy Martin <zippo227 at gmail.com> schrieb:
>I would like to program a basic OGG decoder that takes in an array of 
>bytes (unsigned char *) and return an array of floats. Presumably I 
>could then pass these floats to be read as PCM data which can be 
>immediately interpreted as audio (by Unity3D). The starting point would
>
>be the header of an icecast stream (I know I'm not in the icecast 
>mailing-list, but that is only the basic starting point). From then on,
>
>I would be dumping raw ogg bytes into this function and returning 
>floats. I am working in the games industry using C++ and C# every day, 
>but I have less experience than I would like using open-source
>libraries.
>
>Presently, I can get a continuous stream of bytes of OGG from an 
>asynchronous HttpWebRequest through C#. I want to pass those bytes into
>
>the function that I'm describing. Shouldn't I be able to pass any
>random 
>sequence of bytes into this function and get some kind of float pattern
>
>that can be read as PCM (thought it may sound awful if it is truly a 
>random array of bytes)?
>
>For those interested, my starting point is a Windows8 machine with 
>Visual Studio, but I would eventually like to port the project to
>XCode.
>
>As I read the Vorbis documentation, I find it very difficult to find a 
>place to start. What are the significant traits of the important 
>libraries, ogg and vorbis, and how do they work together? What are the 
>steps I need to follow, and where can I get more information than the 
>documentation has? I probably just need to chat with someone who really
>
>knows what they're doing, but, the people I know used JUCE. They've
>used 
>the JUCE library to do something like this, but I would like to do a 
>straight-forward use of the open-source XIPH libraries.  There are many
>
>warnings about not using the low-level API, and most of the links on 
>xiph.org are for pre-existing ogg players instead of source code for 
>making your own player.
>
>I really appreciate any help and am open to get on the group chat at 
>some point.
>_______________________________________________
>Vorbis-dev mailing list
>Vorbis-dev at xiph.org
>http://lists.xiph.org/mailman/listinfo/vorbis-dev

-- 
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/vorbis-dev/attachments/20131003/5a99a1db/attachment.htm 


More information about the Vorbis-dev mailing list