From a5b76de4841cac3af629455394d2c62970e5792b Mon Sep 17 00:00:00 2001 From: Jim Hague Date: Fri, 13 Oct 2017 15:44:15 +0100 Subject: [PATCH] Introduce mechanism for having different tune images for compact printed output. Sort alternate .abc in subdir 'Compact' under the booke dir. Use that as the graphic for A5 output, assuming it will be vertically more compact. Use Bear Dance as an example, as it has commentary that currently overflows an A5 landscape page. For the moment, transposed Bookes don't transpose and so don't use Compact. --- Session/Compact/BearDance.abc | 10 ++++++++++ dottes.tex.firstline-tune | 2 +- dottes.tex.tune | 2 +- makeAll.sh | 20 +++++++++++++++++-- makeAltoRecorderCFingering.sh | 2 +- makeBooke.sh | 6 ++++++ makeBookeTunePages.sh | 36 +++++++++++++++++++++++++++++------ makeCello.sh | 2 +- makeGraphics.sh | 23 +++++++++++++++++++++- makeHornInF.sh | 2 +- makeWeb.sh | 2 +- makeWebAudio.sh | 2 +- makeWebGraphics.sh | 2 +- 13 files changed, 94 insertions(+), 17 deletions(-) create mode 100644 Session/Compact/BearDance.abc diff --git a/Session/Compact/BearDance.abc b/Session/Compact/BearDance.abc new file mode 100644 index 0000000..2e1ebfa --- /dev/null +++ b/Session/Compact/BearDance.abc @@ -0,0 +1,10 @@ +X:1 +T:Bear Dance +M:2/4 +L:1/16 +Q:1/4=120 +K:Em +"Em" B2 E2 E4| B2 E2 E3 F| G2G2F2G2|"D" A4G2A2| \ +|"Em" B2B2 "D" A2A2|"Em" G2G2 "D" F4|"Em" E2G2 "D" F2D2|"Em" E4 E4:| +"Em" E2G2E2G2|"D" F2D2D4|"C" E2G2E2G2|"D" A4G2A2| \ +|"Em" B2B2 "D" A2A2|"C" G2G2 "D" F4|"Em" E2G2 "D" F2D2|"Em" E4 E4:| diff --git a/dottes.tex.firstline-tune b/dottes.tex.firstline-tune index ac2902e..b17c85b 100644 --- a/dottes.tex.firstline-tune +++ b/dottes.tex.firstline-tune @@ -1 +1 @@ -\showfirstline{$name}{$fulltitle}{$graphicsdir/firstline-$name} +\showfirstline{$name}{$fulltitle}{$firstlineimagefile} diff --git a/dottes.tex.tune b/dottes.tex.tune index 65631d2..05ac036 100644 --- a/dottes.tex.tune +++ b/dottes.tex.tune @@ -1,5 +1,5 @@ \tunestart -\showtune{$name}{$title}{$subtitle}{$fulltitle}{$tradition}{$composer}{$parts}{$graphicsdir/$name} +\showtune{$name}{$title}{$subtitle}{$fulltitle}{$tradition}{$composer}{$parts}{$tuneimagefile} $notes $history diff --git a/makeAll.sh b/makeAll.sh index 552b91d..37ad860 100755 --- a/makeAll.sh +++ b/makeAll.sh @@ -9,12 +9,20 @@ fi makeABooke() { + # Print graphics. ./makeGraphics.sh "$1" + + # Normal graphics printed output. ./makeBookeTunePages.sh "$1" ./makeBooke.sh A4 "$1" + ./makeBooke.sh Nook "$1" + + # Compact graphics printed output. + ./makeBookeTunePages.sh --use-compact "$1" ./makeBooke.sh A5 "$1" ./makeBooklet.sh "$1" - ./makeBooke.sh Nook "$1" + + # Web output. ./makeWebGraphics.sh "$1" ./makeWebAudio.sh "$1" ./makeWeb.sh "$1" "$1" "$2" @@ -22,12 +30,20 @@ makeABooke() makeATransposedBooke() { + # Print graphics. ./makeGraphics.sh "$1" + + # Normal graphics printed output. ./makeBookeTunePages.sh "$1" ./makeBooke.sh A4 "$1" + ./makeBooke.sh Nook "$1" + + # Compact graphics printed output. + ./makeBookeTunePages.sh --use-compact "$1" ./makeBooke.sh A5 "$1" ./makeBooklet.sh "$1" - ./makeBooke.sh Nook "$1" + + # Web output. Uses audio from main booke. ./makeWebGraphics.sh "$1" ./makeWeb.sh "$1" "$2" "$3" } diff --git a/makeAltoRecorderCFingering.sh b/makeAltoRecorderCFingering.sh index e3c8325..a9bb43f 100755 --- a/makeAltoRecorderCFingering.sh +++ b/makeAltoRecorderCFingering.sh @@ -25,7 +25,7 @@ cp $booke/*.txt $outdir echo "Alto Recorder (C Fingering)" > $outdir/instrument.txt -find $booke -name "*.abc" | sort | +find $booke -depth 1 -name "*.abc" | sort | while read filename do name=`basename $filename .abc` diff --git a/makeBooke.sh b/makeBooke.sh index b67c256..d499131 100755 --- a/makeBooke.sh +++ b/makeBooke.sh @@ -17,6 +17,12 @@ dir=`pwd` builddir=$dir/build booketex=$builddir/dottes.tex bookepdf=$builddir/dottes.pdf +usecompact="" + +if [ "$1" = "--use-compact" ]; then + usecompact="yes" + shift +fi papersize=$1 shift diff --git a/makeBookeTunePages.sh b/makeBookeTunePages.sh index cc82a9a..90a7e86 100755 --- a/makeBookeTunePages.sh +++ b/makeBookeTunePages.sh @@ -8,8 +8,15 @@ # makeGraphics.sh to make these. # +usecompact="" + +if [ $# -gt 1 -a "$1" = "--use-compact" ]; then + usecompact="yes" + shift +fi + if [ $# != 1 ]; then - echo "Usage: makeBookeTunePages.sh " + echo "Usage: makeBookeTunePages.sh [--use-compact] " exit 1 fi @@ -25,11 +32,28 @@ mkdir -p $builddir rm -f $tunesoutput $indexoutput -# Now, for each tune, make the tune graphic and add it, inside a -# centre section, so the document. Then add a TOC entry. -find $booke -name "*.abc" | sort | +# Now, for each tune, build the tunes part and the first line sections +# of the document. +find $booke -depth 1 -name "*.abc" | sort | while read filename do - $dir/abctemplate.py --latex --value "graphicsdir=$graphicsdir" --template $dir/dottes.tex.tune $filename >> $tunesoutput - $dir/abctemplate.py --latex --value "graphicsdir=$graphicsdir" --template $dir/dottes.tex.firstline-tune $filename >> $indexoutput + name=`basename $filename .abc` + tuneimagefile="${graphicsdir}/${name}" + compacttuneimagefile="${graphicsdir}/compact-${name}" + firstlineimagefile="${graphicsdir}/firstline-${name}" + + if [ "$usecompact" -a -f ${compacttuneimagefile}.pdf ]; then + tuneimagefile=$compacttuneimagefile + fi + + $dir/abctemplate.py \ + --latex \ + --value "tuneimagefile=${tuneimagefile}" \ + --template $dir/dottes.tex.tune \ + $filename >> $tunesoutput + $dir/abctemplate.py \ + --latex \ + --value "firstlineimagefile=${firstlineimagefile}" \ + --template $dir/dottes.tex.firstline-tune \ + $filename >> $indexoutput done diff --git a/makeCello.sh b/makeCello.sh index 67ca279..572e6c9 100755 --- a/makeCello.sh +++ b/makeCello.sh @@ -53,7 +53,7 @@ cp $booke/*.txt $outdir echo "Cello" > $outdir/instrument.txt -find $booke -name "*.abc" | sort | +find $booke -depth 1 -name "*.abc" | sort | while read filename do name=`basename $filename .abc` diff --git a/makeGraphics.sh b/makeGraphics.sh index 59fec1d..4e31c0f 100755 --- a/makeGraphics.sh +++ b/makeGraphics.sh @@ -17,7 +17,7 @@ graphicsdir=$dir/graphics/$1 mkdir -p $graphicsdir # Now, for each tune, make the tune graphic. -find $booke -name "*.abc" | sort | +find $booke -depth 1 -name "*.abc" | sort | while read filename do name=`basename $filename .abc` @@ -42,3 +42,24 @@ find $booke -name "*.abc" | sort | pdfcrop $graphicsdir/firstline-$name-tocrop.pdf $graphicsdir/firstline-$name.pdf rm $graphicsdir/firstline-$name-tocrop.pdf done + +# And make any compact tune graphics. +if [ ! -d ${booke}/Compact ]; then + exit +fi + +find ${booke}/Compact -depth 1 -name "*.abc" | sort | + while read filename + do + name=`basename $filename .abc` + + # Make the tune graphic. + abcm2ps -E -F singletune -O $graphicsdir/compact-${name}.eps $filename + # Make $name.eps so we can build with LaTeX. + mv $graphicsdir/compact-${name}001.eps $graphicsdir/compact-${name}.eps + # And make the corresponding PDF. + epstopdf --outfile=$graphicsdir/compact-${name}-tocrop.pdf $graphicsdir/compact-${name}.eps + # And crop it, so the graphic is as big as possible on the page. + pdfcrop $graphicsdir/compact-${name}-tocrop.pdf $graphicsdir/compact-${name}.pdf + rm $graphicsdir/compact-${name}-tocrop.pdf + done diff --git a/makeHornInF.sh b/makeHornInF.sh index b7eafd8..0b0e32d 100755 --- a/makeHornInF.sh +++ b/makeHornInF.sh @@ -25,7 +25,7 @@ cp $booke/*.txt $outdir echo "Horn in F" > $outdir/instrument.txt -find $booke -name "*.abc" | sort | +find $booke -depth 1 -name "*.abc" | sort | while read filename do name=`basename $filename .abc` diff --git a/makeWeb.sh b/makeWeb.sh index 8ac82ec..7944095 100755 --- a/makeWeb.sh +++ b/makeWeb.sh @@ -67,7 +67,7 @@ cp $1-*.pdf $webdir # Now, for each tune, make the tune page. rm -f $webdir/$tunelist declare -a filenames -filenames=(`find $bookedir -name "*.abc" | sort`) +filenames=(`find $bookedir -depth 1 -name "*.abc" | sort`) nofiles=${#filenames[@]} for (( i=0; i < ${nofiles}; i++ )) do diff --git a/makeWebAudio.sh b/makeWebAudio.sh index 7c71732..df8d9dc 100755 --- a/makeWebAudio.sh +++ b/makeWebAudio.sh @@ -66,7 +66,7 @@ makeaudiofortempo() } # Generate audio files and slow speed (currently half speed) audio files. -find $booke -name "*.abc" | sort | +find $booke -depth 1 -name "*.abc" | sort | while read filename do makeaudiofiles $filename diff --git a/makeWebGraphics.sh b/makeWebGraphics.sh index 2c69654..47abb50 100755 --- a/makeWebGraphics.sh +++ b/makeWebGraphics.sh @@ -20,7 +20,7 @@ mkdir -p $builddir # Now, for each tune, make the main tune and tune first line bitmaps. # Do this to temp files and rename into place to make updates as # atomic as possible. -find $booke -name "*.abc" | sort | +find $booke -depth 1 -name "*.abc" | sort | while read filename do name=`basename $filename .abc`