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:

#/bin/bash

(

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
done

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

) | tee /var/log/normalise_music.log