-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtemplategen.sh
executable file
·114 lines (97 loc) · 2.9 KB
/
templategen.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash
if [ $# -lt 4 ]; then
echo "usage: $0 'Cello Staccato' 'Cello/clst1*' lovel hivel [-r]"
exit 1
fi
name="$1"
patt="$2"
lovel=$3
hivel=$4
REL=0
if [ $# -gt 4 ]; then
if [ $5 == '-r' ] ; then REL=1; fi
fi
# Check that we see samples
count=$(ls $patt | wc -l)
if [ $count -lt 5 ] ; then
echo "Got only $count files, check your pattern" >&2
exit 2
fi
# from pattern check where is first wildcard. Note location can't be before it
noteloc=1; while [ "${patt:$noteloc:1}" != '*' ] && [ "${patt:$noteloc:1}" != '?' ];
do noteloc=$(($noteloc+1)) ; done
noteloc=$(($noteloc-1))
# Find where is note location
c=0; while [ $c -lt 10 ] && [ $noteloc -lt 99 ]; do noteloc=$(($noteloc+1));c=$(sfzgen.py -i -n $noteloc $patt -l "kukkuu" 2>/dev/null | wc -l ); done
sfzgen.py -i -n $noteloc $patt -l "kukkuu" > /dev/null
file=$(echo $name | sed 's/ /_/g').sfz
if [ $lovel -eq 0 ] ; then
cat <<- ENDOF
############################################################
NAME="$name"
FILE=$file
echo \$NAME
cat << EOF > \$FILE
// \$NAME
<control>
label_cc73=Attack
label_cc72=Release
set_cc73=0
set_cc72=10
<global>
ampeg_attack_oncc73=10
ampeg_release_oncc72=10
ampeg_decay=0.005
EOF
ENDOF
fi
if [ $REL -eq 0 ] ; then
FILES="$patt"
FILES2=""
else
FILES="\$(ls $patt | grep -v Rel)"
FILES2="\$(ls $patt | grep Rel)"
fi
echo "sfzgen.py -n$noteloc $FILES -l \"volume=0 tune=0 lovel=$lovel hivel=$hivel\" >> \$FILE"
[ "$FILES2" ] && echo "sfzgen.py -n$noteloc $FILES2 -l \"trigger=release volume=0 tune=0 lovel=$lovel hivel=$hivel\" >> \$FILE"
cat <<- ENDOF
ENDOF
file=$(echo $name | sed 's/ /_/g')_Mod.sfz
if [ $lovel -eq 0 ] ; then
cat <<- ENDOF
### --------- ###
NAME="$name Mod"
FILE=$file
echo \$NAME
cat << EOF > \$FILE
// \$NAME
<control>
label_cc73=Attack
label_cc72=Release
set_cc73=2
set_cc72=10
<global>
amp_veltrack=0
volume_oncc1=-24
volume_curvecc1=2
xf_cccurve=power
ampeg_attack_oncc73=10
ampeg_release_oncc72=10
ampeg_decay=0.005
EOF
ENDOF
fi
inlow=$(($lovel-15))
outlow=$(($hivel-15))
if [ $lovel -eq 0 ] ; then
echo "sfzgen.py -n$noteloc $FILES -l \"volume=0 tune=0 xfout_locc1=$outlow xfout_hicc1=$hivel\" >> \$FILE"
[ "$FILES2" ] && echo "sfzgen.py -n$noteloc $FILES2 -l \"trigger=release volume=0 tune=0 xfout_locc1=$outlow xfout_hicc1=$hivel\" >> \$FILE"
else if [ $hivel -eq 127 ] ; then
echo "sfzgen.py -n$noteloc $FILES -l \"volume=0 tune=0 xfin_locc1=$inlow xfin_hicc1=$lovel\" >> \$FILE"
[ "$FILES2" ] && echo "sfzgen.py -n $noteloc $FILES2 -l \"trigger=release volume=0 tune=0 xfin_locc1=$inlow xfin_hicc1=$lovel\" >> \$FILE"
else
echo "sfzgen.py -n$noteloc $FILES -l \"volume=0 tune=0 xfin_locc1=$inlow xfin_hicc1=$lovel xfout_locc1=$outlow xfout_hicc1=$hivel\" >> \$FILE"
[ "$FILES2" ] && echo "sfzgen.py -n$noteloc $FILES2 -l \"trigger=release volume=0 tune=0 xfin_locc1=$inlow xfin_hicc1=$lovel xfout_locc1=$outlow xfout_hicc1=$hivel\" >> \$FILE"
fi
fi
echo "#"