Stifel's Audiobooks Blog

Tech Tips and Opinions for the Audiobook Community

Using Keyboard Macros Pt. 3 – The Room Tone Macro

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

Using Keyboard Macros Part 2 – AutoHotKey

Using Keyboard Macros Pt. 2


So how the heck do you create these keyboard macros? You can’t do it just with Windows, nor with a Mac – that functionality is not included in either operating system. You need to acquire a keyboard macro program. For Windows, this is a piece of freeware, available at . (The freeware status of this program has apparently caused some rifts with the developers. There is now a claiming to be the definitive and newest version of this program. Caveat emptor – I am currently running version, the one you can download from .)

Let me reiterate here, this part of the series relates to all Windows users. Even if you don’t use the same DAW as I do (Sony Sound Forge), the software I’m talking about today will work on any of the DAW platforms you may be using.

As for Mac users, do a web search on “keyboard macros for Mac” to see what utilities are available for you to use. Though the exact syntax will differ, the concepts and general approaches I describe will – hopefully – translate to both PCs and Macs.

So, you web surf to, and download the install program. Simply double click on it once you’ve downloaded it to initiate the installation. Should be very quick.

The online documentation for AutoHotKey is valuable and pretty extensive. If you are really motivated, by all means read through it for a much fuller account of this utility. For now I want to describe the high level operation, since the documentation can be too much of a good thing if you are just beginning.

What have you done exactly by “installing” AutoHotKey? This program is now running along with Windows every time you boot up until you power down. It will not show up in your task bar. It will show up as a process in the Task Manager. The program is simply sitting in memory, waiting for you to tell it to do something. Until you do, you’d never know it was there.

The way you tell AutoHotKey to do something is to create what we call a command script, or command file. You could use a fancy word processor for this, but only if it lets you save files as text only. The formatting information in complex word processor files will completely confuse AutoHotKey and make a mess of things. Best to just use Wordpad to create and edit command scripts – and be sure to save as text only!

The command file you create with Wordpad may be named anything you wish, but the file extension, the last three characters of the file name following a period MUST be .ahk. Filename.ahk. Anyname.ahk. Once you’ve saved this file, you find it in Windows Explorer, or paste a copy to your desktop. Double clicking activates it. Just like any program, you double click on this file name to wake AutoHotKey up – the ahk extension is how AutoHotKey knows to read this file and do something with it.

You can tell if any scripts are active by checking the Windows taskbar. An active script (you can run more than one at a time) shows up as a green icon with a capital H in the center. You can right click this icon from the task bar to edit that script, pause the script (ignore it temporarily), or exit – wipe the script from memory so that it is no longer active at all.

AutoHotKey Scripts – Bare Basics

An AutoHotKey script does two things:


  1. Identifies the keyboard keys that you want to take over and give extended (or diminished) functionality to.
  2. Tells AutoHotkey when it gets one of these re-defined keystrokes, what to do with it and what commands to send down in place of that keystroke.

Let’s start with a real, simple but nontrivial example. Let’s say I want to completely turn off the F9 key.

Your script to do this would look like this:



The F9 is a “standard” key name understood by AutoHotKey. The two colons :: signify “Here follows a definition for the preceeding key.” The “return” is a built in command understood by AutoHotKey to mean do nothing more, you’re finished for this key. That little chunk of code will disable the F9 key (stay tuned for why anyone would want to do that in the first place. I have a danged good reason.)

So you type those two lines into Wordpad, you save the file as text only and give it the name “DeadF9.ahk”. Now when you double click on DeadF9.ahk, the F9 key will indeed be completely dead. It will continue to be dead until you reboot your computer, or you can exit the script by right clicking it from the task bar. You only need to activate a script once. If you try to activate it a second time, AutoHotKey will tell you it’s already running, do you want to run two copies (I have not yet found a situation where that would be useful.)

A few more conventions for scripts. You would seldom want to change the meanings of any of the alphanumeric keys on the keyboard, nor would I recommend redefining any of the punctuation keys. The ones I use consistently are control-key combinations, alt-key combos, and function keys. Such well known combinations as Ctl-C to copy, Ctl-X to cut, and Ctl-V to paste – these functions are so ubiquitous, I would not recommend redefining them either.

But stuff like CTL-U, CTL-I, Alt-M – stuff that is not universally used by Windows is fair game. In your command script, such keys are shown with a carat ^ to indicate the control key, followed by the alphabetic key. Thus Ctl-u in the AutoHotKey script would say:

^u::                              ; redefine Ctl u

And here’s another useful feature – see the semicolon in that line? The semicolon in command scripts means that AutoHotKey will ignore the semicolon to the end of the line – it is not a command for AutoHotKey, it is a helpful comment to describe in English what’s going on. It’s what programmers call self-documenting code. Use this feature liberally – scripts can get involved and hairy real fast. Leave bread crumbs to tell yourself what you’re doing.

FYI the shorthand for the Alt key is the exclamation point ! – !m would mean the Alt-m combination. The function keys are a piece of cake F1, F2, F3 etc.

A number of special keys have internal definitions, and are specified with curly braces enclosing the keyname. {Enter} = the enter key, {Tab} = the tab key, {NumPadDown} = the down arrow on the numeric pad. (See why I recommend reading the documentation? There’s far too much to cover here, I’m just trying to give you the flavor, and the basic stuff you’ll need to understand the coming examples.)

Okay, absorb this information and get ready for the next installment. I will show you a command script that will let you paste room tone over any mouse selected area in Sound Forge – with a single keypress. This makes covering a selected area with room tone just as simple as zeroing it out – except the room tone will get you past QA, and zeroing it out won’t.

Coming next in Part 3: One keystroke to cover selected area with room tone.

© 2014 David Stifel – All Rights reserved


Using Keyboard Macros – Part 1

Welcome to my blog!

This is the first in what I hope to be a series of useful and thought provoking posts to the audiobook world. I’ve found the online presence of narrators and producers who hang out in the ethersphere together to be the most genial bunch of good hearted people I’ve ever found. And I want to give back to this community.

So I’ll be offering tech tips, advice, curmudgeonly opinion stuff that’s too long to fit comfortably into the social media platformsall’s fair game as long as it’s audiobook related. For starters, I’m going to do a series on keyboard macros and why the heck you narrators, editors and producers should care about them!

Using Keyboard Macros Pt. 1

Most of you have heard about keyboard macros. And that’s about the extent of it.

What every one needs to hear is that “Keyboard Macros are an invaluable productivity tool for those of us who do any editing to their sound files.”

Okay. So what is a “keyboard macro” anyway? A keyboard macro is variable list of keyboard (and/or mouse) commands, defined by you, that accomplishes complex tasks with a single keystroke. Let’s take a really simple example – padding the front of an audio file with a half second of room tone – and only a half second of room tone.

Normally you’d do something like this:

  1. Put your cursor right before the start of the first sound in the file.
  2. Delete everything from the cursor to the beginning of the file (eliminating all the existing room tone at start of file, because its duration is not known.)
  3. Go to another file that contains pure room tone of several seconds duration.
  4. Copy exactly a half second of this room tone file.
  5. Go back to your first track and paste the half second of room tone where the cursor sits.

Simple, really. But note how many keystrokes and mouse clicks it takes to accomplish this. Numbers 1 and 2 above are pretty simple mouse actions. Number 3 could involve bringing up a file menu, selecting “Open” on that menu, navigating with the keyboard and mouse to where the room tone file lives, opening it. NOW – set a start point in the room tone file, use keyboard commands to select exactly a half second duration. Keyboard command for copy. Keyboard command to go back to main file. Keyboard command to paste current clipboard contents into the audio file at the cursor.

Not too bad, really, until you consider you do this a lot of times when editing a sound file, don’t you? You need to insert a half second of room tone at file start – you need to insert 2.5 seconds between chapter headings and narration, and 3.5 seconds at file end. A half second of room tone is really useful for pasting into the file when you want a little more time between sentences, or paragraphs. Sometimes you’d like to fine tune your timing like this but the repetitive keystrokes and mouse commands get so tedious you say, “Naw, it’s good enough. This is taking too much time”

What would it be like if you could tell your computer, “Every time I hit the F12 key (I never use it for anything else anyway), I want you to insert exactly a half second of room tone into my file at the current cursor position.” Wouldn’t that start to make life easier, and your throughput a lot faster?

That’s exactly what a keyboard macro does for you. It strings together combinations of keyboard commands and mouse actions to accomplish complex tasks with single keystrokes.

So I will be blogging over the next few weeks about some useful keyboard macros I use that may help you grease your editing throughput. Here are the assumptions:

I work in a Windows (XP and 7) environment with Sony Sound Forge Audio Studio 10 as my DAW. The code examples I will give will be specifically for these tools – but I hope to write generally enough for Mac users and non-Sony users to be able to take this information and apply it to their own situations intelligently.

Coming next in Part 2: AutoHotKey – a tool that lets you create your own keyboard macros.

© 2014 David Stifel – All Rights reserved