how many bytes I have to skip to be at the music payload in vorbis ogg files?

I’m trying to generate levels in a game using the OGG music payload (as file bytes, not decoded) but I can’t figure out how to calculate how many bytes I’d have to skip in a OGG file to get the music payload. also it’d be nice to get the length of the music payload in bytes as well.

Please forgive my terminology if it’s incorrect.

The music is encoded, it’s not raw audio data. You have to read the OGG spec.

Right, but I’m not trying to decode the audio. I just want the array of encoded bytes.

Why on God’s Green Earth would you store level data in an ogg container?

I would guess not to store the levels, but to let the player choose a piece of music that they want to generate a level with. Is that it?

I can’t imagine anything you could get out of audio data encoded in any format that would be appropriate for a level generator. Maybe with some DSP work like beat detection or something, but certainly not raw bytes. You may as well just use random seeds based on a hash of any file’s contents in that case.

Yeah, I have to agree with this.

In this case you wouldn’t even need to read it as an ogg file, but you would just read in the bytes until you get and EOF and generate the level from there. I don’t see any real need to go into any extra work to read in the stream perfectly.

And to top it all off. Ogg headers and Vorbis headers are not fixed length. So there is no such constant anyway.