Skip to content

Instantly share code, notes, and snippets.

@donnaken15
Created November 25, 2023 05:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donnaken15/fb4f2c60f7005dd0be57d09b3cfcce2e to your computer and use it in GitHub Desktop.
Save donnaken15/fb4f2c60f7005dd0be57d09b3cfcce2e to your computer and use it in GitHub Desktop.
Updated FastGH3 audio encoding speed test shell scripts (requires sox, helix, ffmpeg) (put in music/tools folder)
if [ ! "$(dirname "$0")" = "." ]; then
here=$(realpath "$0")/
else
here=$(which "$0")/
fi
here=$(dirname "$here")
TIMEFORMAT=%R
LPARAMS="--cbr -b 128 --resample 44100 -m j"
TARGET="$1"
EXT=$(basename "$TARGET")
EXT=${EXT##*.}
LAME_AVG=""
SOX_AVG=""
PIPE_AVG=""
XING_AVG=""
RANGE=$(echo {1..20})
SAMPLES=20
#./lame.exe $LPARAMS "${TARGET}" test.mp3
#./sox.exe "${TARGET}" -c 2 -r 44100 -S --multi-threaded -t mp3 -C 128 - | "%~dp0lame" %LPARAMS% - %2
echo "ffmpeg.exe"
echo FFMPEG $EXT TO MP3
for i in $RANGE; do
echo ffmpeg try$i
t0=$({ time ffmpeg -i "${TARGET}" -ab 128k -ac 2 -ar 44.1k test.mp3 -y 2>/dev/null 1>/dev/null; } 2>&1)
LAME_AVG="${LAME_AVG} ${t0}"
echo $t0
done
sum=0
for i in $LAME_AVG; do
sum=$(evl $sum+$i)
done
avg=$(evl $sum/$SAMPLES)
echo avg:
echo $avg
# NOT INCLUDED IN LATEST FASTGH3 BECAUSE HELIX OUTDOES SPEED
#echo SOX $EXT TO MP3
#for i in $RANGE; do
# echo sox try$i
# t0=$({ time "${here}/sox.exe" "${TARGET}" -c 2 -r 44100 -S --multi-threaded -t mp3 -C 128 test.mp3 2>/dev/null 1>/dev/null; } 2>&1)
# SOX_AVG="${SOX_AVG} ${t0}"
# echo $t0
#done
#sum=0
#for i in $SOX_AVG; do
# sum=$(evl $sum+$i)
#done
#avg=$(evl $sum/$SAMPLES)
#echo avg:
#echo $avg
echo FFMPEG $EXT TO HELIX MP3
for i in $RANGE; do
echo pipe try$i
t0=$({ time "${here}/pipetest.sh" "${TARGET}" 2>/dev/null 1>/dev/null; } 2>&1)
PIPE_AVG="${PIPE_AVG} ${t0}"
echo $t0
done
sum=0
for i in $PIPE_AVG; do
sum=$(evl $sum+$i)
done
avg=$(evl $sum/$SAMPLES)
echo avg:
echo $avg
echo SOX $EXT TO HELIX MP3
for i in $RANGE; do
echo pipe try$i
t0=$({ time "${here}/pipetest2.sh" "${TARGET}" 2>/dev/null 1>/dev/null; } 2>&1)
XING_AVG="${XING_AVG} ${t0}"
echo $t0
done
sum=0
for i in $XING_AVG; do
sum=$(evl $sum+$i)
done
avg=$(evl $sum/$SAMPLES)
echo avg:
echo $avg
LPARAMS="--cbr -b 128 --resample 44100 -m j"
TARGET=$1
ffmpeg -i "${TARGET}" -hide_banner -ac 2 -ar 44.1k -f wav pipe: | ./helix.exe - test.mp3 -B64 -M1 -u2 -q1
TARGET=$1
./sox.exe "${TARGET}" -c 2 -r 44100 -S --multi-threaded -t wav - | ./helix.exe - test.mp3 -B64 -M1 -u2 -q1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment