简体   繁体   English

在iPhone应用程序中将.m4r / .mp3转换为.caf / .aiff

[英]Convert .m4r/.mp3 to .caf/.aiff in iphone app

As of right now I am using ffmpeg to convert from .mp3 --> to .aiff but I would like a native way to do this in xcode but i do not understand how to use AudioConverter.h in AudioToolbox soo if someone could please help me I would be really appreciative. 截至目前,我正在使用ffmpeg从.mp3->转换为.aiff,但我想以一种本机方式在xcode中执行此操作,但我不明白如何在AudioToolbox中使用AudioConverter.h,所以如果有人可以请帮助我,我将非常感激。

Thank You Enea 谢谢你Enea

ExtAudioFile can do a fantastic job of this. ExtAudioFile可以做得很好。 One reason to take some compressed formats like MP3 and convert to PCM is that there is much less of a latency when playing the sound. 采用某些压缩格式(例如MP3)并转换为PCM的原因之一是,播放声音时的等待时间要短得多。 An MP3 sound effect, for example, can take close to a second to start playing back, when the same sound in PCM could start almost immediately. 例如,当PCM中的相同声音几乎立即开始播放时,MP3声音效果可能需要一秒钟才能开始播放。 I know since I am converting my sounds to PCM at launch time and eliminating the delays I was plagued with. 我知道,因为我在启动时将声音转换为PCM,并消除了困扰我的延迟。

Go download iPhoneExtAudioFileConvertTest and you will find everything you need to do your own conversions 转到下载iPhoneExtAudioFileConvertTest ,您将找到进行自己的转换所需的一切

I think the real question is why would you want to? 我认为真正的问题是您为什么要这么做? The iphone and AudioQueue has full mp3 support for playback and mixing. iphone和AudioQueue具有完整的mp3支持,可以播放和混音。 I know of no way to do this on the fly in the iPhone. 我不知道如何在iPhone中即时执行此操作。 It is a fairly processor intensive task and I doubt you could do it efficiently on the iPhone anyway. 这是一项相当耗费处理器的任务,我怀疑您是否仍然可以在iPhone上高效地完成任务。

您可以使用ExtAudioFile打开文件并将其转换为带有PCM数据的CAF。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM