title: How to write buffer data to the middle of a file instead of appending to the end of the file?
body: <p>I am able to record audio to an audio file by appending buffer data to the END of the audio file with the following code:</p>
  <pre><code>// AVAudioFile uses the Core Audio Format (CAF) to write to disk.
  // So we're using the caf file extension.
  file = try AVAudioFile(forWriting: FileManagerHelper.recordingLocalURL(), settings: format.settings)
  
  tapNode.installTap(onBus: 0, bufferSize: bufferSize, format: format, block: {
    (buffer, _) in
    do {
      buffer.frameLength = 1024 // Tap is now called every 40ms. By default, tap is called every 0.375s
      try self.file?.write(from: buffer)
      self.delegate?.recorderDidRecieveAudioBuffer(self, buffer: buffer)
      semaphore.signal()
    } catch {
      log(&quot;Error writing mic data to file.&quot;, msgType: .error)
    }
  })
  </code></pre>
  <p>But is there anyway to write buffer data into the file at a certain position, i.e. time or index in the buffer data?</p>
  <p>Thanks</p>