Skip to Content

Converting Processed Sermon Files to MP3

In the previous article, I explained how to use Audacity to process a recorded sermon to ready it for podcasts and radio broadcast. The resulting WAV file is rather large, and cannot be conveniently stored or streamed, and so it should be converted to MP3 format. The LAME encoder is used to create the mp3 files for streaming and archival purposes, and we will use the AutoIt V3 scripting tool to simplify the encoding process.

For web streaming, the source file is run through a lowpass filter at 6kHz, converted from stereo to mono, downsampled from 44.1kHz to 11.025kHz, then the mp3 compression algorithm creates a 16kbps output file. That's a lot of technical jargon, but the point that this bandwidth is low enough to stream over a dial-up connection while minimizing the weird noises (compression artifacts) created by squashing the data into such a small file. Our streaming files are just over 1MB per ten minutes, as compared to 1.4MB/minute for archive MP3 and 10MB per minute for CD-quality WAV files.

Before beginning, you'll need to download and install the LAME MP3 Encoder tools, and AutoIt V3.

Now, download this script, save it to the folder where you will be processing WAV files, and rename it from a .txt file to lametwice.au3 so it will launch properly using AutoIt. Right clicking this script in Windows Explorer should offer you the option to Edit Script, which will open the file in Windows Notepad. Do this, and change the $lameCmd variable to match the location where you installed lame.exe, and fill in the correct name for $defaultSpeaker.

Double-click lametwice.au3 and select your processed sermon WAV file. If you named the file correctly, then the first dialog box should already show the sermon title, though you may need to add punctuation.

Script Screen Shot

The sermon date should also be filled in from the file name.

Script Screen Shot

Your default speaker name will appear next, but can be changed for individual messages.

Script Screen Shot

Finally, the script will prompt for a scripture reference. This is optional, and will be added to the date and stored in the MP3 comment field. Our podcasting scripts read this information and display it as part of the podcast file.

Script Screen Shot

After all of the information is entered, a confirmation screen will be displayed. You can cancel from this screen to abort the MP3 file creation if anything went wrong.

Script Screen Shot

The script will then launch the LAME encoder twice. The first pass will generate a low-bandwidth podcasting version of the message.

Script Screen Shot

The second pass will generate a high quality file for archiving. This file is near CD quality, and should be sufficient for storage and for use in the radio broadcast, eliminating the need to store the full-sized WAV file.

Script Screen Shot

After LAME completes, the MP3 files should be ready for upload and storage.

Errors in script

Hi Micah,
I followed the steps but when I ran the script I got an error code of -1. Do you have any idea of what this means?

Usual causes for -1 error

I've found a couple of causes for the -1 error.

The most frequent cause is that you're working in "My Documents" or some other path that has a space in the file name. That gets misinterpreted somewhere. It can probably be fixed, but if you try making a folder like C:\mp3\work it will probably fix the problem.

If not, try ucommenting this line:

;MsgBox (4096,"",$loCmd)

That will generate a popup window showing you the command line that's trying it execute. Look it over for obvious syntax errors and maybe that will help you resolve it.

New Parameters

FYI, when this script was written, we were still trying to cater to dial-up Internet users. We reviewed our logs and learned that this wasn't really an issue for us. Our original "lofi" parameters were:

$lofiParams="-a --lowpass 6 --resample 11.035 -b 16"

These settings convert the signal to mono, add a lowpass filter at 6kHz, resample the audio down to 11035Hz (roughly AM radio quality) and then create an mp3 file with a 16kbps bit rate.

We've since upgraded that to this:

$lofiParams="-a -b 64"

These new settings simply convert the signal to mono, then create an mp3 with a 64kbps bit rate. Since we're in mono, that's the same quality as your "typical" 128kbps music downloads, but half the size.