avaudiorecorder

How can i get time of my recorded audio in iphone?

女生的网名这么多〃 提交于 2019-12-21 09:29:23
问题 I am recording audio using AVAudioRecorder ,and now i want to get exact time duration of my recorded audio,how can i get that. i have tried this: AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:avAudioRecorder.url options:nil]; CMTime time = asset.duration; double durationInSeconds = CMTimeGetSeconds(time); But my time variable return NULL and durationInSeconds return 'nan',what does that means by nan. UPDATE user1903074 answer have solved my problem but just for curiosity ,is thair any

AVAudioRecorder records only the audio after interruption

狂风中的少年 提交于 2019-12-21 04:44:06
问题 In my application for recording and playing audio using AVAudioRecorder and AVAudioPlayer I came across a scenario in the case of incoming phone call.While the recording is in progress and if the phone call comes,the audio recorded after the phone call is only recorded.I want the recording recorded after the phone call to be the continuation of the audio recorded before the phone call. I track the interruption occuring in audio recorder using the AVAudioRecorderDelegate methods (void

Recording voice in background using AVAudioRecorder

喜欢而已 提交于 2019-12-20 17:34:15
问题 I'm trying to record user voice in background using AVAudioRecorder but every time i get NO while calling recordForDuration method. I add "audio" to UIBackgroundModes but this don't help. By the way, Everything works perfect in foreground. I'm initializing AVAudioRecorder using this code: NSError* error; if (![[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryRecord error:&error]) { NSLog(@"Error while setting audio session category. Code - %d, description - \"%@\".", [error

AVAudioRecorder won't record IF movie was previously recorded & played

别等时光非礼了梦想. 提交于 2019-12-20 09:47:18
问题 My iPhone app uses "AVAudioRecorder" to make voice recordings. It also uses "UIImagePickerController" to record movies and "MPMoviePlayerController" to play movies. Everything works fine until I do all three things in a row: Record a movie using UIImagePickerController Play back the recorded movie using MPMoviePlayerController Try to make a voice recording using AVAudioRecorder When I call AVAudioRecorder's "record" method in step 3, it returns NO indicating failure, but giving no hints as to

How to get the reading of deciBels from iOS AVAudioRecorder in a correct scale?

烂漫一生 提交于 2019-12-20 09:43:20
问题 I'm trying to obtain a noise level in my iOS app, using AVAudioRecorder. The code I'm using is: [self.recorder updateMeters]; float decibels = [self.recorder averagePowerForChannel:0]; // 160+db here, to scale it from 0 to 160, not -160 to 0. decibels = 160+decibels; NSLog(@"Decibels: %.3f", decibels); The readings I get, when the phone sits on my desk are at about 90-100dB. I checked this this link and the table I saw there shows that: Vacuum Cleaner - 80dB Large Orchestra - 98dB Walkman at

How to hide the red bar under the iOS's status when recording?

会有一股神秘感。 提交于 2019-12-20 02:24:47
问题 I used AVAudioRecorder to record the voice.I found that a red bar (just like the bar when you calling in background) will appear under the status bar sometimes when I alloc it and begin to record.How to hide it? 回答1: You can't do that. Every app, including the stock Voice Memos app, will have the bar when it uses the microphone. 来源: https://stackoverflow.com/questions/13391311/how-to-hide-the-red-bar-under-the-ioss-status-when-recording

Swift AVAudioPlayer wont play audio recorded with AVAudioRecorder

浪尽此生 提交于 2019-12-19 12:48:13
问题 I have built an app that records an audio clip, and saves it to a file called xxx.m4a . Once the recording is made, I can find this xxx.m4a file on my system and play it back - and it plays back fine. The problem isn't recording this audio track. My problem is playing this audio track back from within the app. // to demonstrate how I am building the recordedFileURL let currentFileName = "xxx.m4a" let dirPaths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true) let

Record and play audio simultaneously in iOS

帅比萌擦擦* 提交于 2019-12-19 05:45:05
问题 I am trying to play the recorded content simultaneously while recording. Currently I am using AVAudioRecorder for recording and AVAudioPlayer for playing. When I was trying to play the content simultaneously nothing is playing. Please find the pseudo code for what I am doing. If I do the same stuff after stop the recording everything works fine. AVAudioRecorder *recorder; //Initializing the recorder properly. [recorder record]; NSError *error=nil; NSUrl recordingPathUrl; //Contains the

How to record the user voice in Objective-C for iPhone

筅森魡賤 提交于 2019-12-19 04:10:19
问题 I want to record the user voice and then play it back after some time. Is there any way to do this in Objective-C for iPhone? 回答1: Use AVAudioRecorder for doing this. For more help see this tutorial. Hope this helps. 来源: https://stackoverflow.com/questions/1978698/how-to-record-the-user-voice-in-objective-c-for-iphone

How to record the user voice in Objective-C for iPhone

余生长醉 提交于 2019-12-19 04:10:05
问题 I want to record the user voice and then play it back after some time. Is there any way to do this in Objective-C for iPhone? 回答1: Use AVAudioRecorder for doing this. For more help see this tutorial. Hope this helps. 来源: https://stackoverflow.com/questions/1978698/how-to-record-the-user-voice-in-objective-c-for-iphone