简体   繁体   English

iOS:从音频文件获取原始PCM数据

[英]iOS: Obtaining raw PCM data from audio file

I'm investigating a straightforward task: 我正在研究一个简单的任务:

  • open an audio file from the iPhone's 'iPod audio library' 打开iPhone的“ iPod音频库”中的音频文件
  • allows the user to select a chunk by setting two markers: start and end time 允许用户通过设置两个标记来选择块:开始时间和结束时间
  • time-reverse this chunk 时间逆转此块
  • save it as a new file 将其另存为新文件

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://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.

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