216
|
1 #!/bin/bash
|
|
2 #
|
|
3 # Transpose a book for Horn in F.
|
|
4
|
|
5 if [ $# != 1 ]; then
|
|
6 echo "Usage: makeFHorn.sh <book dir name>"
|
|
7 exit 1
|
|
8 fi
|
|
9
|
|
10 dir=`pwd`
|
|
11
|
|
12 booke=$dir/$1
|
|
13 outdir=$dir/$1-HornInF
|
|
14
|
|
15 mkdir -p $outdir
|
|
16
|
|
17 find $booke -name "*.abc" | sort |
|
|
18 while read filename
|
|
19 do
|
|
20 name=`basename $filename .abc`
|
|
21 tmpfile=$outdir/$name.abc.tmp
|
|
22
|
|
23 # Strip out guitar chords first. This has the advantage of removing
|
|
24 # text with arbitary lower case characters too.
|
|
25 sed -e "s/\"[^\"]*\"//g" $filename > $tmpfile
|
|
26
|
|
27 # Transpose concert pitch up a fifth.
|
|
28 # If there are any notes at or above C above middle C, transpose
|
|
29 # down a seventh instead.
|
|
30 transpose=5
|
|
31 if grep -v "^[A-Z]:" $tmpfile | sed -e 's/"[^"]*"//g' | grep -q "[a-g]"; then
|
|
32 transpose=-7
|
|
33 fi
|
|
34
|
|
35 # Transpose. By default abc2abc will report errors in the output,
|
|
36 # but this messes up output formatting so stop it.
|
|
37 abc2abc $tmpfile -e -t $transpose > $outdir/$name.abc
|
|
38 rm $tmpfile
|
|
39 done
|