Mercurial > dottes
view makeCello.sh @ 337:eb587fee5db2
Revise A4 and A5 to have inside title page.
Decide to have an inside title page, with the copyright and stuff following
on the A4 verso, A5 top page.
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Mon, 12 Aug 2013 12:10:37 +0100 |
parents | b4a0161e8870 |
children | 1073829494e3 |
line wrap: on
line source
#!/bin/bash # # Copy a booke to cello-friendly form. Bass clef, transposed down # 1 or 2 octaves. # # It would be easier to do with transpose in dottes.fmt, but I can't get # that to work properly for a 2 octave downward transpose. # # This relies on abcm2ps >= 6.0 but does not check for it. if [ $# != 1 ]; then echo "Usage: makeCello.sh <book dir name>" exit 1 fi # Transpose down (return 0) if bottom note was < C. transposedowntwo() { return $(($3 >= 100)) } dir=`pwd` booke=$dir/$1 outdir=$dir/$1-Cello mkdir -p $outdir # Copy book component items. cp $booke/*.txt $outdir echo "Cello" > $outdir/instrument.txt find $booke -name "*.abc" | sort | while read filename do name=`basename $filename .abc` range=`./abcrange.py $filename` # Move down either one octave or two, depending on the range # of the tune. If there are any notes below middle C, transpose # down one octave. The default is to transpose down two octaves. middle="d" if transposedowntwo $range; then middle="D" fi sed -e "/^ *K:/s/$/ clef=bass middle=$middle/" $filename > $outdir/$name.abc done