From 6164533c1a867b37a197906eb83a8c880da0c465 Mon Sep 17 00:00:00 2001 From: a dinosaur Date: Fri, 27 Sep 2019 15:58:08 +1000 Subject: [PATCH] port autoextract to shell --- neotools/autoextract.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 neotools/autoextract.sh diff --git a/neotools/autoextract.sh b/neotools/autoextract.sh new file mode 100755 index 0000000..7aab24f --- /dev/null +++ b/neotools/autoextract.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +FILE="$1" +NAME="$(basename "$FILE")" +WAVDIR="${NAME%%.*}" + +if [ "${NAME##*.}" = "vgz" ]; then + cp "$FILE" "temp.vgm.gz" + gzip -d "temp.vgm.gz" + FILE="temp.vgm" +fi + +./neoadpcmextract "$FILE" +mkdir -p "$WAVDIR" +for I in smpa_*.pcm; do ./adpcm "$I" "$WAVDIR/${I%%.*}.wav"; done +for I in smpb_*.pcm; do ./adpcmb -d "$I" "$WAVDIR/${I%%.*}.wav"; done +find . -type f -name "*.pcm" -exec rm -f {} \; + +[ "$FILE" = "temp.vgm" ] && rm -f "temp.vgm"