My application play a music using web audio api with MIDI.js.
Application record a user from microphone or webcam playing an instrument like guitar. I am using getUserMedia with a worker for this taken from https://github.com/mattdiamond/Recorderjs.
My problem is a latency problem. The sound I played is approximately recorded 250ms after.
What I want is not necessarly to reduce this time but to know this time with more or less 15ms so I can synchronize both.
Is there anyway to do it ? Can I assume the latency will stay constant ?
I noticed the AudioContext parameter call currentTime: http://www.w3.org/TR/webaudio/#AudioContext-section Can I use it to know the latency between my noteOn and the realTime noteOn on hardware ? If yes then how and how can i get the latency between guitar playing and guitar recorded.
I need something like AudioIODevice::getOutputLatencyInSamples from JUCE http://www.juce.com/api/classAudioIODevice.html#a693804fbf5a7cceb31ece10a9f03bd11
Thank you for your help.