Mat's Playground

music.makeMp3

Description

This script encodes all wave files in the current directory into mp3 files with a constant bitrate of 128kbit. It will not downmix to joint-stereo, but uses real stereo.

Note: Ogg is said to have higher quality than mp3 files, so consider using music.makeOgg instead, which creates ogg files.
(The Ogg format is also Open Source and patent-free, but I'll spare you the annoying "free as in freedom" crap, you'll find everywhere else.)

Required program

Download

Source code

Hide line numbers Expand lines
 1#!/bin/sh
 2# the next line restarts using tclsh \
 3exec tclsh "$0" "$@"
 4
 5foreach i [lsort [glob *.wav]] {
 6    puts "Encoding $i.."
 7    catch {exec lame -b 128 -m s $i}
 8
 9    unset i
10}