Wednesday, February 6, 2008

Automate Audiobook2PSP

This will be a three-part workflow: it will first prompt the user to select a text file; it will then read the text file to AIFF and convert it to MP3; and it will finish by moving the created audiobook to the proper place on your PSP.

Choose a text file
Open Automator and select the Finder from the Applications pane. Drag the "Ask for Finder Items" action and the "Open Finder Items" action into your workflow. In the first action, set "Type:" to Files and "Start at:" to Desktop, then type Choose a text file to convert to MP3: in the "Prompt:" field. Leave the Allow Multiple Selection box unchecked. This part of the workflow will open up a dialog prompting the user to select a text file for conversion to MP3 and then pass that text file along to the next action.

In the second action, set "Open with:" to TextEdit. The text file selected in the first part of the action will open in TextEdit. That's it for the first section of this workflow.

Convert the text file to an MP3
Next, select TextEdit in the Automator Application pane. Drag the "Get Contents of TextEdit…" action into the workflow. This action simply scrapes the text from the front-most page (the page that the first part of this workflow just opened) in TextEdit and passes this text along to the next action.

Next, drag the "Text to Audio File" action over to the workflow. Here you can choose whichever System Voice you prefer; it will default to whatever voice you have set in System Preferences Speech Text to Speech. Whatever name you give the audio file under the Save As: field will be the same name (minus the .aiff) as the final track as it appears on your PSP. I went for the generic audiobook.aiff, but feel free to name your track whatever you like. Set Where: to the Desktop.

Select iTunes in the Application pane of Automator and drag the Import Audio File, Start iTunes Playing, and Pause iTunes actions into the workflow. Make sure you set the Import Audio File action to use MP3 Encoder and check the "Delete source files after encoding" box to neatly remove the audiobook.aiff file that was created on the desktop in the previous step. The next two actions simply ensure that the recently encoded audiobook.mp3 file is the file currently selected in iTunes before going on to the next section of the workflow.

No comments: