3

I decided to write a decoding software. I have chosen to deal with Vorbis and Ogg first. I've read their specification for hours, and it is a brain-screw for me. The decoding involves using bitwise operations on file's bytes, which I've rarely used in my life.

So far I understand that Ogg is a container format and Vorbis is an audio format. So it means the Vorbis data is wrapped in Ogg container? And of course, if a manage to decode a file, how can I play it?

Is there a simpler format that I can learn to decode? Also, am I right that questions about actual coding should be asked at Stackoverflow rather than here?

closed as off-topic by audionuma, Rory Alsop May 29 '17 at 17:03

  • This question does not appear to be about sound design, within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

2

I recommend you to start with pulse-code modulation files (.WAV, .AIFF, etc.): https://en.wikipedia.org/wiki/Pulse-code_modulation

What is stored in a typical CD-quality PCM file is nothing more than a few metadata markers, and a trunk of stereo data kept as numbers(note, they may be floating numbers or integers).

You can view PCM files as a "dump" from the internal buffers of an audio interface. For example, when the audio interface runs at 44.1Khz/16bit, you simply read short[2][...] (because it's stereo!) from a .wav file and dump them into the audio interface and it will just work.

Depending on your OS/audio stack you may need different libraries for sending the "dump" into your soundcard. I had experience with https://github.com/thestk/rtaudio and it's cross-platform.

Anything beyond PCM will need a good load of math prerequisites to understand. But if you strictly follow the specs, doing every step correctly you'll be able to wrap up a decoder without understanding all the details. You will be first decoding the stream, which effectively turns .ogg to .wav (incrementally), and throws the .wav segments into the audio interface.

Good luck!

Update: btw, the container-codec model is almost universal in audio/video file formats. If you dig deeper into the WAV format you'll find interesting stuff. :)

Not the answer you're looking for? Browse other questions tagged or ask your own question.