I carefully read the program “Record.cpp” in the FMOD API - core - examples - vs2019.
- It works well, but I don’t understand why “latency = samplesRecorded - samplesPlayed;” isn’t constant.
When starting recording and playing, the recording and playing should go on at the same speed.
- “Record.cpp” solves the problem of non constant latency (that I didn’t understand) by changing the playbackRate. The sound recorded isn’t played correctly then, is it ?
If I record my voice with 2 microphones : one recording directly what I sing, and the other recording what Record.cpp is playing, that won’t be the same, will it ?
Thank you very much,
Hardware devices sometimes record or play back at sample rates that differ very slightly from what is intended. These differences are usually too small to be discernible by humans, but can potentially cause the playing audio to gradually drift further and further out of sync with the recorded audio when recording and playing back simultaneously. To avoid this problem, “record.cpp” automatically adjusts the pitch of the playing audio to ensure it remains in sync with the input. This difference in pitch is usually too subtle for the human ear to notice, and so is generally judged a better result than letting the audio drift out of sync.
I understand that hardware devices don’t record or play at the exact same sample rate, but I imagined that FMOD could have solved this problem by synchronizing all streams with a unique clock, so that sound and play recording would look synchronized to the programmer.
Anyway, thanks to your answer, I will stop dreaming of synchronization.
Thank you very much !