annotate makeAltoSax.sh @ 1022:5b95b6ff2ed7

Add first pass at Beginners section.
author Jim Hague <jim.hague@acm.org>
date Tue, 18 Feb 2020 13:42:21 +0000
parents ce13e23259b1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
216
64b84dea3337 Add Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
1 #!/bin/bash
64b84dea3337 Add Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
2 #
1019
ce13e23259b1 Add Alto Sax transposition.
Jim Hague <jim.hague@acm.org>
parents: 876
diff changeset
3 # Transpose a book for alto saxophone
216
64b84dea3337 Add Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
4
64b84dea3337 Add Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
5 if [ $# != 1 ]; then
1019
ce13e23259b1 Add Alto Sax transposition.
Jim Hague <jim.hague@acm.org>
parents: 876
diff changeset
6 echo "Usage: makeAltoSax.sh <book dir name>"
216
64b84dea3337 Add Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
7 exit 1
64b84dea3337 Add Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
8 fi
64b84dea3337 Add Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
9
64b84dea3337 Add Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
10 dir=`pwd`
64b84dea3337 Add Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
11
64b84dea3337 Add Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
12 booke=$dir/$1
1019
ce13e23259b1 Add Alto Sax transposition.
Jim Hague <jim.hague@acm.org>
parents: 876
diff changeset
13 outdir=$dir/$1-AltoSax
216
64b84dea3337 Add Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
14
749
06fec6764661 Revise transposition scripts to make Compact.
Jim Hague <jim.hague@acm.org>
parents: 748
diff changeset
15 mkdir -p $outdir/Compact
216
64b84dea3337 Add Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
16
217
a8a46fd79d5c Fix up problems in Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents: 216
diff changeset
17 # Copy book component items.
876
1a838d8dca2a Fix building transposed bookes.
Jim Hague <jim.hague@acm.org>
parents: 749
diff changeset
18 cp $booke/*.txt $booke/*.md $booke/image.jpg $outdir
217
a8a46fd79d5c Fix up problems in Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents: 216
diff changeset
19
1019
ce13e23259b1 Add Alto Sax transposition.
Jim Hague <jim.hague@acm.org>
parents: 876
diff changeset
20 echo "Alto Saxophone" > $outdir/instrument.txt
263
7b98278d6e8b Add instrument name into title page for transpositions.
Jim Hague <jim.hague@acm.org>
parents: 218
diff changeset
21
749
06fec6764661 Revise transposition scripts to make Compact.
Jim Hague <jim.hague@acm.org>
parents: 748
diff changeset
22 find $booke -name "*.abc" |
216
64b84dea3337 Add Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
23 while read filename
64b84dea3337 Add Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
24 do
64b84dea3337 Add Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
25 name=`basename $filename .abc`
749
06fec6764661 Revise transposition scripts to make Compact.
Jim Hague <jim.hague@acm.org>
parents: 748
diff changeset
26
06fec6764661 Revise transposition scripts to make Compact.
Jim Hague <jim.hague@acm.org>
parents: 748
diff changeset
27 dir=`dirname $filename`
06fec6764661 Revise transposition scripts to make Compact.
Jim Hague <jim.hague@acm.org>
parents: 748
diff changeset
28 basedir=`basename $dir`
06fec6764661 Revise transposition scripts to make Compact.
Jim Hague <jim.hague@acm.org>
parents: 748
diff changeset
29 compact=""
06fec6764661 Revise transposition scripts to make Compact.
Jim Hague <jim.hague@acm.org>
parents: 748
diff changeset
30 if [ "$basedir" = "Compact" ]; then
06fec6764661 Revise transposition scripts to make Compact.
Jim Hague <jim.hague@acm.org>
parents: 748
diff changeset
31 compact="Compact/"
06fec6764661 Revise transposition scripts to make Compact.
Jim Hague <jim.hague@acm.org>
parents: 748
diff changeset
32 fi
06fec6764661 Revise transposition scripts to make Compact.
Jim Hague <jim.hague@acm.org>
parents: 748
diff changeset
33
322
b4a0161e8870 Add abcrange.py to return the range of a tune, and use it in instrument transposition.
Jim Hague <jim.hague@acm.org>
parents: 263
diff changeset
34 range=`./abcrange.py $filename`
216
64b84dea3337 Add Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
35
1019
ce13e23259b1 Add Alto Sax transposition.
Jim Hague <jim.hague@acm.org>
parents: 876
diff changeset
36 # Transpose concert pitch down a minor third.
ce13e23259b1 Add Alto Sax transposition.
Jim Hague <jim.hague@acm.org>
parents: 876
diff changeset
37 transpose=-3
216
64b84dea3337 Add Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
38
370
ecc62b487e57 Some empty "" chords may be causing trouble with Jenkins.
Jim Hague <jim.hague@acm.org>
parents: 351
diff changeset
39 # There's no point in having transposed chords. Remove from the
ecc62b487e57 Some empty "" chords may be causing trouble with Jenkins.
Jim Hague <jim.hague@acm.org>
parents: 351
diff changeset
40 # abc before transposing. Some badly formed chord items can give
ecc62b487e57 Some empty "" chords may be causing trouble with Jenkins.
Jim Hague <jim.hague@acm.org>
parents: 351
diff changeset
41 # erroneous output from abc2abc (like, strings of binary gibberish).
ecc62b487e57 Some empty "" chords may be causing trouble with Jenkins.
Jim Hague <jim.hague@acm.org>
parents: 351
diff changeset
42 sed -e "s/\"[^\"]*\"//g" $filename > $outdir/$name.abc.tmp
ecc62b487e57 Some empty "" chords may be causing trouble with Jenkins.
Jim Hague <jim.hague@acm.org>
parents: 351
diff changeset
43
216
64b84dea3337 Add Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
44 # Transpose. By default abc2abc will report errors in the output,
671
2f6e05d0aba0 Add experimental Alto Recorder (C Fingering) instrument.
Jim Hague <jim.hague@acm.org>
parents: 370
diff changeset
45 # but this messes up output formatting so stop it.
749
06fec6764661 Revise transposition scripts to make Compact.
Jim Hague <jim.hague@acm.org>
parents: 748
diff changeset
46 abc2abc $outdir/$name.abc.tmp -e -t $transpose > $outdir/$compact$name.abc
370
ecc62b487e57 Some empty "" chords may be causing trouble with Jenkins.
Jim Hague <jim.hague@acm.org>
parents: 351
diff changeset
47 rm $outdir/$name.abc.tmp
216
64b84dea3337 Add Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
48 done