I'm working on a project on which we use WebRTC and the RecordRTC library to record audio files.
I would like to be able to process the audio files server-side to ensure a good synchronisation.
To do so, I'm thinking about marking the start of each record with an inaudible sound marker in order to analyse new records and then manipulate the starting offset with ffmpeg (which I already use to compress the raw files created by RecordRTC).
The thing is I've never done any advanced audio processing before, I'm looking around and cannot find what would be the proper way to do this.
Is there another, better, way to handle synchronisation? And if not, I would be grateful if I could get some tips on the marker technique. Thank you.
The process is done as follow:
1) A user records himself
[User 1] -> Records on his browser an audio file -> Saves raw audio file (call it audio_1.ogg) -> [Server]
2) Another user wants to join user_1's project
[User 2] <--- Fetch audio_1.ogg (in an audio html tag) --- [Server] -> Press record -> [Webapp] Plays audio_1.ogg and starts recording audio_2.ogg -> Saves audio_2.ogg when record is over ->[Server]
I end up with ~50/100 ms of gap depending on how many audio files are already on the project (since it's not limited to two).