Converting audio to CAF format for playback on iPhone using OpenAL

狂风中的少年 提交于 2019-11-26 23:45:36

问题


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?


回答1:


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)



回答2:


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



回答3:


this is the best for size:

afconvert -f caff -d ima4 original.wav




回答4:


thanks for the info.

also, if you're looking into additional compression with openAL, this might be of interest:

"iPhone, OpenAL, and IMA4/ADPCM" http://www.wooji-juice.com/blog/iphone-openal-ima4-adpcm.html




回答5:


It looks like the -c is not working today, I got it with following:

afconvert -f caff -d LEI16 input.m4a output.caf



来源:https://stackoverflow.com/questions/254080/converting-audio-to-caf-format-for-playback-on-iphone-using-openal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!