erikb

Prev Next TECH TECH
MP3 blog this [2004-08-17]

I liked Mark's mp3 blog idea, and made a variation on the same idea using the (free) tools mp3splt and mp3wrap. This utility can capture snippets from a collection of mp3 files and then paste them together into one "preview". I did this via a simple shell script. Ok, I know the script is not very pretty... I use Cygwin under WinXP by the way.

#! /bin/bash

# path to the mp3 utilities; see http://mp3splt.sourceforge.net/
SPLIT=mp3splt.exe 
WRAP=mp3wrap.exe 

# temp dir to put files in
dir="split"

# remove any old mp3 file
echo -n "Clean old comp.mp3..."
rm -f "comp.mp3" ; echo "done"

echo -n "Clean temp dir..."
rm -fr $dir ; echo "done"
mkdir $dir

# arg1 is a folder with mp3 files we want to process
folder="$1"

# Capture 20 seconds of music, put result in $dir.
# The loop is written this way to be able to handle files with spaces
# in the filename; quotes around $file is also needed because of this.
ls $folder | while read file; do
    cd $folder; $SPLIT -q -n "$file" 02.10 02.30 -d ../$dir ; cd ..
done

# append all files in $dir into one file comp.mp3
echo -n "Wrapping..."
cd $dir ; $WRAP ../comp.mp3 *.mp3 ; cd .. ; echo "done"

# remove added tag in filename? mp3wrap always adds this tag...
mv "comp_MP3WRAP.mp3" comp.mp3

echo -n "Remove temp dir..."
rm -fr $dir ; echo "done"

I took 20 seconds (02:10 - 02.30) of each song from my latest compilation and put them into this MP3 sound bite (5 MB). See playlist below.

playlist

Prev Next