synchronize AVAudioRecorder to AVPlayer

how do I synchronize playback to AVAudioRecorder start record time? Can I assume AVAudioRecorder uses the clock from CMClockGetHostTimeClock?

CMTime referenceTime = CMTimeAdd(CMClockGetTime(self.player.masterClock), CMTimeMakeWithSeconds(2, NSECPERSEC)); //start playback and record 2 seconds after.
    [self.player setRate:1.0 time:kCMTimeZero atHostTime:referenceTime];
  CMTime syncPTS = CMSyncConvertTime(referenceTime, self.player.masterClock, CMClockGetHostTimeClock());
  [self.audioRecorder recordAtTime:CMTimeGetSeconds(syncPTS) forDuration:30]; //audioRecorder is an instance of AVAudioRecorder
No, AVAudioRecorder operates on the audio device clock. See the deviceCurrentTime property. Depending on how tight you need your sync to be, you could get pretty close by asking CMClockGetTime and deviceCurrentTime one after another and using those times to start playback and recording, respectively.
synchronize AVAudioRecorder to AVPlayer
 
 
Q