哪种音频文件格式最容易操作?
你好,优秀的计算机人员,
根据我之前提出的有关访问示例的问题音频文件,我现在意识到核心音频格式可能不是正确的选择。
特别是自从规范第 15 页它提到了 C 的使用是一种“符号便利”,即你不能只是用一些 C 函数打开它并用它做你想做的事情。
也就是说,如果我想打开一个音频文件,然后在其上运行一些 C、C++ 或 Objective-C 代码来处理样本值,哪种格式最适合执行此操作:WAV?国际电影节?其他?
请记住,我希望它能够在 iOS 上运行。
谢谢!
Hello nice computer persons,
Per to a question I had earlier concerning accessing the samples in an audio file, I now realize that the Core Audio Format may not be the way to go.
Especially since on page 15 of the spec it mentions something about the use of C being a 'notational convenience' i.e. you can't just crack it open with some c functions and do what you want with it.
That said, if I want to open an audio file and then run some C, C++ or Objective-C code on it to play around with the sample values, which format would be best to do this on: WAV? AIFF? other?
Please keep in mind I would like this to be able to run on iOS.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
未压缩的 WAV 文件。它们由标题和原始样本组成。
Uncompressed WAV files. They consist of a header followed by the raw samples.
我曾经通过 C++ 操作过 WAV,非常简单。
我用这个规范来编写我的代码: https://ccrma.stanford.edu/courses /422/projects/WaveFormat/ 通过本文档和对数字音频的一点了解,您可以轻松操作 WAV 文件。
I once manipulated WAV via C++ and it was pretty easy.
I used this spec to write my code: https://ccrma.stanford.edu/courses/422/projects/WaveFormat/ With this document and a little understanding of digital audio you can easily manipulate WAV files.
未压缩的 WAV 是音频编辑的事实上的标准。您可以使用各种库来轻松操作它们。如果您只是想要完全原始的样本,甚至没有 WAV 标头,请使用 PCM,但是您必须提前知道您的采样率、频率等,因为您不会获得通常在 WAV 标头中获得的信息是未压缩的样本。
Uncompressed WAV is the defacto standard for audio editing. You can use various libraries to manipulate them easily. If you simply want completely raw samples without even the WAV header go with PCM however you will have to know your sample rate, frequency, etc ahead of time as you won't have that info that would normally be in the WAV header all you get is the uncompressed samples.
最简单的未压缩 WAV 文件格式只有 44 字节标头(它告诉您采样率、每个样本的位数以及数据是立体声对还是单声道),后面直接跟着一组原始 PCM(通常)短整数。
在小端 CPU(例如 Intel 或大多数 ARM)上,您可以将此文件格式直接映射到 16 位 Shorts 的 C 数组中,然后使用距标头的适当偏移量对其进行索引。
The simplest uncompressed WAV file format just has a 44 byte header (which tells you the sample rate, number of bits per sample, and whether the data is stereo pairs or mono), followed directly by an array of raw PCM (usually) short integers.
On a little-endian CPU (such as Intel or most ARM), you can map this file format directly into a C array of 16-bit shorts, and just index into it with an appropriate offset from the header.
未压缩的 WAV 将是最容易处理的,因为您不必在操作之前对它们进行解码,因此您可能需要从它开始,直到您确定您的操作例程/代码为止。
然而,除非您计划只拥有一些点效果或相当大的结果捆绑包,否则从长远来看,查看类似 IMA ADPCM 的东西可能会更好。解码算法就在那里(查看 http://wiki.multimedia.cx/index.php php?title=IMA_ADPCM 了解更多信息),实现起来相对简单,并且允许您在产品中融入更多声音。
Uncompressed WAV will be the simplest to deal with, as you don't have to deal with decoding them before manipulation, so you probably want to start with that until you are sure of your manipulation routines/code.
However, unless you plan on only having a few spot effects or a rather large resultant bundle it might be better, in the long run, to look at something like IMA ADPCM. The decoding algorithms are out there (check out http://wiki.multimedia.cx/index.php?title=IMA_ADPCM for more on that), relatively simple to implement and it will allow you to fit more sounds in your product.