french-education-speech / normalize.sh
mathisescriva
Initial commit: French Education Speech Corpus (Phase 1)
5d2c0a9
raw
history blame contribute delete
512 Bytes
#!/usr/bin/env bash
set -euo pipefail
if [ $# -lt 1 ]; then
echo "Usage: $0 <audio_root_dir>"
exit 1
fi
ROOT="$1"
find "$ROOT" -type f \( -iname "*.wav" -o -iname "*.mp3" -o -iname "*.m4a" -o -iname "*.mp4" \) | while IFS= read -r f; do
[ -e "$f" ] || continue
outf="${f%.*}.16k.wav"
if [ -f "$outf" ]; then
continue
fi
ffmpeg -hide_banner -loglevel error -y -i "$f" -ac 1 -ar 16000 -af loudnorm "$outf" || {
echo "Failed to normalize: $f" >&2
}
done
echo "Normalization complete."