Getting Ogg Lib to Compile in Xcode

Well, I ran into problems while decoding Speex to PCM. I kept on getting static/robotic sound after decoding. I know I’m playing the PCM correctly, therefore something must have went wrong while decoding Speex. After analyzing, I noticed that the file I wanted to play was indeed compress to Speex, but it is in a ogg file container. I need to parse the ogg file first, then decode the speex data.

Here’s are the steps I did to import ogg lib into Xcode:

  1. Go to and download the latest stable version. The one I downloaded was
  2. From the downloaded libogg folder, /include folder, bitwise.c (in src folder), and framing.c (in src folder) to your Xcode project.
  3. Remove Makefile,, and inside the include folder.
  4. If you see errors like: Lexical or Preprocessor Issue ‘ogg/ogg.h’ file not found Go ahead to change it from #include <ogg/ogg.h> to #include “ogg.h” Please keep in mind to use “” instead of < >

And, that’s it! Much easier than compiling speex in Xcode. You should now be able to use the public functions declared in ogg.h.

Happy coding!