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.
This commit is contained in:
Jim Hague 2013-02-22 01:09:37 +00:00
parent 9c19ccc96d
commit 36bd2926b5
5 changed files with 63 additions and 20 deletions

View File

@ -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>

View File

@ -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"

View File

@ -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 @@ 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//&/\&}/" \

View File

@ -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/<book>.
#
if [ $# != 1 ]; then
echo "Usage: makeWebItems.sh <book dir name>"
echo "Usage: makeWebAudio.sh <book dir name>"
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

33
makeWebGraphics.sh Executable file
View File

@ -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