title: Cocos Denshion: Play sound effect in sync with music
body: <p>I am making a music game and when the user presses a note it will produce a sound.  The sound naturally needs to play immediately when the user presses, so they can tell whether they are in time with the music.  However, it feels as if the sound is lagging, especially when note presses become quicker.</p>
  
  <p>My background .m4a music file is played with AVAudioPlayer.  I chose to use this over Cocos Denshion as I have access to the currentTime property.  I may be wrong, but I dont think I can access this with CocosDenshion.</p>
  
  <p>I made a .wav file which is extremely short (less than a second).  I preload my sound effect on init:</p>
  
  <pre><code>[[SimpleAudioEngine sharedEngine] preloadEffect:@"Assist.wav"];
  </code></pre>
  
  <p>Then to play the sound effect, in CCTouchesBegan I call:</p>
  
  <pre><code>[[SimpleAudioEngine sharedEngine] playEffect:@"Assist.wav"];
  </code></pre>
  
  <p>After that it calls my code to determine the users timing and awards points.  Any idea why it might be lagging, or a better way to play sound effects in time with music?</p>
  
  <p>EDIT: Ive tried a few things recently with no results.  First I tried playing the sounds automatically as they came up to the appropriate time in the song.  Still had the lag, so I dont think it is touch events being slow.  I also tried 3 different sound libraries.</p>
  
  <p>However, when I ran in the simulator, it seemed to not be laggy.  Does anyone have an idea?  Im clueless and its a major feature I cant really take out...</p>