Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting audio to CAF format for playback on iPhone using OpenAL

I am using the SoundEngine sample code from Apple in the CrashLanding sample to play back multiple audio files. Using the sample caf files included with CrashLanding everything works fine but when I try and use my own samplesconverted to CAF using afconvert all I get is a stony silence ;)

Does anyone have settings for afconvert that will produce a CAF file capable of being played back through OpenAL?

like image 671
Dave Verwer Avatar asked Oct 31 '08 16:10

Dave Verwer


People also ask

What program plays CAF files?

You can open CAF files with various audio players, including QuickTime Player 7 and later (included with macOS), VideoLAN VLC media player (multiplatform), Audacity (multiplatform), and NCH WavePad (multiplatform).

Can iTunes play CAF files?

iTunes doesn't support . caf file format. However you could try a program called Switch.

Is CAF audio lossless?

The audio format that Capture records within it's CAF files is Apple Lossless Audio Codec or ALAC. This is Apple's own version of a lossy compression format. Lossless audio formats contain the same data as it's full size equivalent so there is no loss of audio quality when using the ALAC audio format.


2 Answers

afconvert -f caff -d LEI16@44100 -c 1 in.wav out.caf 

References:

  • Apple's Multimedia Programming Guide: Using Audio: Preferred Audio Formats in iOS
  • afconvert(1) man page (use afconvert -h for complete info)
like image 67
Dave Verwer Avatar answered Sep 26 '22 02:09

Dave Verwer


Simple bash script to convert the mp3 files in a folder to caf for iphone

#!/bin/bash for f in *.mp3; do   echo "Processing $f file..."   afconvert -f caff -d LEI16@44100 -c 1 "$f" "${f/mp3/caf}" done 
like image 22
tomwilson Avatar answered Sep 27 '22 02:09

tomwilson