changeset 748:ce5c7214f9aa

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.
author Jim Hague <jim.hague@acm.org>
date Fri, 13 Oct 2017 15:44:15 +0100
parents 34c7947b4542
children 06fec6764661
files Session/Compact/BearDance.abc dottes.tex.firstline-tune dottes.tex.tune makeAll.sh makeAltoRecorderCFingering.sh makeBooke.sh makeBookeTunePages.sh makeCello.sh makeGraphics.sh makeHornInF.sh makeWeb.sh makeWebAudio.sh makeWebGraphics.sh
diffstat 13 files changed, 94 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Session/Compact/BearDance.abc	Fri Oct 13 15:44:15 2017 +0100
@@ -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:|
--- a/dottes.tex.firstline-tune	Fri Oct 13 10:50:18 2017 +0100
+++ b/dottes.tex.firstline-tune	Fri Oct 13 15:44:15 2017 +0100
@@ -1,1 +1,1 @@
-\showfirstline{$name}{$fulltitle}{$graphicsdir/firstline-$name}
+\showfirstline{$name}{$fulltitle}{$firstlineimagefile}
--- a/dottes.tex.tune	Fri Oct 13 10:50:18 2017 +0100
+++ b/dottes.tex.tune	Fri Oct 13 15:44:15 2017 +0100
@@ -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
--- a/makeAll.sh	Fri Oct 13 10:50:18 2017 +0100
+++ b/makeAll.sh	Fri Oct 13 15:44:15 2017 +0100
@@ -9,12 +9,20 @@
 
 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 @@
 
 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"
 }
--- a/makeAltoRecorderCFingering.sh	Fri Oct 13 10:50:18 2017 +0100
+++ b/makeAltoRecorderCFingering.sh	Fri Oct 13 15:44:15 2017 +0100
@@ -25,7 +25,7 @@
 
 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`
--- a/makeBooke.sh	Fri Oct 13 10:50:18 2017 +0100
+++ b/makeBooke.sh	Fri Oct 13 15:44:15 2017 +0100
@@ -17,6 +17,12 @@
 builddir=$dir/build
 booketex=$builddir/dottes.tex
 bookepdf=$builddir/dottes.pdf
+usecompact=""
+
+if [ "$1" = "--use-compact" ]; then
+    usecompact="yes"
+    shift
+fi
 
 papersize=$1
 shift
--- a/makeBookeTunePages.sh	Fri Oct 13 10:50:18 2017 +0100
+++ b/makeBookeTunePages.sh	Fri Oct 13 15:44:15 2017 +0100
@@ -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 <book dir name>"
+    echo "Usage: makeBookeTunePages.sh [--use-compact] <book dir name>"
     exit 1
 fi
 
@@ -25,11 +32,28 @@
 
 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
--- a/makeCello.sh	Fri Oct 13 10:50:18 2017 +0100
+++ b/makeCello.sh	Fri Oct 13 15:44:15 2017 +0100
@@ -53,7 +53,7 @@
 
 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`
--- a/makeGraphics.sh	Fri Oct 13 10:50:18 2017 +0100
+++ b/makeGraphics.sh	Fri Oct 13 15:44:15 2017 +0100
@@ -17,7 +17,7 @@
 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 @@
         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
--- a/makeHornInF.sh	Fri Oct 13 10:50:18 2017 +0100
+++ b/makeHornInF.sh	Fri Oct 13 15:44:15 2017 +0100
@@ -25,7 +25,7 @@
 
 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`
--- a/makeWeb.sh	Fri Oct 13 10:50:18 2017 +0100
+++ b/makeWeb.sh	Fri Oct 13 15:44:15 2017 +0100
@@ -67,7 +67,7 @@
 # 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
--- a/makeWebAudio.sh	Fri Oct 13 10:50:18 2017 +0100
+++ b/makeWebAudio.sh	Fri Oct 13 15:44:15 2017 +0100
@@ -66,7 +66,7 @@
 }
 
 # 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
--- a/makeWebGraphics.sh	Fri Oct 13 10:50:18 2017 +0100
+++ b/makeWebGraphics.sh	Fri Oct 13 15:44:15 2017 +0100
@@ -20,7 +20,7 @@
 # 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`