title: Solving latency between AVPlayer and NSSound
body: <p>I am getting a latency that seems dependent on the computer, between AVFoundation and the simple [NSSound play].
  My program is playing one video track and 3 audio tracks arranged inside an AVPlayer. This is working nicely.  Independently, the program generates a metronome for each beat of the measure, following information from the music score.  The two metronome sounds are very short files that I load in an NSSound and use [NSSound play] to play them.  I noticed that I had to shift the metronome playback of about 90 milliseconds so that it is perfectly synchronized.  Part of it may be the exact moment when the impact of the metronome is located in the metronome file, but if that was the only reason, then this delay would be the same on all Mac computers.  However, on different Macs, this delay must be adjusted.  As it is a metronome beat synchronized with the music, it is quite critical, as a slight shift makes it sound off beat.  Is there any way to calculate this delay directly from AVFoundation API ?  Or to compensate it or to play the metronome in another way so that there is no delay between the AVPlayer and the NSSound play ?  I would appreciate some link or idea about this.
  Thanks !
  Dominique
  Arpege Music, Belgium</p>