summaryrefslogtreecommitdiff
path: root/audio/gmodplay/files/mod2wav
blob: 07c135e776db4c4e93ad15264a872d1fd5173e82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
#
# $NetBSD: mod2wav,v 1.3 2003/11/25 22:16:28 wiz Exp $
#
# I wrote this shell script long ago to be able to master CDs from modules
# in Un*x using gmodplay.  -Ben

CMD=$(basename $0)

if [ -z "$*" ]
then
	echo "
Usage: $CMD <module>
for example \"$CMD funky.xm\" would create funky.xm.wav
"
	exit
fi

sox -V 2>&1 | grep sox >/dev/null 2>&1
if [ $? -ne 0 ]
then
	echo "
FATAL: I can't find sox in your path.  Is it installed?
"
	exit
fi

WAVDIR=$(dirname "$*")
WAVNAME=$(basename "$*").wav

echo -e "$* -> $WAVDIR/$WAVNAME\c"


echo -e " [step 1]\c"
gmodplay -n -w "$*" >/dev/null 2>&1
if [ $? -ne 0 ]
then
	echo "
FATAL: gmodplay returned an error.
"
	exit
fi

echo -e " [step 2]\c"
chmod a+r output.raw
sox -t raw -r 44100 -s -w -c 2 output.raw "$WAVDIR/$WAVNAME" >/dev/null 2>&1
if [ $? -ne 0 ]
then
	echo "
FATAL: sox returned an error.
You may need to remove output.raw
"
	exit
fi

echo -e " [step 3]\c"
rm -f output.raw

echo " Finished!"