我想在iPhone上做一些演讲者验证(作为课程项目)。我想知道如何从扬声器获得线性PCM。我阅读关于队列服务的文档,似乎它会记录声音,然后将其存储到文件中。有没有办法直接从这个线性PCM?文档中提到了一些有关缓冲区的内容,但我不太明白。也许这是做到这一点的关键?如何从iPhone上的录音中获取线性PCM?
1
A
回答
1
0
AVAudioRecorder *audioRecorder = [[AVAudioRecorder alloc]
initWithURL:soundFileURL
settings:recordSettings
error:&error];
audioRecorder.delegate = self;
audioRecorder.meteringEnabled = YES;
然后开始使用的NSTimer如调用定时器拍摄时,你点击录音键
-(IBAction)record:(id)sender{
NSTimer *recordTimer = [NSTimer scheduledTimerWithTimeInterval:.01 target:self
selector:@selector(recordTimerAction:) userInfo:nil repeats:YES];
}
-(void)recordTimerAction:(id)sender {
[audioRecorder updateMeters];
const double ALPHA = 0.05;
double peakPowerForChannel = pow(10, (0.05 * [audioRecorder peakPowerForChannel:0]));
lowPassResults = ALPHA * peakPowerForChannel + (1.0 - ALPHA) * lowPassResults;
NSLog(@"The Amplitude of the recording Sound is %f",lowPassResults);
NSLog(@"The Normal Linear PCM Value is %f",[audioRecorder peakPowerForChannel:0]);
}
//委托方法
-(void)audioRecorderDidFinishRecording: (AVAudioRecorder *)recorder successfully:(BOOL)flag{
[recordTimer invalidate];
}
相关问题
- 1. 从线性PCM提取音频通道
- 2. iPhone - 获得线性PCM音频文件的持续时间
- 3. 从PCM数据获取音频信息
- 4. iphone中的离线录音
- 5. 如何从iPhone的在线网址获取音频播放
- 6. 在iPhone上播放线性PCM音频是否有“简单”方式?
- 7. 如何在录音过程中获得PCM矢量值?
- 8. 在Android上从MP3获取PCM数据
- 9. 如何在iOS上录制PCM音频文件?
- 10. 在Silverlight中录制PCM音频4
- 11. 在iPhone上获取声音的频率
- 12. 如何从iPhone中的NSMutableArray中获取联系人的记录
- 13. 如何录制iphone音箱的音频?
- 14. 如何以pcm格式制作简单的录音机?
- 15. 如何用PCM音频中的IMediaSample检测静音
- 16. 如何从Wave Out捕获PCM数据
- 17. 从PCM数据获取频率信息
- 18. 如何获取通过音频录音机录制的声音的幅度
- 19. 如何在iphone中录制语音?
- 20. 如何混合PCM音频源(Java)?
- 21. 如何从MediaStore获取音乐的URI?
- 22. 如何从记录上次获取的记录中获取上次更新的记录
- 23. 如何在iPhone中获取音频文件的细节
- 24. 如何在printf(缓冲区)中获取原始数据?在音频记录iphone
- 25. 从iPhone的音乐库中获取歌曲的详细信息
- 26. 在.NET上播放PCM音频流CF
- 27. 如何从iPhone的通讯录获取Twitter帐户信息
- 28. 如何通过串口和进程捕获语音PCM数据?
- 29. 如何从特定年份获取iPhone音乐库中的所有歌曲?
- 30. 如何获取ALSA中的PCM设备路径?
的幅度将在范围从0到1,这可能是有益的 – Bala 2012-04-26 11:32:33
请让我知道,如果不工作 – Bala 2012-05-01 07:22:34
我发现,苹果有它的内置INT API这个被称为音频队列服务。我认为你的回答是正确的,但内置的API会更好。 – yoyosir 2012-05-04 04:47:35