Using Keyboard Macros Pt. 3 – The Room Tone Macro

by dstifel

Certainly one of the most traumatic moments during my narrator’s journey was the one where I learned that editing out bad noises was NOT done by silencing the noise. It had to be painted over by room tone. “Oh noooooo, Mr. Bill!!!”

The angst is because painting with silence is an easy operation in my editor. It’s a customizable menu button so at any time during editing, if I’d click on this button the selected area would be erased. No such ease with overlaying with room tone. In Sound Forge, that’s done by a “Paste Special” which entails bringing up a couple of menus, making selections and finally selecting the “Special Paste – Overwrite” operation. There is no hot key or quick menu shortcut to get its functionality.

The functionality is pretty spiffy. It relies on a piece of room tone being copied onto the Windows clipboard – a Windows copy command. Paste special will apply that room tone to any selected area and replace the selected area with room tone. The original duration of the selected material is honored – if the room tone is longer than the selected area, only enough material is used to fill the selected area. If the room tone sample is too short for the selected area, only the first part of the selected area will be altered. The memorized room tone, therefore, must be as long as the longest piece of your file that you would want to repair at any one time. I’ve found 15 seconds to be more than enough.

One approach on one of the (much) more expensive DAWs to this is to silence all the noise and rely on a secondary layer of pure room tone to poke out from the holes. This approach also means you have to assemble a room tone file long enough for the entire file. I wonder if this approach is taken because overlaying each individual edit with room tone isn’t as easy as silencing.

So what a drag! I have to do these Special Pastes with about 6 more user input actions for each one than before when I could do it with a single mouse click. Ugh! And the vast majority of the operations I perform while editing are these – I’d guess about 75%!

This is exactly what AutoHotKey is good for. By the time this article is finished, I’ll have shown you how to do a “Paste Special – Overwrite” in one keystroke.

Here’s what you have to do in Sound Forge:

  1. Select a section of the audio file that needs to be replaced by room tone using the mouse.
  2. Click on the Edit Menu from the top toolbar (or use the keyboard shortcut Alt-E)
  3. Select and click Paste Special on the menu (or use the keyboard shortcut e)
  4. Select and click Overwrite from the submenu (or use keyboard shortcut o)

That causes the contents of the clipboard to be pasted over the selected area of your file. It’s not an onerous sequence of things to do, but you have to mix mouse and keyboard actions, and navigating menus with a mouse really interrupts a work flow.

So let’s automate this process. Let’s start with choosing a key to assign to this function. I myself almost never use the Function keys either in every day Windows or in Sound Forge. Function keys have an advantage over Ctl or Alt combinations. I almost always have to drop my eyes from the monitor to the keyboard to do a Ctl or Alt combination, and often need both hands, taking one hand off the mouse. A function key is a single key easy to hit even if I’m not looking at it. I’m right handed, so I use the right hand on the mouse, and the left hand for keyboard when I’m editing. I like to anchor my hand with the thumb over the Enter key – ideally, I would seldom need to move my hand from that position. The F8 key lies very conveniently near my ring finger when my hand is anchored thumb to the enter key. So I select the F8 key to redefine.

F8::                             ; redefine the F8 key
    Send !e                      ; Alt-e – select the edit menu
    Send e                       ; e – Select Paste Special
    Send o                       ; o – Do an overwrite
return                         ; and we’re finished for now.

This little script does steps 2, 3 and 4 above – the ones that really interrupt your work flow. Since any section of the file you’d want to operate on is a variable depending on what you hear in that section, this is an action that won’t work automated – so you still have to use you mouse to select the area you want pasted with room tone. But now all you have to do is:

  1. Select area to overwrite with room tone with mouse.
  2. Hit the F8 key with your left finger.

Done! (That’s assuming you’ve saved the above script into a file with the .ahk extension, and you’ve activated it by double clicking on it. From now on, I’ll assume you remember to do this.)

Oooops! One little item we didn’t do. We haven‘t copied the room tone into the clipboard yet, so the operation does nothing. Here’s where I had to decide whether to automate this or not. I could add commands to our macro to open a room tone file somewhere and then select it all and copy it into memory. But that creates more problems than it solves, mainly in the time it takes to execute the macro. Opening a file takes time, once it’s already open, the system puts up a dialog box asking if you want to shift focus to that already open file, which needs one extra keystroke some of the time. And you really need to copy the room tone into memory only once.

So I have chosen to add a little ritual every time I edit.

I open up my room tone file as one edit window. I select the whole file with Ctl-A. And I copy the file into clipboard memory with a Ctl-C. I leave the file open, then open the main file I’m going to edit. Thus I have the convention that I’ve always got two open files as I edit – the file being edited, and the extra room tone file. That’s deliberate for other reasons I’ll discuss when we get to the “Add half second of room tone” macro.

Given that I have my room tone in clipboard memory, and the macro is working properly, I find my edit speed improves – a lot! Listen – Stop (I heard mouth noise in a pause). Select the mouth noise area with the mouse. Hit F8. Click the cursor a little before the section I changed so I can hit playback and hear what I’ve done. Restart playback. Repeat as necessary.

I can automate this even more! Since I almost always want to back up and hear the playback over what I just did, I can add that action to the macro. Doing it with the keyboard is a bit tricky (the mouse needs human intelligence to decide where to click.) When you selected the edit area previously, we aren’t quite sure where in the area the cursor lies – at the start or end of the section – that depends whether you selected it left to right or right to left with the mouse. So I cannot make any assumption about where the cursor lies in the selected area. To do this error free every time, I go through these steps for the continuation part of the macro:

  1. Hit the Home key – this guarantees that the cursor is at the start of the currently selected area.
  2. Now that I know the cursor is right at the start of the selected area, I can use the LeftArrow on the keypad to bump it a little to the left. That also deselects the current area, so that playback is not limited to only the selected area.
  3. To bounce the cursor backwards a bit Sound Forge has a keyboard command o – that selects an area backwards of the cursor. Hit the Home key again to bounce the cursor to the start of that area – THAT is a good start point for the playback. Hit the LeftArrow key again to deselect this area (we want to be able to listen to the entire file now). Hitting Enter now restarts playback from a little before where we made the edit.

So the full script now looks like:

F8::                             ; redefine the F8 key
    Send !e                      ; Alt-e – select the edit menu
    Send e                       ; e – Select Paste Special
    Send o                       ; o – Do an overwrite

    Send {Home}              ; cursor to start of selected area
    Send {NumpadLeft}    ; deselect this area

    Send o                       ; select a new area a bit before the cursor
    Send {Home}              ; Cursor backwards to start of the area
    Send {NumpadLeft}    ; deselect the area
    Send {Enter}               ; restart playback
return                         ; and we’re finished for now.

Overlaying with room tone just got as easy as silencing. Actually, even easier with the restart playback commands built in.

That’s a lot! To make playing with this script easier for you who have Sony Sound Forge (Audio Studio, no promises made for other variants), I have added a download link if you’d like to download a copy of the script described here – RoomTone Paste script.

Coming next in Part 4 – Punch and Roll for a DAW that “doesn’t do it”


© 2014 David Stifel – All Rights reserved