view makeCello.sh @ 282:ced1d1ba42f6

Various revisions of printed book presentation. 1. Purple background on the front and and new blank back pages. 2. UK English for hyphenation and date presentation. 3. Dedication and 'About Havoc' section. 4. Footer just page number in centre of page. 5. Revised copyright discussion. 6. Since it's a book, make content, intro and first lines to chapters. And prompt individual tunes to sections. 7. Omit 'Tunes' chapter heading. It doesn't look good in A5.
author Jim Hague <jim.hague@acm.org>
date Fri, 05 Jul 2013 18:56:34 +0100
parents 7b98278d6e8b
children b4a0161e8870
line wrap: on
line source

#!/bin/bash
#
# Copy a booke to cello-friendly form. Bass clef, transposed down 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

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
        # 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 grep -v "^[A-Z]:" $filename | sed -e 's/"[^"]*"//g' | grep -q "[A-Z],"; then
            middle="D"
        fi
        name=`basename $filename .abc`
        sed -e "/^ *K:/s/$/ clef=bass middle=$middle/" $filename > $outdir/$name.abc
    done