In my app users record themselves singing over a backing track, and then later playback the recorded audio and this backing track at the same time. The problem is that at the playback stage the audio is often out of sync because expo only really supports asynchronous audio. Does anyone have any advice on how to approach this problem at a high level?
A few of my ideas:
- Mix the two audio files into a single file for playback. This almost works except for the fact that the recording and backing track are also out of sync. If I knew exactly how much they were offset, I could just add that amount of silence to one of the files when mixing. However, I haven’t found a way to accurately calculate this offset.
- Reduce time it takes for recording and playback to start, so that the latency is not noticeable. Some things I’ve found that help here are recording at lower quality and using smaller audio files. Any other tips here would be appreciated.
- Use a different audio library than expo-av. Is there one that comes to mind that better supports synchronous audio? Ideally it would also be supported by Expo or at least React Native.