From 36bd2926b523bd9a3c14c86c481dc2fb9b446e42 Mon Sep 17 00:00:00 2001 From: Jim Hague Date: Fri, 22 Feb 2013 01:09:37 +0000 Subject: [PATCH] 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. --- dottes.html.tune | 4 ++-- makeAll.sh | 18 ++++++++++++---- makeWeb.sh | 17 +++++++++------ makeWebItems.sh => makeWebAudio.sh | 11 +++------- makeWebGraphics.sh | 33 ++++++++++++++++++++++++++++++ 5 files changed, 63 insertions(+), 20 deletions(-) rename makeWebItems.sh => makeWebAudio.sh (57%) create mode 100755 makeWebGraphics.sh diff --git a/dottes.html.tune b/dottes.html.tune index 170b8e2..d5233f1 100644 --- a/dottes.html.tune +++ b/dottes.html.tune @@ -25,9 +25,9 @@
  • PDF
  • MIDI
  • + href="../@MASTERBOOKE@/@TUNE@.mid">MIDI
  • MP3
  • + href="../@MASTERBOOKE@/@TUNE@.mp3">MP3
  • ABC
  • diff --git a/makeAll.sh b/makeAll.sh index 223c4b7..a6e99ed 100755 --- a/makeAll.sh +++ b/makeAll.sh @@ -12,14 +12,24 @@ makeABooke() ./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" diff --git a/makeWeb.sh b/makeWeb.sh index 813d849..0697791 100755 --- a/makeWeb.sh +++ b/makeWeb.sh @@ -4,8 +4,8 @@ # to be already built. # -if [ $# -lt 1 -o $# -gt 2 ]; then - echo "Usage: makeWeb.sh []" +if [ $# -lt 2 -o $# -gt 3 ]; then + echo "Usage: makeWeb.sh []" exit 1 fi @@ -15,8 +15,10 @@ bookedir=$dir/$1 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 @@ if [ -r $bookedir/intro.txt ]; then 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 @@ find $bookedir -name "*.abc" | sort | # 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//&/\&}/" \ diff --git a/makeWebItems.sh b/makeWebAudio.sh similarity index 57% rename from makeWebItems.sh rename to makeWebAudio.sh index 42bd6b5..c6fd443 100755 --- a/makeWebItems.sh +++ b/makeWebAudio.sh @@ -1,11 +1,11 @@ #!/bin/bash # -# Make items required for the website but not for the book. +# Make audio required for the website but not for the book. # They go into web/. # if [ $# != 1 ]; then - echo "Usage: makeWebItems.sh " + echo "Usage: makeWebAudio.sh " exit 1 fi @@ -13,26 +13,21 @@ 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 +# 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 - 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 diff --git a/makeWebGraphics.sh b/makeWebGraphics.sh new file mode 100755 index 0000000..7ba79b0 --- /dev/null +++ b/makeWebGraphics.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# +# Make graphics required for the website but not for the book. +# They go into web/. +# + +if [ $# != 1 ]; then + echo "Usage: makeWebGraphics.sh " + 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