You could try using The Amazing Audio Engine. You can install it via Cocoapods
pod 'TheAmazingAudioEngine'
or clone via git
git clone --depth=1 https://github.com/TheAmazingAudioEngine/TheAmazingAudioEngine.git
The sound could be recorded to a file with the help of this.
So if you want to record the apps output simply use a Outputreceiver:
@property (nonatomic, strong) AEAudioController *audioController;
@property (nonatomic, strong) AERecorder *recorder;
...
self.audioController = [[AEAudioController alloc] initWithAudioDescription:[AEAudioController nonInterleaved16BitStereoAudioDescription] inputEnabled:YES];
...
//start the recording
- (void) beginRecording{
self.recorder = [[AERecorder alloc] initWithAudioController:self.audioController];
NSString *documentsFolder = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
//the path to record to
NSString *filePath = [documentsFolder stringByAppendingPathComponent:@"AppOutput.aiff"];
//start recording
NSError *error = NULL;
if ( ![_recorder beginRecordingToFileAtPath:filePath fileType:kAudioFileAIFFType error:&error] ) {
//an error occured
return;
}
[self.audioController addOutputReceiver:self.recorder];
}
...
//end the recording
- (void)endRecording {
[self.audioController removeOutputReceiver:self.recorder];
[self.recorder finishRecording];
}