When creating my first game, Pub Pong, which you can download from here by the way, please do it will mean food for a week, but anyway, I was trying to create a fast and reliable audio system. Wavs, Mp3’s were all trialled in my sound engine, but there always seemed to be a trouble whilst loading them in. They were too big, and also the key point to remember about the apple audio toolbox is that if the file is not in caf, it will convert the audio file to it before use, which can cause a small lag in the time from loading to playing.

The best way to imagine it, is that if you had talking in your game, with lip sync, the converting of the files in run time would cause the lips to be out of sync and look a lot like the film Kung Pow. So it is best to convert before compiling.

That is the terminal icon for the those not in the know

That is the terminal icon for the those not in the know

What this mini tutorial will do is show you how to convert the files using the terminal, a device that Linux users have surgically attached to themselves. Right lets ride this wave:

  • First of all, open up terminal. That should be a case of either opening it from the spotlight bar or clicking on it from within the dock.
  • For those who are not familiar with the terminal, we will not be using many commands, just a few.
  • You first have to get to the lcoation of the files that you are going to want to change.
  • First of all list out all the items that you can currently see in terminal, type ls, then hit return:LS
  • From there, you need to to go to the directory where all your files are, mine are in a folder called Audio, so cd Audio will get me there. If yours are in a folder of a different name, it would be cd insertfoldernamehereyeah.
  • Then it gets nice and simple as it is an ease to access the converter.
  • Caf ConvertSo in text speak that you can copy and paste it is as follows: afconvert -f caff -d LEI16@44100 Wind.wav Wind.caf
  • Obviously you put the names of your files in here, and what you want the new files to be called.
  • That is basically it, if you really want a video tutorial of this then i will do it.