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.

Edit: I forgot to mention for those who don't know how RecordRTC works that the record is done client-side in Javascript. The synchronisation issue comes from the fact that javascript is not good at synchronising calls.

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]

The synchronisation issue comes from the fact that there are no way in Javascript to ensure that both the functions handling that starts record and the one responsible for beginning playing the existing audio file happen on the same time.

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).

  • $\begingroup$ Can you inject some data samples into your stream? $\endgroup$ – jojek Jun 26 '14 at 9:30
  • $\begingroup$ You mean like the sound marker? $\endgroup$ – Ariel Mitevski Jun 26 '14 at 10:48
  • $\begingroup$ Yes, indeed. Some kind of signal that can be very easily correlated, i.e. Barker Code. $\endgroup$ – jojek Jun 26 '14 at 10:50
  • $\begingroup$ That's precisely what I'm trying to achieve here but unfortunately I don't have any experience in digital signal processing and therefore I don't know how to correlate those signals... $\endgroup$ – Ariel Mitevski Jun 26 '14 at 13:35
  • $\begingroup$ You didn't answer question - can you inject some data samples into your stream? $\endgroup$ – jojek Jun 26 '14 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.