# HG changeset patch # User Jim Hague # Date 1361495377 0 # Node ID 0ef955669a9a7372202fb53816f4b5a108267eee # Parent f2c8ca48b8a463e1bc394b8130e99a88e63feb50 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. diff -r f2c8ca48b8a4 -r 0ef955669a9a dottes.html.tune --- 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 @@
  • PDF
  • MIDI
  • + href="../@MASTERBOOKE@/@TUNE@.mid">MIDI
  • MP3
  • + href="../@MASTERBOOKE@/@TUNE@.mp3">MP3
  • ABC
  • diff -r f2c8ca48b8a4 -r 0ef955669a9a makeAll.sh --- 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" diff -r f2c8ca48b8a4 -r 0ef955669a9a makeWeb.sh --- 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 []" +if [ $# -lt 2 -o $# -gt 3 ]; then + echo "Usage: makeWeb.sh []" 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//&/\&}/" \ diff -r f2c8ca48b8a4 -r 0ef955669a9a makeWebAudio.sh --- /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/. +# + +if [ $# != 1 ]; then + echo "Usage: makeWebAudio.sh " + 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 diff -r f2c8ca48b8a4 -r 0ef955669a9a makeWebGraphics.sh --- /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/. +# + +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 diff -r f2c8ca48b8a4 -r 0ef955669a9a makeWebItems.sh --- 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/. -# - -if [ $# != 1 ]; then - echo "Usage: makeWebItems.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 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