Mercurial > dottes
annotate makeCello.sh @ 189:9836536b67cc
Make the cello transpositions visible.
It looks like they are useful, so make the public.
author | Jim Hague <jim.hague@laicatc.com> |
---|---|
date | Wed, 06 Feb 2013 12:28:03 +0000 |
parents | 76f18e0a80bd |
children | 8f352063f277 |
rev | line source |
---|---|
155
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
1 #!/bin/bash |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
2 # |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
3 # Copy a booke to cello-friendly form. Bass clef, transposed down 2 octaves. |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
4 # |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
5 # It would be easier to do with transpose in dottes.fmt, but I can't get |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
6 # that to work properly for a 2 octave downward transpose. |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
7 # |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
8 # This relies on abcm2ps >= 6.0 but does not check for it. |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
9 |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
10 if [ $# != 1 ]; then |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
11 echo "Usage: makeCello.sh <book dir name>" |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
12 exit 1 |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
13 fi |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
14 |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
15 dir=`pwd` |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
16 |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
17 booke=$dir/$1 |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
18 outdir=$dir/$1-Cello |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
19 |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
20 mkdir -p $outdir |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
21 |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
22 find $booke -name "*.abc" | sort | |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
23 while read filename |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
24 do |
188
76f18e0a80bd
Have a go at being slightly more intelligent in the cello transposition.
Jim Hague <jim.hague@acm.org>
parents:
155
diff
changeset
|
25 # Move down either one octave or two, depending on the range |
76f18e0a80bd
Have a go at being slightly more intelligent in the cello transposition.
Jim Hague <jim.hague@acm.org>
parents:
155
diff
changeset
|
26 # of the tune. If there are any notes below middle C, transpose |
76f18e0a80bd
Have a go at being slightly more intelligent in the cello transposition.
Jim Hague <jim.hague@acm.org>
parents:
155
diff
changeset
|
27 # down one octave. The default is to transpose down two octaves. |
76f18e0a80bd
Have a go at being slightly more intelligent in the cello transposition.
Jim Hague <jim.hague@acm.org>
parents:
155
diff
changeset
|
28 middle="d" |
76f18e0a80bd
Have a go at being slightly more intelligent in the cello transposition.
Jim Hague <jim.hague@acm.org>
parents:
155
diff
changeset
|
29 if grep -v "^[A-Z]:" $filename | sed -e 's/"[^"]*"//g' | grep -q "[A-Z],"; then |
76f18e0a80bd
Have a go at being slightly more intelligent in the cello transposition.
Jim Hague <jim.hague@acm.org>
parents:
155
diff
changeset
|
30 middle="D" |
76f18e0a80bd
Have a go at being slightly more intelligent in the cello transposition.
Jim Hague <jim.hague@acm.org>
parents:
155
diff
changeset
|
31 fi |
155
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
32 name=`basename $filename .abc` |
188
76f18e0a80bd
Have a go at being slightly more intelligent in the cello transposition.
Jim Hague <jim.hague@acm.org>
parents:
155
diff
changeset
|
33 sed -e "/^ *K:/s/$/ middle=$middle/" $filename > $outdir/$name.abc |
155
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
34 done |