简体   繁体   English

对于iPhone- .caf或.wav中的短音频输入,哪一个更好?

[英]Which one of these is better for short audio input in iPhone- .caf or .wav?

I am making a simple application for iPhone, and I want to enter a short audio file on an object click. 我正在为iPhone制作一个简单的应用程序,我想在对象点击上输入一个简短的音频文件。 Which of .caf and .wav would be better? 哪个.caf和.wav会更好?

I am building a simple application in Cocos2d in which balloons produce a pop sound when clicked. 我正在Cocos2d中构建一个简单的应用程序,其中气球在单击时会产生爆音。 What are the memory issues with both sound versions? 两个声音版本的内存问题是什么?

If you do not need specific Core Audio Format features, then WAV has more universal support (and it would be my default choice for that reason). 如果您不需要特定的Core Audio Format功能,那么WAV具有更多的通用支持(出于这个原因,它将是我的默认选择)。

Core Audio Format basically functions as a container for other audio file formats, including WAV. Core Audio Format基本上可以作为其他音频文件格式的容器,包括WAV。 Core Audio Format has many great features, but it's not evident from the description that you need any of these. 核心音频格式有许多很棒的功能,但从描述中你不需要任何这些功能。


In response to a deleted comment, which was moved to the question: 回复已删除的评论,该评论已移至问题:

I can't speak for Cocos2d specifically, so I will write about the file formats in general: WAV does not use data compression. 我不能专门代表Cocos2d,所以我会写一般的文件格式:WAV不使用数据压缩。 CAF may. CAF可能会。 If it is a short sound file, you probably don't want data compression (because it requires a good amount of processing to convert to LPCM for playback). 如果它是一个简短的声音文件,您可能不希望数据压缩(因为它需要大量的处理才能转换为LPCM进行播放)。 If you play the pop often, then you will want to hold onto an uncompressed version of the audio data for easy processing. 如果您经常播放流行音乐,那么您需要保留音频数据的未压缩版本以便于处理。 1 second will require 44100 * 2 bytes at CD quality in memory (per channel). 1秒钟内存中需要44100 * 2字节的CD质量(每个通道)。

For a short sound file such as a balloon pop, a 16 bit WAV file sounds ideal. 对于诸如气球弹出的短声音文件,16位WAV文件听起来很理想。 In that sense, the memory difference should not be a deciding factor. 从这个意义上说,记忆差异不应该是决定因素。 If you have a lot of audio files, or long audio files to load into memory, then the situation changes. 如果您有大量音频文件或长音频文件加载到内存中,则情况会发生变化。 For now, I don't consider memory to be a problem in your case. 就目前而言,我不认为记忆在你的情况下是一个问题。 Since CAF is a container, its uncompressed representation will be nearly identical (the difference will be a little more header data in the CAF). 由于CAF是一个容器,因此它的未压缩表示几乎相同(CAF中的标题数据会有所不同)。

A CAF file is a basically Core Audio Format . CAF文件基本上是核心音频格式 So it is well suited for the Apple frameworks. 所以它非常适合Apple框架。 The best advantage of CAF over WAV is while recording when you can have files more than 4 GB and also in CAF you don't need to update the WAV header after each packet recording. CAF相对于WAV的最大优势在于,当您可以拥有超过4 GB的文件时进行录制,并且在CAF中,您不需要在每次数据包录制后更新WAV标头。

Anyway, I assume you don't need these features related to CAF. 无论如何,我假设你不需要这些与CAF相关的功能。 And as Justin said, I do believe that WAV will be the better option as you can have more support for WAV than the CAF format. 正如贾斯汀所说,我相信WAV将是更好的选择,因为你可以获得比CAF格式更多的WAV支持。

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

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