Synchrony Detection as a Reinforcement Signal for Learning: Application to Human Robot Interaction