1

At now I save file by recording it from AVAudioUnitEQ.

    [mainEQ installTapOnBus:0 bufferSize:0 format:[mainEQ outputFormatForBus:0] block:^(AVAudioPCMBuffer *buf, AVAudioTime *when){
        if(!recordIsGoing){
            [mainEQ removeTapOnBus:0];
        }
        else{
            [writeAudioFile writeFromBuffer:buf error:nil];
            //  NSLog(@"%lld", writeAudioFile.length);
        }
    }];

But this method requires a prior file playback . Is there a way to save the mixed file without playing ?


UPD: I can get AUAudioUnit.outputBusses[0] to mainEQ. The challenge now is to take out the data and hope that they will be such what I need.

RESOLVED: Issue been resolved by this answer Can I use AVAudioEngine to read from a file, process with an audio unit and write to a file, faster than real-time?

Community
  • 1
  • 1
WSW
  • 81
  • 4

1 Answers1

0

I think you can do this by first converting your data into NSData and storing it. When you retrieve it back, you can convert it back.

NSData *data = [NSKeyedArchiver archivedDataWithRootObject:buf];

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *dataPath = [documentsDirectory stringByAppendingPathComponent:@"yourfilename.dat"];

// Save it into file system
[data writeToFile:dataPath atomically:YES];
Skywalker
  • 1,487
  • 1
  • 15
  • 36
  • Unfortunately I can't get buffer without call installTapOnBus. InstallTapOnBus works only if I playback file. – WSW Jan 25 '16 at 08:47