Mercurial > dottes
annotate makeCello.sh @ 274:5a8b7479afa6
Add speed, A/B tune marking and guitar chords.
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Mon, 01 Jul 2013 21:06:48 +0100 |
parents | 7b98278d6e8b |
children | b4a0161e8870 |
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 |
197
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
188
diff
changeset
|
22 # Copy book component items. |
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
188
diff
changeset
|
23 cp $booke/*.txt $outdir |
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
188
diff
changeset
|
24 |
263
7b98278d6e8b
Add instrument name into title page for transpositions.
Jim Hague <jim.hague@acm.org>
parents:
215
diff
changeset
|
25 echo "Cello" > $outdir/instrument.txt |
7b98278d6e8b
Add instrument name into title page for transpositions.
Jim Hague <jim.hague@acm.org>
parents:
215
diff
changeset
|
26 |
155
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
27 find $booke -name "*.abc" | sort | |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
28 while read filename |
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
29 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
|
30 # 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
|
31 # 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
|
32 # 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
|
33 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
|
34 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
|
35 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
|
36 fi |
155
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
37 name=`basename $filename .abc` |
215
3c9d9654d4a1
Add 'clef=bass' into the converted output.
Jim Hague <jim.hague@laicatc.com>
parents:
197
diff
changeset
|
38 sed -e "/^ *K:/s/$/ clef=bass middle=$middle/" $filename > $outdir/$name.abc |
155
cc2d4925f280
Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
39 done |