-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpermusic_nopdf.sh
50 lines (36 loc) · 995 Bytes
/
permusic_nopdf.sh
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
#!/usr/bin/env bash
timidity=/c/timidity/timidity
if [[ "$#" -ne 1 ]] ; then
echo "Please insert a string whose number of characters is a multiple of 3"
read perm
else
perm=$1
fi
l=${#perm}
if [ $(( l % 3 )) -ne 0 ] ; then
echo "Your string has a number of characters that is not a multiple of 3"
exit 1
fi
echo Processing permutations of $perm
perm $perm > $perm.dat
if [[ "$?" -ne 0 ]] ; then
echo "perm $perm failed ($?) -- aborting execution"
exit 2
fi
# remove "-l" to print the score
data2lily -i $perm.dat -o $perm.ly -m celesta -m glockenspiel -m kalimba -l
if [ $? -ne 0 ]; then
echo "data2lily -i $perm failed -- aborting execution"
exit 3
fi
lilypond $perm.ly
if [ $? -ne 0 ]; then
echo "lilypond $perm.ly failed -- aborting execution"
exit 4
fi
$timidity $perm.mid -O w -o $perm.wav
if [ $? -ne 0 ]; then
echo "timidity $perm.mid failed -- aborting execution"
exit 5
fi
lame --quiet --abr 160k $perm.wav $perm.mp3 && rm -f $perm.wav