Recording AVAudioPlayer using AVAudioRecorder

In my application, the user plays a sound by pressing a button. There are several buttons that can be played simultaneously. Sounds are played using instances of AVAudioPlayer. I want to record the output of these instances using AVAudioRecorder. I created everything and the file is created and recorded, but when I play it, it does not play sound. This is just a quiet file, record length. Does anyone know if there is a parameter missing from AVAudioPlayer or AVAudioRecorder? Thanks

+3
source share
4 answers

Writing AVAudioPlayer as an input to AVAudioRecorder for recording is not possible. You can use the sound buffer to store playback files and save it to a file.

+3
source

It would be easier to help if you saw your code.

You should also check the following link to see if the AVAudioRecorder setting is configured correctly: How do I record audio on iPhone using AVAudioRecorder?

Although this link shows how to set up microphone recording, it may still be useful for you.

+2
source

. , AVAudioSession AVAudioSessionCategoryPlayback. :

AVAudioSession *audioSession = [AVAudioSession sharedInstance];
audioSession.delegate = self;
[audioSession setCategory:AVAudioSessionCategoryPlayback error:nil];
[audioSession setActive: YES error: nil];

, , :

   -(void) audioRecorderDidFinishRecording:(AVAudioRecorder *)recorder successfully:(BOOL)flag
{
    NSLog(@"Recording success:%@",flag ? @"YES" : @"NO");
}

, <AVAudioSessionDelegate,AVAudioRecorderDelegate,AVAudioPlayerDelegate>

.

+1

, , , - .

, , , , , AVAudioRecorder , .

, , doc , - Audio Converter Services, , , .

, , , , ,

+1

Source: https://habr.com/ru/post/1710080/


All Articles