[英]iOS: Obtaining raw PCM data from audio file
I'm investigating a straightforward task: 我正在研究一个简单的任务:
What are my options? 我有什么选择?
I will list the results of a couple of hours of research: ( forgive the mess, I will as always tidy pu once I have figured it out ) 我将列出几个小时的研究结果:(请原谅,一旦弄清楚,我将一如既往地整理pu)
http://lists.apple.com/archives/coreaudio-api/2005/May/msg00096.html <-- 'I'm currently trying to create a program that plays back audio using an AUAudioFilePlayer AudioUnit plugin that streams the audio to an output AudioUnit' http://lists.apple.com/archives/coreaudio-api/2005/May/msg00096.html <- '我目前正在尝试创建一个程序,该程序使用AUAudioFilePlayer AudioUnit插件播放音频,该插件将音频流输出AudioUnit'
AUFilePlayer AUFilePlayer
http://lists.apple.com/archives/coreaudio-api/2008/Dec/msg00156.html http://lists.apple.com/archives/coreaudio-api/2008/Dec/msg00156.html
http://zerokidz.com/audiograph/docs/audiograph.pdf <-- this possibly links to code that does it, but it says it is in beta http://zerokidz.com/audiograph/docs/audiograph.pdf <-这可能链接到执行此操作的代码,但它表示它处于beta版本
When reading audio file with ExtAudioFile read, is it possible to read audio floats not consecutively? 使用ExtAudioFile read读取音频文件时,是否可以不连续读取音频浮动? <-- this leads to an OS X project that reads an audio file from disk into memory;
<-这将导致OS X项目从磁盘将音频文件读取到内存中; looking through the code leads us to:
查看代码会导致我们:
https://developer.apple.com/library/mac/#documentation/MusicAudio/Reference/ExtendedAudioFileServicesReference/Reference/reference.html https://developer.apple.com/library/mac/#documentation/MusicAudio/Reference/ExtendedAudioFileServicesReference/Reference/reference.html
as far as I can see the audio Graph project attempts to stream the audio from file in real-time, whereas Stephan's Project just exposes the audio; 据我所知,音频Graph项目试图实时地从文件中传输音频,而斯蒂芬的项目只是公开音频。 however it looks like he is using obsolete API calls.
但是看起来他正在使用过时的API调用。
this looks like the right code ( apart from the fact that there seems to be a bug in it ): https://stackoverflow.com/questions/8533143/decoding-mp3-files-by-extaudiofileopenurl 这看起来像正确的代码(除了其中似乎有错误的事实): https : //stackoverflow.com/questions/8533143/decoding-mp3-files-by-extaudiofileopenurl
http://cocoadev.com/forums/discussion/499/core-audio/p1 http://cocoadev.com/forums/discussion/499/core-audio/p1
https://developer.apple.com/library/ios/#samplecode/iPhoneExtAudioFileConvertTest/Introduction/Intro.html <-- here is an official Apple sample project that could probably be modified to get what I'm after https://developer.apple.com/library/ios/#samplecode/iPhoneExtAudioFileConvertTest/Introduction/Intro.html <-这是一个官方的Apple示例项目,可以对其进行修改以得到我想要的东西
I believe you can use IphoneExtAudioFileConvertTest like you said to get what you need, after the user marks what times he wants, first thing you want to do is convert to PCM, next you need to find out which packets are the ones you need, write that to an audio file and then recompress... I wrote an answer here on how to get x amount of seconds from an audio file, ive only tested it with mp3 and m4a, but it can be adapted to PCM (pcm should be easier to do since its linear). 我相信您可以像您所说的那样使用IphoneExtAudioFileConvertTest来获得所需的内容,在用户标记了他想要的时间之后,您要做的第一件事就是将其转换为PCM,接下来您需要找出哪些数据包是您需要的数据包,然后编写将其转换为音频文件,然后重新压缩...我在这里写了一个关于如何从音频文件中获取x秒的答案,我只用mp3和m4a对其进行了测试,但可以将其适配于PCM(pcm应该更容易因为它是线性的)。
Daniel 丹尼尔
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.