#!/bin/bash find res/sound/ -type f \( -name "*.mp3" -o -name "*.wav" -o -name "*.ogg" \) -print0 | while IFS= read -r -d '' file; do out="res/mono/${file#res/sound/}" out="${out%.*}.ogg" mkdir -p "$(dirname "$out")" ffmpeg -i "$file" -ac 1 "$out" done