Punch and Roll for Audacity in Linux using Autokey

audacity_logoMost of my friends know that as a side-line I narrate books for Audible.Com, and they might also know that I’m a Linux nerd, too.  Where those interests intersect, there is a wonderful open-source program called Audacity, which is a Digital Audio Workshop, that is, a program in which you can record, edit and master digital audio.  Musicians, narrators and voice-over professionals use such programs every day. Audacity, in addition to being jammed with features and options, is free. It’s the very tool to reach for if you are a dabbler, or on a constrained budget, but serious about doing good work.
Unfortunately, Audacity  lacks one capability which narration and voice-over, in particular, makes heavy use of, and that is a tool called “punch and roll”.  “Punch and Roll” allows an audio book narrator to edit mistakes “on the fly” while reading. It works like this: the reader hears himself flub a line or a pronunciation, stops recording, places the start-point line just upstream from the mistake, and hits “punch and roll”. Then these things happen automatically: the start-point jumps upstream an additional pre-set number of seconds (2-3 seconds are typical), the system starts playing the audio for the narrator to hear. As the time-line reaches the marked “flub-point”, the system stops playing, and begins to record. The narrator picks up reading, correcting the error, and the recording proceeds, as before, with the edited audio right where it belongs.

Ideally, the program should preserve both the original audio (the one containing the error), as well as the corrected stream. That may sound odd, I know, but is no less true. It doesn’t happen often, but it can be very important at times to have the original stream of audio, to fix subtle issues found much later on.  Being able to revert to the original version with the tool is called “non-destructive punch and roll”.

So, how can we do all this in Audacity? First know this: the Audacity DAW has versions that run in Windows and Mac, as well as Linux, and there have been a few clever people who have solved this problem for those systems already. My “punch and roll” solution for Audacity in Linux has been adapted from a solution posted by Steven Jay Cohen which works in Mac OSX. Cohen’s written a short piece of code that runs in AppleScript, to execute the correct keystrokes to allow non-destructive punch & roll in Audacity on a Mac. A bit of googling will also locate scripts that will achieve similar results using “AutoHotKey” on Windows computers.  My solution for linux makes use of a powerful macro utility called “autokey”, which runs scripts in the python programming language.

Here’s how to obtain punch and roll in Audacity on an Ubuntu/Debian linux computer:

1. Install autokey. On a gnome-ubuntu machine, from the command line run:

sudo apt-get install autokey-gtk

2.  From the desktop, launch the program menu, then Accessories, AutoKey. This should open the Main Window of autokey, and also place the autokey icon, a capital “A”, in your program tray.

The main window looks like this:

AutoKey Main Window
AutoKey Main Window

Now you are going to add a new script to the existing library you see on the left side of the main window. Do these:

1. Click where you see “+New”, choose Script from the menu, then give your script an appropriate name in the dialogue box. I called mine Punch&Roll.

2. Notice on the right side the box where you will input and edit your script. It’s marked # Enter script code:

#Enter Script Code
#Enter Script Code

blogYou will be pasting the code right below where you see:

# Enter script code

For those of you unused to working with programs, understand that where you see a hashtag (#) at the beginning of a line, the computer ignores that line when running the program. If you are modifying this script to troubleshoot it, you could insert a hashtag at the start of a line to remove it temporarilly from the program, or to create a note for yourself about what the next line is supposed to do.

Here’s the script that works for me. It sets 3 seconds of pre-roll:

##‭ ‬Autokey script to enable Non-Destructive Punch&Roll
‬##in Audacity using AutoKey.
#‭ ‬BEGIN SCRIPT
keyboard.send_keys‭(“<‬shift‭>‬+k‭”)
keyboard.send_keys‭(“‬z‭”)
keyboard.send_keys‭(“<‬ctrl‭>‬+x‭”)
keyboard.send_keys‭(“<‬enter‭>”)
keyboard.send_keys‭(“<‬ctrl‭>‬+b‭”)
keyboard.send_keys‭(“?”)
keyboard.send_keys‭(“<‬enter‭>”)
keyboard.send_keys‭(“<‬enter‭>”)
keyboard.send_keys‭(“<‬up‭>”)
keyboard.send_keys‭(“<‬enter‭>”)
keyboard.send_keys‭(“<‬ctrl‭>‬+v‭”)
keyboard.send_keys‭(“<‬enter‭>”)
keyboard.send_keys‭(“<‬up‭>”)
keyboard.send_keys‭(“<‬enter‭>”)
#The number of “,” below sets 3 seconds of pre-roll.
keyboard.send_keys‭(“‬,‭”)
keyboard.send_keys‭(“‬,‭”)
keyboard.send_keys‭(“‬,‭”)
#Below, (” “) encloses one press of the space-bar.
keyboard.send_keys‭(” “)
#Number for time.sleep below should equal number of (“,”).
time.sleep‭(‬3‭)
keyboard.send_keys‭(“<‬shift‭>‬+a‭”)
#Delay for sleep below makes resume-record work.
time.sleep‭(‬1‭)
keyboard.send_keys‭(“<‬shift‭>‬+r‭”)
#END OF SCRIPT

After copying this into the script editing box in autokey, do three more steps:

1. Set a hot key for the script, by clicking on the button below the script marked HotKey….Set. Then in the dialogue box that opens, click on “Press to Set”.  Choose a hot-key combination that doesn’t conflict with any other program or function: I recommend a combination of the <super> key (also called  the <windows> key) and the “z” key. So press and hold <super> and then press “z”. Then press Ok. You should see <super>+z has been set as your hot key.

2. It’s wise to set a Window Filter, so that your hot key will only be activated within Audacity. Where it says Window Filter, press Set. In the dialogue box where it says “Regular expression to match”, type in   Audacity.Audacity   ,  just like that.

3. Lastly, save your work: Click up above where it says Save, or simply press Ctrl-s.

Now, to use “punch and roll”, you need to set up Audacity very specifically for the script. It expects you will have two mono tracks above a label (bookmark) track. Audacity will launch a new track as soon as you begin recording, so I do these steps to get started:

1. Make sure AutoKey is running in the background (the “A” shows in the tray below on the right side).  Now launch Audacity, and make a short recording of 5-8 seconds.

2. Press “Ctrl-Shift-n” to make a second mono track below the first.

3. Press “Ctrl-b” to make the label track.

The top-most track is your production track. The next one down is your Edits track and will accumulate your saved mistakes as you stop, set, and then punch/roll to fix “flubs” on the fly.  It should look something like this:

Set up these tracks: Production, Edits, Bookmarks
Set up these tracks: Production, Edits, Bookmarks

To try it, you need to start with the time-marker set within the short piece of audio you recorded to launch the production track.

1. Put it near the end, but not all the way at the end.

2. Press <super>+z, and you will see the time marker jump back 3 seconds, play those three seconds, and then append a new recording to the production track as it reaches where you started.

You will also notice that all audio AFTER your start point will have been moved to the second audio track, where it will be saved, in case it’s needed to fix something. Here’s what it should resemble:

After one "punch & roll". Notice that my Edits track is muted, so it doesn't distract me as I re-record.
After one “punch and roll”. Notice that my Edits track is muted, so it doesn’t distract me as I re-record.

So there you have it! Non-destructive punch and roll for Audacity in Linux. My deep appreciation to Steven Jay Cohen for his excellent post explaining this process for Macs, without which this technique would still be a mystery to me.

 

Another new audiobook: ‘Dr Sam Sheppard on Trial’

Hot on the heels of ‘Resister’, my second non-fiction audiobook has been released: ‘Dr. Sam Sheppard on Trial: The Prosecutors and the Marilyn Sheppard Murder’.sam-sheppard-on-trial

Marilyn Sheppard, four months pregnant and mother of a toddler son, was bludgeoned to death in her Bay Village, Ohio, home in the early morning of July fourth, 1954. The cause of death was 27 blows to the head with a heavy instrument. Who took her life so brutally has been the subject of much controversy and debate for over half a century. Was it her husband, Dr. Sam Sheppard, who was convicted in what was then called “the Trial of the Century”, in the case that helped inspire the TV series and the movie The Fugitive?
Or was the killer, as Dr. Sam claimed, a “bushy-haired intruder”? Or could it have been Richard Eberling, the window washer who worked for the family, as the Sheppard’s son, Sam Reese Sheppard, believes? Dr. Sam spent 10 years in prison before the US Supreme Court overturned the initial verdict in an important legal decision, determining that the doctor did not receive a fair trial due to excessive press coverage.

Defended by F. Lee Bailey in his second trial in Cleveland, Sheppard was found not guilty of his wife’s murder. And then in 2000, in what has been referred to as “the Retrial of the Century”, Sam Reese Sheppard attempted to prove in a civil trial, while suing the State of Ohio for millions of dollars, that his father had been wrongly incarcerated.

This volume presents a comprehensive and final analysis of this controversial case from the perspective of the prosecutors. Jack DeSario, together with co-author William D. Mason, the chief attorney for Cuyahoga County, Ohio, provides all the facts, evidence, expert testimony, both old and new statements of the principals in this case, which concluded in April 2000.

Hear an excerpt, and buy the audiobook here, at Audible.com .

Please note this: If you become a new member at Audible, and make ‘Sam Sheppard’ your first paid purchase, it earns me a BONUS royalty that pastes a big smile on my face. (Let me know, and I’ll buy you a beer!)

You can hear samples from my other narrations at my professional site, Spoken-Arts.Swiftpassage .

©2003 The Kent State University Press (P)2014 Redwood Audiobooks

The new audiobook is out! ‘Resister’ by Bruce Dancis

resisterThis makes my third narration in release, and I’m well-pleased with it. It’s a story filled with a history I lived through, and close to home geographically, as well, set between metropolitan New York City, and Cornell University in Ithaca, NY.

The author, Bruce Dancis, tells of the commitment he and other student radicals of the ’60’s shared in their effort to stop the Vietnam war. The act of resisting conscription was deeply radical, a felony punishable by a crushing fine and hard time.  Dancis and his fellows in the Students for a Democratic Society did their best to inspire thousands to follow their example of destroying their draft cards, and flooding the legal system with “resisters”; young men refusing to support the  pointless and illegal war in Asia.

If you grew up in the 60s, and even if you didn’t, you’ll find this story engaging.  The times it describes are relevant to today. The turmoil of an unjust and unjustifiable war then can be related to the shocks and stresses of today.  The political and racial divisions of that time continue even now.  I recommend Dancis’ book as a powerful and personal testiment.

Hear a sample from the audiobook at Audible.com , and please know this: if you are a new customer at Audible, and make ‘Resister’ your first paid purchase, it garners a BONUS royalty for the narrator. Thanks!

You can hear samples of my other audiobooks at SpokenArts, my production web site, as well. The are ‘The Calamari Kleptocracy‘ by Nicholas Sansone, and ‘Headwind’ by Christopher Hudson.

Thanks for listening!

 

Sowing Dragon’s Teeth

I just finished an eye-opening book today: ‘Imperial Life in the Emerald City’ by Rajiv Chandrasekaran. It’s a journalist’s memoir of the occupation of Iraq which focuses not on the military aspects of the invasion but rather on the abject failure of planning and policy in the ensuing occupation. It’s a clear and well annotated account of a story that’s never been reported to the American people, except in the most vague of terms.

The Bush administration filled the CPA (Coalition Provisional Authority) with inept cronies, in preference to skilled non-partisan diplomats from the State Department. To rebuild Iraq’s health care system, they replaced an experienced ex-Navy physician-administator who had coordinated health care on a Kurdish mission with a conservative Michigan party hack, who devoted his time in Iraq to privatizing the country’s state-run pharmaceutical distribution system; an agency which due to looting had no drugs to distribute in the first place.big imperial

Six days before the hand-over of sovereignty to the Iraq-interim government, 2.4 BILLION dollars in US monies, IN CASH, specifically $100 bills, was transported into Baghdad, and transferred into purposes as yet unaccounted for. An additional 6 billion more in conventional money transfers can be added to that sum for the month preceding, also never accounted for. And those figures are a tiny fraction of the total squandered in the money-pit of the occupation.

The incompetance and corruption was everywhere. In instance after instance reported in Chandrasekaran’s book, it is clear that the CPA was focused on removing that which once actually served the Iraqi people, Saddam’s socialist infrastructure, rather than rebuilding that which two gulf wars had destroyed: the power grid, water system, and public infrastructure.

The occupation of Iraq completely destabilized that nation, led to the death of tens of thousands of their people, and now ten years after, has left a vacuum of tribal and civil warfare that continues with no end in sight. The greatest irony is that the Neo-conservative cronies in charge of the occupation are the ones most at fault for engendering the power of the present-day Shiite-led majority government.

Prior to the 2003 invasion of Iraq it could not be demonstrated that Al Quaida held ANY sway or influence in Iraq. Today they definitely ARE waging civil war in open revolt in Fallujah, while the government does what it can with the US trained and armed Iraqi
forces.  As a nation, it seems we’re always “sewing dragon’s teeth” abroad. Oh, well. At least the oil keeps flowing.

I experienced this book as an audiobook offering from Audible, narrated by Ray Porter, whose work is very fine indeed. Non-fiction narration can often be terribly dry and disinteresting, but Porter’s cadences, voicings, and use of foreign accents where called for kept this book alive and fascinating throughout.

Find it here at Amazon, or here at Audible.com.

Ann of Two Thousand Days

Ann of Two Thousand Days

As I go about my daily tasks–editing, running, cooking, what have you–I find myself increasingly obsessed with going to Mars. This has been going on for more than a month, ever since I got the Round 2 notification from Mars One in late December–a fact which played havoc with my carefully thought-out New Year’s resolutions. I had to revise them, and that did not make me happy. Contrariwise, it did add happiness and excitement and many wasted hours of dreaming to my day-to-day life.

Along about New Year’s, I also read an insightful post (contact me if you want details, as I’m simply too lazy to look them up right now) that in brief stated, “Don’t make a weighing-you-down list of things to do, like chores; instead, make a list of how you want to be, and tailor the list to achieving those “to be” goals. To be, instead of to do. I want to be a Martian. (Incidentally, I also want to be athletic, confident, and uncluttered–but when I think about it, Martian covers it all.)

So, I want to be a Martian. I passed my physical in January. The next step (it’s now early February) is an interview, probably sometime after April. I can’t wait that long. I have to wait that long. Grrrrrrr. The longer the wait, the more I do the “negative talking thing” to myself. I see a list of “Five People I Want to Go to Mars With” and I’m not on it. What do they know that I don’t know? Others get interviews; I send out feelers and get nothing. (I admit, self-promotion is not one of my fortés.) Other applicants are rocket scientists, physicists, mechanics, astrobiologists. I’m a … and here I draw a blank. I tell myself to start learning basic mechanics–that seems like a necessary skill. But when my outside weather display stops giving me outdoor temperatures on a really cold day and needs more than a change of batteries, I hand it to my husband, the mechanical genius. I should learn from him, I really should. Instead, I walk out to the front porch and feel the temperature. Yes, still too cold to run.

Should I be lucky (not skilled, not smart–remember what I said about self-promotion?) enough to go to Round 3, I’ll have to figure out why they want me, other than being an older person with limited life expectancy anyway. Having decent people skills and being a nice person seem like poor skills to list on a resume to be an astronaut. I can kind of garden in sandy soil, but that doesn’t seem much of a recommendation either, although it might have application to the dusty soil of Mars. I wish I’d paid more attention to tenth-grade chemistry class, the one that convinced me I wasn’t as smart as I thought I was.

ALL NEW AeroGarden EXTRA

And then Round 4, which consists of (roughly) two thousand days of training. That would be wonderful, magnificent, marvelous! I could train, I could learn anything they want to teach me. Astrophysics? No sweat. Microbiology? You got it. And then my New Year’s resolution hits: Why wait? Ack! How can I narrow it down? Maybe I should go fix my Aerogrow, the hydroponic garden that sits on my counter–or did, till it broke. You can fix it, Ann; it’s not rocket science. Yet.

(Elliott–if you’re reading this and you come home to a torn apart, nonfunctional, machine sitting on the kitchen counter and a despondent wife scratching her head, feel free to–gently, quietly–help put it back together.)

Cedar Key Nomadic New Year Convergence

We spent a week at Cedar Key,  getting home yesterday feeling rested and contented. We have a special friendship with a community of people who live the peripatetic life: They are nomadic, you see, working jobs they can perform most anywhere, most of them. Oh, some of these folks self-describe as retired, but in truth are roaming, seeking, and working at all manner of things along their paths.  Many of these folks converged at Cedar Key for New Year’s Eve a year ago, and the same tribe (with many new representatives) did so again last week.

It was a colder winter there this year, and with a pair of rainy days that had our little camper, The LeSharo, dripping a bit from around the ceiling vent, but this didn’t dampen our spirits. We walked, and ran, and did yoga during the week, and made new friends every day of our stay.

We participated in ‘Bar Wars’ for the evening of NYE; an event where contestants made and served cocktails of every description, sharing favorite recipes. I fixed Vodka Gummy Worms, with hilarious results. Pro tip: I should have started them three DAYS earlier for best results. They are far too chewy after only 3 hours.

We read, and read, and read in our snug little camper on the slack hours, and dined here and there,  sharing fixings and condiments in the rolling home of our friends. It’s easy to imagine doing this sort of thing when it’s time to hang up my clinical job, oh, many years from now.

In recent reading, I’ve learned that human beings were massively changed by the advent of agriculture, being fixed to tilled land, their nomadic ways arrested by cleaving to one place. For one thing, sharing basic needs was curtailed. Acquisitiveness, ownership, and guarding one’s “lot” came to replace general sharing of everything.  Human “classes” came into being. Agriculture, while it sustains more complex civilizations, does not improve the welfare of all, but balances the improvements enjoyed by landowners and their “priests” on the backs of the balance of the closed tribe, and fully excludes “The Other”, all those wanderers who exist outside the fringes of the one tribe. Workers and Warriors support Landowners and Priests, unified in the task of excluding and defending against The Other,  even if they all share the same basic DNA. Peace cannot be a part of this construct.  Sadly, it always comes down to Us and Them.New Year Ann 2014

It is so ironic that in The Book of Genesis it says that Adam and Eve were cast out of The Garden, to toil ever after in their own damned garden. God’s Garden was the free range, where Wanderers gathered of  The Plenty, and shared freely.

Modern motorhome nomads tend to emulate God’s Garden and ancient nomads because it rapidly builds Community among transients in the moment of being together.  It is warm, and lovely, and just the best thing ever. I’ll give you an instance: One afternoon this past week, there was a spontaneous “Swap Meet”: people brought things they’d found themselves carrying around that they had no use for. People laid stuff out, and people just admired, and conversed, and tried on old hats, and laughed over hip-waders and cookware. And eventually, everything was picked up, and stowed away in EACH OTHERS ROLLING HOMES! If any money changed hands in this process, I never saw  it happen.New Year Technomadia 2014

Nomads are like that. I just love being around them. As a lesson for the New Year, and all the years ahead, it’s one to bear in mind: Be open to others, share what you have, and love beyond the limits of your own  “tribe”. If you drop your fences, and wander “outside”, you will be astonished at what you receive, and the freedom that you find.

On My Way to Mars, One Step at a Time

I am one of the 1,058 worldwide applicants who were chosen to continue in Round 2 of the selection process for Mars One (and apparently one of only 20 or so over the age of 55 in the United States).

How do I feel about this? Excited, hands down.

But perhaps I’m in denial. Why me? I’m not *that* special. The whole thing is kind of unreal, hard to believe. I have to pinch myself. Maybe they only had 1,100 applicants and 42 of them screwed up the application by mistyping their own email address? Maybe their PR guys told them to accept a bunch of old people so they wouldn’t get sued? Whatever the reason, whether there were only 2,000 applications or 200,000, I’m still in the running–and I’m taking it seriously. Wheeeee!

Why Mars? Well, duh: Because it’s there. And it’s part of a big mystery, a puzzle waiting to be solved. Do I really believe there are aliens there? Not really. Alien lifeforms? Well, maybe fungus or something, though I think it’s unlikely. My science knowledge is somewhat sketchy. We won’t know till we get there, will we? (And by that time, I hope I’ve soaked up a bit more knowledge about such things. And mechanical stuff. Have I mentioned that’s not my forté?)

I’m okay with it being a one-way trip, I really am. That’s not to say, I won’t miss Elliott–I will, enormously. And I’ll really miss the girls. How will their lives turn out? Will they be happy? I’ll never have the chance to hold grandchildren, but maybe I’ll be a part of an opportunity for those potential grandchildren, or somebody else’s grandchildren. We’re doing a pretty good job messing up this planet; I’d like to think I could help get started on the right track on another one where we’re maybe not so insensitive to what’s around us. (Note to daughters: Do not go out and get pregnant on my account…No! No no no no no no no!)

But that’s assuming I even make it. I will be in the neighborhood of 72 years old at the time this takes off, and probably somewhat akin to the canary in the coal mine. After all, if a 72-year-old dies trying to repair a whatchamacallit off the whosit somewhere out in deep space on a long leash (remember, mechanical stuff is not my forté), everyone can say I had a long, happy, exciting life. If a 23-year-old dies, it’s a PR nightmare. (Who, off the Challenger, do you remember most? The young happy teacher and mother of young kids or the older professionals? Can you even name someone other than Christa McAuliffe?)

Why me? Maybe because I don’t have an agenda, other than seeing this whole thing work on Mars. Not just work, I’ll say thrive. I want the Mars One colony to thrive on Mars. I don’t want to populate it with evangelican Christian babies (or fill in whatever group you want); I don’t want to exploit it more than necessary; I don’t care whether people are Democrats or Republicans. Okay, yes, I do have an agenda: to make it worthy of a dream for someone else to follow. Idealistic? Heck, yes.

Or maybe because they were desperate? Nah, I’d rather think the selection panel was intelligent, discriminating, and persnickety. Yeah, I would.

Mars One is a nonprofit organization geared toward getting humans on Mars in about 2024. You can find out more information at http://www.mars-one.com, and they have a fundraiser at Indiegogo, http://www.indiegogo.com/projects/mars-one-first-private-mars-mission-in-2018. (Fundraising will be, I suspect, a key part of applicants’ ability to progress…though I’m not a salesperson. Go look, see if you think it’s worthwhile, fund if you do. There.)

I’ll keep you posted…eventually. In the meantime, if you see me wearing a bracelet that says WWMD and I’m doing something particularly crazy, it does NOT mean What Would Morons Do.

 

 

A Hourney to Jaco, Costa Rica

My wife, daughters and I traveled to Costa Rica a few weeks ago on a first family vacation in some years. More often when we do this, there’s one or some of Ann’s kin at the other end of the road. The last time I think there was a wedding, too, out in Oregon. If I’ve misplaced some intervening journey, please someone refresh my memory.  However, this trip was for us as a nuclear family, sans extensions, to the beach town of Jaco, CR, pronounced Haco.

The centerpiece of Jaco,  for us was, hands down, the zip-line adventure.  Many photographs were taken. My face may have betrayed a wee bit of anxiety at times. For a pilot, I am surprisingly uncomfortable with heights experienced without the benefit of wings, ailerons and rudder.

A close second for me was simply walking,  exploring a road up into the mountains overlooking the Pacific, or strolling into Jaco town along the beachfront, watching surfer bums. We also rode the buses down to Manuel Antonio National Park,  where Ann and Kelly saw a monkey in the wild, and I communed with yet another iguana. Iguanas are curious, and rather sociable if you offer to take their picture. It might be natural vanity on their part.

Such a beautiful coast line! One can’t help but imagine retiring there, but, alas, my trip was marred by two episodes of pilfering by the locals. The first was losing my cellphone to (most probably) a Costa Rican airport security worker in San Juan. I also foolishly left a backpack out of sight on our bus ride to the park, and it was spirited away by a clever thief. That cost me two pairs of glasses, and my swimsuit!  A neighbor here had warned us of the casual attitude toward and presence of larceny in C.R., and I can attest, it’s true!

Enjoy these pictures!

 

…our word-window on the world.