Encoding Audio for a Church Website (Part Two)


In the first post of the series, Encoding Audio for a Church Website (Part One), I discussed the available audio, the choices I made for making that audio, and the modern technology (HTML5, mainly) which makes all of this possible.

All of the tools that we will be using are easily found and used at any Linux command-line prompt. Why do we use these? First, Linux is faster than Windows and has networking built into the OS. Second, these tools are free (a big plus). Finally, these tools are so versatile that two tools can suffice for three (or four).

Encoding Audio for a Church Website

.wav to .mp3

On http://linuxpoison.blogspot.com/2008/02/script-to-convert-wav-to-mp3.html, I found a bash script that converts all .wav files to .mp3 files while maintaining the title.

# name of this script: wav2mp3.sh
# wav to mp3

for i in *.wav; do
if [ -e “$i” ]; then
file=`basename “$i” .wav`
lame -h -b 192 “$i” “$file.mp3”

This code takes each and every .wav file in the directory and converts it (quickly!) to .mp3 files using a 192 kbps encryption. Note: You must have the LAME framework installed.

.mp3 to better .mp3 and .ogg

Although I couldn’t tell you how or from where I cobbled these scripts together, I use some of the following snippets.

#convert from mp3 to low-fi mp3
echo "Converting to low-fi mp3"
lame $i "$i-low.mp3" --lowpass 15 -V 9 --vbr-new -mm -h -q 0 -B 32 #-V 9 -B 32 -b 8

#convert from mp3 to wav
echo “Converting from mp3 to .ogg, part 1”
mplayer -vo null -vc dummy -af resample=22050 -ao pcm:waveheader $i

#convert from wav to low-fi ogg
echo “Converting from .mp3 to .ogg, part 2”
oggenc audiodump.wav -q 0 –downmix -o “$i.ogg”

echo “Cleaning up”
rm audiodump.wav

It’s pretty clear that there are four main parts in the above script:

  1. Convert from standard quality .mp3-files to low-quality .mp3-files. The bitrate is 32 kbps, but the quality is ‘9’–which means bad.
  2. The second part, clearly shown in the comments, is to (oddly) convert back to .wav. This is done because I may not have received .wav-files and the encryption algorithm for Ogg Vorbis files (oggenc) requires .wav-files. Note: One requires the mplayer framework to do this encryption.
  3. Next, I convert from the .wav-file to a low-quality .ogg-file. Here a quality of ‘0’ is pretty bad.
  4. Finally, we delete the generically-named .wav-file required for each encoding

When you are done, there are three files remaining:

  1. The original quality .mp3-file.
  2. A low-quality copy of the original .mp3-file of the sermon audio.
  3. A low-quality copy of the original sermon audio in .ogg format

Of course, the above code snippet is encompassed in the necessary BASH file with a loop cycling through all of the .mp3 files in the directory.


A third piece is coming that details how we rename the files.

2 thoughts on “Encoding Audio for a Church Website (Part Two)”

  1. MP3 WAV Converter is an ideal all-in-one tool for converting batches of mp3 files into wav files or vice versa. It converts MP3 files to WAV files for burning on an audio CD. It converts WAV files to MP3 files for smaller size of the files. It is also a cool mp3 and CD player. It has a cool and easy-to-use GUI. Its speed is faster than blade or lame engine and the quality is a lot better.

Leave a Reply