我想在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