Hello @bryan1anderson, thank you for your post. If you are streaming PCM audio data to disk, you should be able to recover the recorded fragment after a crash. You would likely benefit from using a lower-level API than AVAudioRecorder
, though.
Stitching multiple AVAudioRecorder
recordings might not work well if the stitching needs to be very precise, such as if you are recording music, for example. Precise stitching would be best accomplished with accurate start timestamps for each recorded fragment.
With AVAudioEngine
, AVCaptureSession
, Audio Toolbox
, or Core Audio
, you can access the underlying PCM audio data and associated timestamps, which is what you need in order to stream this data to disk.
The Using Voice Processing sample code project demonstrates how to record audio files using AVAudioEngine
. In a nutshell, you install a tap on the engine's input node, then stream the received PCM buffers to disk. The project uses AVAudioFile
for writing the buffers to disk, but that is not a requirement. You could write the data from the buffers to an OutputStream, for example.