Added scripts for MP3 loudness normalisation based on EBU R123 instead
of ReplayGain. (lossless using mp3gain to modify values)
This commit is contained in:
parent
2ae57e9451
commit
5d5ba2c95d
27
mp3loud_track.sh
Executable file
27
mp3loud_track.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
# Install mp3gain from: https://launchpad.net/~flexiondotorg/+archive/ubuntu/audio
|
||||
# Install bs1770gain from package manager
|
||||
|
||||
TARGET_LOUDNESS=-14
|
||||
|
||||
# Normalise MP3 to 89 dB, add tags to file
|
||||
mp3gain -q -k -p -r -s i "$1" > /dev/null
|
||||
|
||||
# Find actual EBU R128 loudness, show relative to $TARGET_LOUDNESS LUFS
|
||||
LOUDADJUST=`bs1770gain --norm $TARGET_LOUDNESS --xml "$1" | grep -m 1 integrated | sed -e 's/^.*lu="\(.*\)".*$/\1/'`
|
||||
echo "[$1] Deviation from $TARGET_LOUDNESS LUFS: $LOUDADJUST LU"
|
||||
|
||||
# Calculate gain adjustment (in steps of 1.5 dB/~LU), round using printf
|
||||
GAINADJUST=`echo "scale=4;$LOUDADJUST / 1.5" | bc`
|
||||
GAINADJUST=`printf %0.f $GAINADJUST`
|
||||
|
||||
# To ALWAYS stay BELOW -14 LUFS, use this:
|
||||
#GAINADJUST=`echo "$LOUDADJUST / 1.5" | bc`
|
||||
|
||||
if [ "$GAINADJUST" -ne 0 ]; then
|
||||
echo "[$1] Adjust gain by: $GAINADJUST"
|
||||
# Use this call to have clipping-prevention which doesn't work when modifying gain directly
|
||||
mp3gain -q -k -p -r -s i -m $GAINADJUST "$1"
|
||||
else
|
||||
echo "[$1] No further adjustment necessary."
|
||||
fi
|
14
mp3loud_tracks.sh
Executable file
14
mp3loud_tracks.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
if [ "$#" = "0" ]; then
|
||||
echo "Usage: $0 file1 [file2 file3 ... fileN]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$CONCURRENCY_LEVEL" ]; then
|
||||
CONCURRENCY_LEVEL=1
|
||||
fi
|
||||
|
||||
echo "Processing using $CONCURRENCY_LEVEL processes..."
|
||||
nice -n2 find "$@" -print0 | xargs -0 -P $CONCURRENCY_LEVEL -n 1 -I {} /opt/mbirth/mp3loud_track.sh "{}"
|
||||
|
||||
echo "All done."
|
Loading…
x
Reference in New Issue
Block a user