Wednesday, January 5, 2011

Vorbis decoding working

OK, I feel like an idiot. Finally ran down the problem with my decoder, and it turned out to be due to accidentally reading the file as text rather than binary. One of the oldest mistakes in the DOS/Windows-programming book. As soon as the file read encountered the magic DOS end-of-file character it quit reading.

I still think the Ogg format's unnecessarily complicated, and I'm not sure Vorbis is the best choice for dialog lines. I don't want to pay ~4 KB per line of dialog in my game for a bunch of identical decode tables, along with the CPU and memory to unpack them every time I play a line. You could imagine putting all the lines in one Ogg stream and then seeking to the appropriate line, but that would require creating an index, something that Ogg itself doesn't provide. I may take a look at using GSM-style linear prediction compression if I can find a decent implementation.

2 comments:

Chris R. said...

because of your posts on Ogg vorbis I've looked at other similiar containers (free, OSS, etc). I came across mka (Matroska audio), which allows for multiple streams in a single container, perhaps this would be what you're looking for, one file that contains all the different available dialogs.

I haven't looked at details but I got this off their FAQ: http://www.matroska.org/technical/guides/faq/index.html
in particular search for: "Here are some reasons that placing audio in MKA is useful:"

James McNeill said...

Thanks! I saw the Matroska name when I was reading around a bit the other day, but I hadn't had a chance to look at it.