Hack52.Automate Audio Hijack Pro


Hack 52. Automate Audio Hijack Pro

Automate your Audio Hijack Pro recording sessions with its support for AppleScript.

Audio Hijack Pro [Hack #50] is the premier low-cost audio recording solution for podcasting. It integrates nicely with the audio from other applications, such as iTunes, making it easy to do a one-shot recording of a show that's fairly complex in structure.

In its latest release, Audio Hijack Pro (AHP) includes extensive support for AppleScript. This make it possible to automate AHP individually and to choreograph your recording with other scriptable applications such as iTunes or QuickTime Player.

You can script AHP in four different ways:


External scripting

Using Apple's Script Editor or AppleScript Studio, you can control AHP from outside the application. For example, you can create buttons to start and stop recording AHP from an AppleScript Cart application.


Menu scripts

AHP has a script menu where you can add your own custom scripts. To add a script, simply save your script file from Script Editor in the Library/Application Support/Audio Hijack Pro/Menu Scripts directory.


Post recording scripts

These scripts are attached to sessions and run when the recording finishes. The AHP help has information on how these scripts are structured and where they go. AHP is preinstalled with a script that automatically imports the recorded file into iTunes.


Recording Bin script

AHP has added AppleScript support to the Recording Bin. It is preinstalled with scripts that export the media to your iPod or to iTunes, or that re-encode the audio in various forms. Information about how to create your own Recording Bin script is included in the AHP help.

8.4.1. Sample Scripts

I've included some example scripts to get you started with your own AHP automation. Simply type the code into the /Applications/AppleScript/Script Editor application in a new AppleScript document.

8.4.1.1 Start recording a session.

This script finds the session named bc and starts hijacking it, then recording it:

        tell application "Audio Hijack Pro"            start hijacking the session named  "bc "            start recording the session named  "bc "        end tell 

You need to start hijacking before you can start recording.

8.4.1.2 Stop recording a session.

This script will stop the recording on a session named bc:

        tell application "Audio Hijack Pro"            stop recording the session named "bc"            stop hijacking the session named "bc"        end tell 

8.4.1.3 Start and stop two sessions.

Sometimes you will want to start and stop two sessions almost simultaneously. Here is the script to start the two-session recording. This will start the hijacking and recording of Skype Headset Output and Skype Headset Mic as close together as you can get:

        tell application "Audio Hijack Pro"            set chan1 to the session named "Skype Headset Output"            set chan2 to the session named "Skype Headset Mic"            start hijacking chan1            start hijacking chan2            start recording chan1            start recording chan2        end tell 

To shut them down, simply reverse the script:

        tell application "Audio Hijack Pro"            set chan1 to the session named "Skype Headset Output"            set chan2 to the session named "Skype Headset Mic"            stop recording chan1            stop recording chan2            stop hijacking chan1            stop hijacking chan2        end tell 

8.4.1.4 Set the ID3 tags.

AHP gives you full access to the session's ID3 tags. Here is an example script that sets all the different ID3 tags:

        tell application "Audio Hijack Pro"            tell session named "bc "                set title tag to  "my title "                 set artist tag to  "my artist "                set album tag to  "my album "                set genre tag to  "my genre "                set track number tag to  "10 "                set year tag to  "2005 "                set comment tag to  "my comment "            end tell        end tell 

You can use a script like this to set the ID3 tags with some information that AHP might not have, such as the ISBN number of the book you are reviewing in your podcast.

8.4.1.5 Set the output directory.

Another handy thing to set automatically is the output directory:

b        tell application "Audio Hijack Pro"            tell session named "bc "                set output folder to  "~/Desktop/bc "            end tell        end tell 

By automating both the Finder and AHP, you can have the script create the output folder you want, and then set the session output folder in AHP to that new folder. More recent versions of AHP will automatically create output folders if they are not found when the recording session starts.

8.4.1.6 Set the output filename.

AHP has a wide variety of options for output filenaming, but you might have reasons to automate this yourself. Here is a simple script to set the output filename format:

        tell application "Audio Hijack Pro"            tell session named "bc "                set the output name format to  "%date %index "            end tell        end tell 

8.4.1.7 Set the input or output device.

When AHP can't find a device, it sometimes sets the input and output devices back to something safe, such as the system-standard input and output devices. This first script sets the input device to whatever you want. In this case, I'm setting the input device of the session named bc to the internal microphone:

        tell application "Audio Hijack Pro"            set inputChannel to the audio input named               "Built-in Audio: Internal Microphone "            set input device of session named  "bc " to inputChannel         end tell 

A script that sets the output device is just as simple. Here I'm setting the output channel to the two-channel Soundflower device:

        tell application "Audio Hijack Pro"            set outputChannel to the audio output named  "Soundflower (2ch) "             set output device of session named "bc" to outputChannel         end tell 

8.4.1.8 Inspect the Recording Bin.

You might want to have a script look through your Recording Bin to remove, process, or move recorded files. This small script walks through the entire Recording Bin and prompts you with the path-name of each recorded file:

        tell application "Audio Hijack Pro"            repeat with recording in audio recordings                display dialog (path of recording as string)             end repeat         end tell  

The important parts are the repeat statement that iterates through all the recordings, and the path of recording portion that gets the path to the recorded file. The name of the file is also available as name of recording.

8.4.2. See Also

  • "Record Interviews on Skype" [Hack #35]

  • "Timestamp Your Show Notes" [Hack #53]

  • "Build a Simple Sound Cart for Macintosh" [Hack #54]

  • "Build a Simple Sound Cart for Windows" [Hack #55]



    Podcasting Hacks
    Podcasting Hacks: Tips and Tools for Blogging Out Loud
    ISBN: 0596100663
    EAN: 2147483647
    Year: 2003
    Pages: 144

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net