v0.3.0 — Voiceover recording
AVAudioRecorder is a handful of lines and free from Apple. What this packages is the part that decides whether a take lands on the picture or a fifth of a second behind it.
let take = try recorder.stop()
video = video.audio { take.audioTrack(startingAt: previewTime) }Why latency compensation is the feature
A voiceover is performed against playback. The performer reacts to audio that already left the device late, and their voice arrives at the input late again — so the take is behind the picture by the sum of both.
| Connection | Round trip |
|---|---|
| Wired | a couple of ms — nobody notices |
| Bluetooth | 150–200 ms — several frames at 30 fps, unmistakable on a lip-sync |
Measured at start(), not at construction: plugging in AirPods between the two changes the answer by two orders of magnitude.
An honest limit
Compensation shifts a recording into alignment; it cannot undo what the performer heard while performing. A take recorded against 200 ms-late playback is correctly placed and still performed against late audio. RecordingLatency.isPerceptible(_:) exists so a host can suggest a wired connection rather than silently papering over it.
16 → 26 tests. Ten of them are the latency arithmetic and the placement it drives — pure, so they run on the macOS host CI uses.