comparison makeHornInF.sh @ 216:64b84dea3337

Add Horn in F transposition.
author Jim Hague <jim.hague@laicatc.com>
date Wed, 20 Feb 2013 13:03:40 +0000
parents
children a8a46fd79d5c
comparison
equal deleted inserted replaced
215:3c9d9654d4a1 216:64b84dea3337
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