avaudiorecorder

Mac OS X Simple Voice Recorder

青春壹個敷衍的年華 提交于 2019-12-01 11:46:04
Does anyone have some sample code for a SIMPLE voice recorder for Mac OS X? I would just like to record my voice coming from the internal microphone on my MacBook Pro and save it to a file. That is all. I have been searching for hours and yes, there are some examples that will record voice and save it to a file such as http://developer.apple.com/library/mac/#samplecode/MYRecorder/Introduction/Intro.html . The sample code for Mac OS X seems to be about 10 times more complicated than similar sample code for the iPhone. For iOS the commands are as simple as: soundFile =[NSURL FileURLWithPath:

How to pause and resume audio recording using AVAudioRecorder

☆樱花仙子☆ 提交于 2019-12-01 09:32:37
I need to pause and then resume an audio recording, I'm using AVAudioRecorder for my recording sessions... Anyone knows how to do this? Any help will be higly appreciated! Thanks a lot Peace Massy After initializing and creating an object of AVAudioRecorder , lets say AVAudioRecorder *recorder , simply call [recorder record] to record and [recorder pause] to pause. If you are calling record and pause in separate method e.g. on click of different buttons then you need to make recorder a class level variable. To pause the recording, use the following methods on AVAudioRecorder : - (void)pause

How to pause and resume audio recording using AVAudioRecorder

徘徊边缘 提交于 2019-12-01 05:42:02
问题 I need to pause and then resume an audio recording, I'm using AVAudioRecorder for my recording sessions... Anyone knows how to do this? Any help will be higly appreciated! Thanks a lot Peace Massy 回答1: After initializing and creating an object of AVAudioRecorder , lets say AVAudioRecorder *recorder , simply call [recorder record] to record and [recorder pause] to pause. If you are calling record and pause in separate method e.g. on click of different buttons then you need to make recorder a

Record and play audio simultaneously in iOS

♀尐吖头ヾ 提交于 2019-12-01 03:33:22
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 recording path. AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:recordingPathUrl

Writing ID3 tags via AVMetaDataItem

我们两清 提交于 2019-11-30 22:52:30
I'm writing ID3 tags to a file using AVMetaDataItem var soundFileMetadata = [AVMetadataItem]() soundFileMetadata.append(createMetadata(AVMetadataiTunesMetadataKeyArtist, "MyArtist")!) soundFileMetadata.append(createMetadata(AVMetadataiTunesMetadataKeySongName, "MySong")!) soundFileMetadata.append(createMetadata(AVMetadataiTunesMetadataKeyAlbum, "MyAlbum")!) soundFileMetadata.append(createMetadata(AVMetadataiTunesMetadataKeyUserGenre, "MyGenre")!) soundFileMetadata.append(createMetadata(AVMetadataiTunesMetadataKeyComposer, "MyComposer")!) Here is the createMetadata convenience method: func

How can I Access/extract raw(headless) audio data from a caf file on iPhone?

僤鯓⒐⒋嵵緔 提交于 2019-11-30 20:59:23
I am working on a project that requires me to send raw headerless ulaw or linear pcm data to a server. I am using the AVAudioRecorder and I can save out audio files to the phone quite easily, but the problem is that it no matter what I try and do, they get wrapped in a caf file or stamped with some kind of header. It's my understanding that a caf file is just a wrapper file for raw audio data and that this audio data can be in various formats including linear pcm and ulaw. So my questions are, how can I generate a raw audio file without the caf wrapper to begin with (ie just the headerless raw

how to record audio as mp3 file by using AvAudiorecorder

霸气de小男生 提交于 2019-11-30 20:43:45
how to record audio as mp3 file by using AvAudiorecorder.i m using following code for recorder setting recordSetting1 = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:AVAudioQualityMin],AVEncoderAudioQualityKey, [NSNumber numberWithInt:16], AVEncoderBitRateKey, [NSNumber numberWithInt: 2], AVNumberOfChannelsKey, [NSNumber numberWithFloat:44100.0], AVSampleRateKey,nil]; Add [NSNumber numberWithInt:kAudioFormatMPEGLayer3] forKey:AVFormatIDKey However it's impossible to encode mp3 format at IPhone because of royalty. Whilst you can play MP3 files using AVAudioPlayer , you can

AVAudioRecorder Record method returns NO at random times

╄→尐↘猪︶ㄣ 提交于 2019-11-30 18:01:23
I’m currently developing an app which supports in-app audio recording. The user can get a standard tableview of locally saved audio files he/she have already recorded through the app, or press a button to go to a new recording view, from where it is possible to record a new audio session, which will automatically get saved to the apps sandbox. Now this function works well most of the time. I can record new files and play them from the app, but at random times the audio recorder will fail to start a recording in this method: -(void) startRecording { if (!isRecording) { isRecording = YES; BOOL

iOS - Playback of recorded audio fails with OSStatus error -43 (file not found)

泄露秘密 提交于 2019-11-30 15:14:40
I set up an AVAudioRecorder instance the following way when my view loads: AVAudioSession *audioSession = [AVAudioSession sharedInstance]; audioSession.delegate = self; [audioSession setActive:YES error:nil]; [audioSession setCategory:AVAudioSessionCategoryRecord error:nil]; NSString *tempDir = NSTemporaryDirectory(); NSString *soundFilePath = [tempDir stringByAppendingPathComponent:@"sound.m4a"]; NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath]; NSLog(@"%@", soundFileURL); NSDictionary *recordSettings = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt

AVAudioRecorder Won't Record On Device

折月煮酒 提交于 2019-11-30 14:51:20
This is my method: -(void) playOrRecord:(UIButton *)sender { if (playBool == YES) { NSError *error = nil; NSString *filePath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat: @"%d", [sender tag]] ofType:@"caf"]; NSURL *fileUrl = [NSURL fileURLWithPath:filePath]; AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:fileUrl error:&error]; [player setNumberOfLoops:0]; [player play]; } else if (playBool == NO) { if ([recorder isRecording]) { [recorder stop]; [nowRecording setImage:[UIImage imageNamed:@"NormalNormal.png"] forState:UIControlStateNormal];