changeset 223:0ef955669a9a

Make transposed tunes use the original audio. The aim of MIDI and MP3 is to allow the user to hear what a tune sounds like. For transposed bookes, I think this should be reused from the main booke page, because hearing it at the transposed pitch isn't a major help. And in fact given the way cello transposition is done, the sound won't be transposed anyway. And Jane hasn't complained. This will speed up building the bookes by removing audio generation, the slowest process, from the transposed bookes.
author Jim Hague <jim.hague@acm.org>
date Fri, 22 Feb 2013 01:09:37 +0000
parents f2c8ca48b8a4
children db569ede2165
files dottes.html.tune makeAll.sh makeWeb.sh makeWebAudio.sh makeWebGraphics.sh makeWebItems.sh
diffstat 6 files changed, 94 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/dottes.html.tune	Fri Feb 22 00:33:00 2013 +0000
+++ b/dottes.html.tune	Fri Feb 22 01:09:37 2013 +0000
@@ -25,9 +25,9 @@
         <li><a class="dottes-link-tune dottes-pdf"
                href="@TUNE@.pdf">PDF</a></li>
         <li><a class="dottes-link-tune dottes-midi"
-               href="@TUNE@.mid">MIDI</a></li>
+               href="../@MASTERBOOKE@/@TUNE@.mid">MIDI</a></li>
         <li><a class="dottes-link-tune dottes-mp3"
-               href="@TUNE@.mp3">MP3</a></li>
+               href="../@MASTERBOOKE@/@TUNE@.mp3">MP3</a></li>
         <li><a class="dottes-link-tune dottes-abc"
                href="@TUNE@.abc">ABC</a></li>
       </ul>
--- a/makeAll.sh	Fri Feb 22 00:33:00 2013 +0000
+++ b/makeAll.sh	Fri Feb 22 01:09:37 2013 +0000
@@ -12,14 +12,24 @@
     ./makeGraphics.sh "$1"
     ./makeBookeA5.sh "$1"
     ./makeBookeA4.sh "$1"
-    ./makeWebItems.sh "$1"
-    ./makeWeb.sh "$1" "$2"
+    ./makeWebGraphics.sh "$1"
+    ./makeWebAudio.sh "$1"
+    ./makeWeb.sh "$1" "$1" "$2"
+}
+
+makeATransposedBooke()
+{
+    ./makeGraphics.sh "$1"
+    ./makeBookeA5.sh "$1"
+    ./makeBookeA4.sh "$1"
+    ./makeWebGraphics.sh "$1"
+    ./makeWeb.sh "$1" "$2" "$3"
 }
 
 makeABooke $1
 
 ./makeCello.sh $1
-makeABooke $1-Cello cello
+makeATransposedBooke $1-Cello $1 cello
 
 ./makeHornInF.sh $1
-makeABooke $1-HornInF "horn in F"
+makeATransposedBooke $1-HornInF $1 "horn in F"
--- a/makeWeb.sh	Fri Feb 22 00:33:00 2013 +0000
+++ b/makeWeb.sh	Fri Feb 22 01:09:37 2013 +0000
@@ -4,8 +4,8 @@
 # to be already built.
 #
 
-if [ $# -lt 1 -o $# -gt 2 ]; then
-    echo "Usage: makeWeb.sh <book dir name> [<instrument name>]"
+if [ $# -lt 2 -o $# -gt 3 ]; then
+    echo "Usage: makeWeb.sh <book dir name> <master book dir name> [<instrument name>]"
     exit 1
 fi
 
@@ -15,8 +15,10 @@
 webdir=$dir/web/$1
 graphicsdir=$dir/graphics/$1
 output=index.html
-title=$1
 booke=$1
+masterbooke=$2
+title=$booke
+instrument=$3
 
 buildno=`cat buildno.txt`
 subtitle=
@@ -28,10 +30,10 @@
     intro=`cat $bookedir/intro.txt`
 fi
 
-if [ -n "$2" ]; then
+if [ -n "$instrument" ]; then
     # Remove any transposition tag from title.
-    title="${title/-*/} ($2)"
-    subtitle="${subtitle} ($2)"
+    title="${title} ($instrument)"
+    subtitle="${subtitle} ($instrument)"
 fi
 
 mkdir -p $webdir
@@ -64,7 +66,10 @@
         # Generate the tune web page.
         tunepage=${name}.html
 
+        # If the title contains HTML character entities, escape
+        # initial '&' in the title - it means things to sed.
         sed -e "s/@TITLE@/${title//&/\&}/" \
+            -e "s/@MASTERBOOKE@/${masterbooke}/" \
             -e "s/@TUNE@/${name}/" dottes.html.tune > $webdir/$tunepage
 
         sed -e "s/@TITLE@/${title//&/\&}/" \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/makeWebAudio.sh	Fri Feb 22 01:09:37 2013 +0000
@@ -0,0 +1,34 @@
+#!/bin/bash
+#
+# Make audio required for the website but not for the book.
+# They go into web/<book>.
+#
+
+if [ $# != 1 ]; then
+    echo "Usage: makeWebAudio.sh <book dir name>"
+    exit 1
+fi
+
+dir=`pwd`
+
+booke=$dir/$1
+builddir=$dir/web/$1
+
+mkdir -p $builddir
+
+# Now, for each tune, make the tune bitmap and sound. Do this to temp
+# files and rename into place to make updates as atomic as possible.
+find $booke -name "*.abc" | sort |
+    while read filename
+    do
+        name=`basename $filename .abc`
+        tmpname=${name}.tmp
+
+        abc2midi $filename -o $builddir/${tmpname}.mid
+        timidity -Ow -o $builddir/${tmpname}.wav $builddir/${tmpname}.mid
+        lame --quiet $builddir/${tmpname}.wav $builddir/${tmpname}.mp3
+
+        mv $builddir/${tmpname}.mid $builddir/${name}.mid
+        mv $builddir/${tmpname}.mp3 $builddir/${name}.mp3
+        rm $builddir/${tmpname}.wav
+    done
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/makeWebGraphics.sh	Fri Feb 22 01:09:37 2013 +0000
@@ -0,0 +1,33 @@
+#!/bin/bash
+#
+# Make graphics required for the website but not for the book.
+# They go into web/<book>.
+#
+
+if [ $# != 1 ]; then
+    echo "Usage: makeWebGraphics.sh <book dir name>"
+    exit 1
+fi
+
+dir=`pwd`
+
+booke=$dir/$1
+builddir=$dir/web/$1
+graphicsdir=$dir/graphics/$1
+
+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 |
+    while read filename
+    do
+        name=`basename $filename .abc`
+        tmpname=${name}.tmp
+        convert -density 96 $graphicsdir/${name}.eps $builddir/${tmpname}.png
+        convert -density 96 $graphicsdir/firstline-${name}.eps $builddir/firstline-${tmpname}.png
+
+        mv $builddir/${tmpname}.png $builddir/${name}.png
+        mv $builddir/firstline-${tmpname}.png $builddir/firstline-${name}.png
+    done
--- a/makeWebItems.sh	Fri Feb 22 00:33:00 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-#!/bin/bash
-#
-# Make items required for the website but not for the book.
-# They go into web/<book>.
-#
-
-if [ $# != 1 ]; then
-    echo "Usage: makeWebItems.sh <book dir name>"
-    exit 1
-fi
-
-dir=`pwd`
-
-booke=$dir/$1
-builddir=$dir/web/$1
-graphicsdir=$dir/graphics/$1
-
-mkdir -p $builddir
-
-# Now, for each tune, make the tune JPG and sound. Do this to temp
-# files and rename into place to make updates as atomic as possible.
-find $booke -name "*.abc" | sort |
-    while read filename
-    do
-        name=`basename $filename .abc`
-        tmpname=${name}.tmp
-        convert -density 96 $graphicsdir/${name}.eps $builddir/${tmpname}.png
-        convert -density 96 $graphicsdir/firstline-${name}.eps $builddir/firstline-${tmpname}.png
-
-        abc2midi $filename -o $builddir/${tmpname}.mid
-        timidity -Ow -o $builddir/${tmpname}.wav $builddir/${tmpname}.mid
-        lame --quiet $builddir/${tmpname}.wav $builddir/${tmpname}.mp3
-
-        mv $builddir/${tmpname}.png $builddir/${name}.png
-        mv $builddir/firstline-${tmpname}.png $builddir/firstline-${name}.png
-        mv $builddir/${tmpname}.mid $builddir/${name}.mid
-        mv $builddir/${tmpname}.mp3 $builddir/${name}.mp3
-        rm $builddir/${tmpname}.wav
-    done