24 September 2006

Normalising volume of mp3 tracks - Part 2

This script handles albums properly so that the relative volume of seperate tracks in an album are maintained:



cd /srv/files/music

for album in `find . -mindepth 2 -type d -not \( -regex '\./.*/singles$' -or -regex '\./various/.*' \)`; do
echo "Processing album ${album}"
mp3gain -a -k -c ${album}/*.mp3

for singles in `find . -mindepth 2 -type d \( -regex '\./.*/singles$' -or -regex '\./various/.*' \)`; do
echo "Processing singles ${singles}"
mp3gain -r -k -c ${singles}/*.mp3

) | tee /var/log/normalise_music.log