   Synchronizing sound with action
  How do you do this?It seems that computer speed affects images much more than sound. How do experienced programmers deal with this: just by great programming, writing optimized code that makes images have very very small delays or are there some other tricks to it? (Maybe delaying the sound also?)  Thanks   
  I'd create separate thread for sounds.   ;  Synchronization of the sound and image is rather natural. Remember that if your game displays 60 fps, then each frame takes 16 ms to render (it is fast enough). You can use a tiny fraction of this time to prepare the redering of your sound.Regards,   ;  I assume you're talking about in-game sound effects. There's a certain amount of specification necessary, and often (the reverse of the movie industry) the action is queued to the audio. This is simply because we in the games (and CG) field have more control over our actors than a composer or foley artist has over their recording. I'll explain:Say we have a 'sword swing' action in game, and we've got a recorded sample for it. The foley artist (sound recordist) trims the sample so the attack (initial increase of volume for the effect) is at the precise start of the audio in the sample, and the decay (decrease in volume) zero's at the end of the sample, that there's no spatial distortion (reverb) that may be added in software later. This is a 'clean' effect. It also gives the precise length of the action that was just recorded for the animator to work with.This sample is passed to the animator for the sword swing action- the animation is set up so it is appropriate to the sound, and returns to a ready position afterward (this may be included in the sample length, but is usually silent).In game, both sample and animation are triggered at the same time (and thanks to the magic of timestepping the animation) should play simultaneously. Having streaming audio in a separate thread is a good idea here, preloading is pretty much essential.Often 'swing-hit' and 'swing-miss' are dealt with separately both in terms of animations and sounds- again, the audio sample (the hardest thing to adjust the precise timing of) is the pace setter.For long, complex animations, offsetting audio triggers into it (delaying sample playback till keyframes in the animation) *can* work, but you will get rounding errors in precisely hitting a timeslice that you wouldn't get with a consistent audio stream. It may be worth using 'cuts' and 'fades' (in the cinematography sense) to link smaller, more easily synchronised sequences.It's an interesting thing to note that it's *attack* on most sounds that people hear best, so having a shorter sample, appropriate for the initial burst of movement in the animation and a silent return to rest sounds quite natural. Apart from lightsabers, which people expect to hear *all* the time.;  ...and fortunately the human brain compensates for the slight delays you'll usually have when playing sounds. For example it's common to have a mixing buffer of some sort that's about 0.1s long. This means the sound actually begins to play about 0.1s after being triggered, but since we experience everything with a 0.3-0.5s delay anyway, it all synchronizes in your mind as long as it's not *terribly* out of whack. This is also why you don't generally notice the 0.1s delay between seeing and hearing something happen 30m/100ft away.   