Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Timing of sound effects

Recommended Posts

This question is really aimed at those with an intimate knowledge of how the Vanilla Doom or Doom2 engine works.

I am trying to edit gameplay videos and, for various reasons, it is useful for me to capture audio separately for editing. When I come to put audio back with video (in Filmora 9) I need specific markers to help me do this.

The best I have managed so far is to record myself firing a shotgun repeatedly at 30 frames per second, which is the best rate I can reliably get, and then note how many frames after the shotgun lights up the sound effect of firing begins.

These experiments yield results of 2,1,2,2,just under 2,2,just over 2, just under 2,just under 2, just under 2, 1.5,1.5,1.5, just under 2, 1.5, 1.5, 2.5 frames.

I know there will be variability because the tic of firing may occur just before or just after a 1/30th of a second moment that a frame happens.

I know Doom primarily measures time in units of 1/35 seconds, so does anyone know what the true delay is between the shotgun appearing to fire and getting the sound effect? 

Share this post

Link to post

Also, for uploading videos of Doom, which video/audio capturing software would anyone recommend?

I use the PrBoom+ source port on Windows 10. I have found reasonable results from the Xbox Game Bar but the sound often has glitches in it, i.e. periods of reverb that last several seconds and are very noticeable. 

Share this post

Link to post

I also record sound separately. How do I sync the two up? I load the video and audio channels into Premiere and nudge the audio back and forth until it sounds right. Syncing a separate voiceover is slightly harder than it sounds - I would instinctively fire off a pistol shot as an audio clapperboard, but in Doom that would alert all the monsters!


As for capturing gameplay video, NVidia's Shadowplay is easy to use and works well. That's how I created this video of me finishing E4M2:



Share this post

Link to post

The simplest would be to go to the ZDoom wiki and read the simplified actor code for the weapons. It's accurate to how it works in vanilla Doom, but much more legible even to non-programmers. Specifically, you'll want the part of the state table that deals with Fire.


For example, the regular shotgun:

    SHTG A 3
    SHTG A 7 A_FireShotgun
    SHTG BC 5
    SHTG D 4
    SHTG CB 5
    SHTG A 3
    SHTG A 7 A_ReFire
    Goto Ready

That gives you the table for the shotgun's animation.

You have frame A for 3 tics. Then, still with frame A, you shoot -- that action A_FireShotgun will do the attack and play the sound, which is what you're looking for. The action is run when the state frame is entered, not when it's completed, so you don't wait 7 tics before hearing the sound. Then you have frames B and C, lasting 5 tics each, then frame D, lasting 4 tics, then C and B, five tics again, and again A for 3 tics.  Then there's A_Refire, which means that if the player kept pressing the shoot button, the code will jump directly (and without waiting) back to the fire state (the first frame after the "Fire:" label), otherwise the 7 tics are waited normally and then the gun goes to the ready state, until the player hits the trigger again.


In short, from the moment you click to shoot:

3 tics before the sound is played

34 tics before checking if the player is holding fire, in which case shoot again


Which means that if you hold fire with the shotgun, you first shoot 3 tics after you clicked, and then every 37 tics afterwards.


1 hour ago, Ashley_Pomeroy said:

I would instinctively fire off a pistol shot as an audio clapperboard, but in Doom that would alert all the monsters!

If you have the chainsaw, switching to it then back to something else quickly could do that work. Monsters hear you doing fist pumps in the air, but they don't hear a revving chainsaw.

Share this post

Link to post

Thanks guys! I feel more confident now about synchronising the audio. I have also found that on my demos I often pick up health and armour bonuses with no monsters growling in the area so there are some very clean sound effects from picking them up which I can synchronise with the 'picked up a health bonus' messages on screen. 

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now