-
+
Work out the melody or play along
with these audio players. They play the melody repeatedly. There's
a variety of speeds to choose from. You can also download the
@@ -59,18 +59,18 @@
diff --git a/makeAll.sh b/makeAll.sh
index 57538a4..b35bcce 100755
--- a/makeAll.sh
+++ b/makeAll.sh
@@ -48,7 +48,7 @@ makeATransposedBooke()
makeBookePrint "$1"
# Web output. Uses audio from main booke.
- ./makeWebGraphics.sh "$1"
+ ./makeWebGraphics.sh "$1" "$3"
./makeWeb.sh "$1" "$2" "$3"
}
diff --git a/makeWeb.sh b/makeWeb.sh
index 1c89b08..48c0c34 100755
--- a/makeWeb.sh
+++ b/makeWeb.sh
@@ -18,7 +18,10 @@ booke=$1
masterbooke=$2
bookedir=$dir/$1
masterbookedir=$dir/$2
-webdir=$dir/web/$1
+basewebdir=$dir/web
+mastertunedir=tunes
+basetunedir=$mastertunedir
+bookewebdir=$dir/web/$1
graphicsdir=$dir/graphics/$1
output=index.html
tunelist=tunelist.html
@@ -38,34 +41,35 @@ fi
if [ -n "$instrument" ]; then
title="${title} ($instrument)"
subtitle="${subtitle} ($instrument)"
+ basetunedir="${basetunedir}-${instrument}"
fi
-mkdir -p $webdir
+mkdir -p $bookewebdir
sed -e "s/@BUILD@/$buildno/" -e "s/@SUBTITLE@/$subtitle/" \
- -e "s/@TITLE@/$title/" -e "s/@BOOK@/$booke/" dottes.html > $webdir/$output
+ -e "s/@TITLE@/$title/" -e "s/@BOOK@/$booke/" dottes.html > $bookewebdir/$output
for item in intro
do
- rm -f $webdir/$item.html
+ rm -f $bookewebdir/$item.html
if [ -r $bookedir/$item.md ]; then
- pandoc --from=markdown --to=html --output=$webdir/$item.html $bookedir/$item.md
+ pandoc --from=markdown --to=html --output=$bookewebdir/$item.html $bookedir/$item.md
else
- touch $webdir/$item.html
+ touch $bookewebdir/$item.html
fi
done
# Copy in any htaccess.
if [ -r $masterbookedir/htaccess ]; then
- cp $masterbookedir/htaccess $webdir/.htaccess
+ cp $masterbookedir/htaccess $bookewebdir/.htaccess
fi
# Copy in the book PDFs. Like the graphics, Midi etc. these are assumed
# to be already generated.
-cp $1-*.pdf $webdir
+cp $1-*.pdf $bookewebdir
# Now, for each tune, make the tune page.
-rm -f $webdir/$tunelist
+rm -f $bookewebdir/$tunelist
declare -a filenames
filenames=(`find $bookedir -maxdepth 1 -name "*.abc" | sort`)
nofiles=${#filenames[@]}
@@ -73,22 +77,15 @@ for (( i=0; i < ${nofiles}; i++ ))
do
filename=${filenames[$i]}
name=`basename $filename .abc`
+ tunedir=$basetunedir/$name
+ tunewebdir=$basewebdir/$tunedir
+ mkdir -p $tunewebdir
# Copy the ABC into the web.
- cp $filename $webdir
+ cp $filename $tunewebdir
# Generate MusicXML into the web.
- python $abc2xml $filename > ${webdir}/${name}.xml
-
- # If we are not the master booke, link the mp3s in from the
- # master page in a desperate attempt to make IE8 work.
- # The Jenkins archive will dereference the soft link, it seems,
- # but I guess I can live with copies of the MP3 for now.
- if [ "$booke" != "$masterbooke" ]; then
- pushd ${webdir} > /dev/null
- ln -f -s ../${masterbooke}/*${name}.mp3 .
- popd > /dev/null
- fi
+ python $abc2xml $filename > ${tunewebdir}/${name}.xml
# Get date and time of last change to tune.
lastchanged=`hg log --limit 1 --template "{date|shortdate}" $masterbookedir/${name}.abc`
@@ -101,34 +98,35 @@ do
if [ $i -gt 0 ]; then
prev=${filenames[$((i - 1))]}
- prevpage=`basename $prev .abc`.html
+ prevpage=`basename $prev .abc`
prevarg="--prev $prev"
fi
if [ $i -lt $((nofiles - 1)) ]; then
next=${filenames[$((i + 1))]}
- nextpage=`basename $next .abc`.html
+ nextpage=`basename $next .abc`
nextarg="--next $next"
fi
# Generate the tune web page.
- tunepage=${name}.html
- learnerpage=learner-${name}.html
-
$dir/abctemplate.py \
- --value "masterbooke=${masterbooke}" \
+ --value "booke=${booke}" \
+ --value "mastertunedir=${mastertunedir}" \
--value "lastchanged=${lastchanged}" \
--value "prevpage=${prevpage}" \
--value "nextpage=${nextpage}" \
${prevarg} ${nextarg} \
--template dottes.html.tune \
- $filename > $webdir/$tunepage
+ $filename > $tunewebdir/index.html
$dir/abctemplate.py \
- --value "masterbooke=${masterbooke}" \
+ --value "booke=${booke}" \
+ --value "mastertunedir=${mastertunedir}" \
--value "lastchanged=${lastchanged}" \
--value "prevpage=${prevpage}" \
--value "nextpage=${nextpage}" \
${prevarg} ${nextarg} \
--template dottes.html.learnertune \
- $filename > $webdir/$learnerpage
- $dir/abctemplate.py --template dottes.html.tuneindex $filename >> $webdir/$tunelist
+ $filename > $tunewebdir/learner.html
+ $dir/abctemplate.py \
+ --value "tunedir=${tunedir}" \
+ --template dottes.html.tuneindex $filename >> $bookewebdir/$tunelist
done
diff --git a/makeWebAudio.sh b/makeWebAudio.sh
index 1d6da1b..f696d1f 100755
--- a/makeWebAudio.sh
+++ b/makeWebAudio.sh
@@ -12,39 +12,46 @@ fi
dir=`pwd`
booke=$dir/$1
-builddir=$dir/web/$1
-
-mkdir -p $builddir
+basewebdir=$dir/web
+basetunedir=$basewebdir/tunes
# Make MP3 and OGG files for the input .abc. Since we're listening to
# a doorbell playing the tunes, go for lowest quality (and hence smallest)
-# MP3 and OGG. $1 is the input filename, $2 is optional args for timidity.
+# MP3 and OGG. $1 is the input filename, $2 is the output directory,
+# $3 is optional args for timidity.
makeaudiofiles()
{
name=`basename $1 .abc`
+ tunedir="$2"
- abc2midi $1 -o $builddir/${name}.mid
- timidity -OwM $2 -o $builddir/${name}.wav $builddir/${name}.mid
- lame -m m -V 9 --quiet $builddir/${name}.wav $builddir/${name}.mp3
+ abc2midi $1 -o $tunedir/${name}.tmp.mid
+ mv $tunedir/${name}.tmp.mid $tunedir/${name}.mid
+ timidity -OwM $3 -o $tunedir/${name}.wav $tunedir/${name}.mid
+ lame -m m -V 9 --quiet $tunedir/${name}.wav $tunedir/${name}.tmp.mp3
+ mv $tunedir/${name}.tmp.mp3 $tunedir/${name}.mp3
# Timidity can generate OGG directly. But we need to generate WAV
# for lame, and oggenc produces smaller output. OGG is needed for
# Firefox's audio tag. FF doesn't support MP3, some others support
# MP3 but not OGG.
- oggenc -Q -q 0 -o $builddir/${name}.ogg $builddir/${name}.wav
+ oggenc -Q -q 0 -o $tunedir/${name}.tmp.ogg $tunedir/${name}.wav
+ mv $tunedir/${name}.tmp.ogg $tunedir/${name}.ogg
- rm $builddir/${name}.wav
+ rm $tunedir/${name}.wav
}
-# Make audio for a new tempo for the abc file $1, giving the output files
-# the same name with a prefix $2. The new tempo is the original tempo
-# (120 used if not specified), multiplied by $3 and divided by $4.
-# These audio files are for Learner use; I've found that having the
-# chords thumping away can make it hard to distinguish the melody, so
-# arrange for timidity to mute everything except the melody track.
+# Make audio for a new tempo for the abc file $1, giving the output
+# files the same name with a prefix $3 in output directory $2. The new
+# tempo is the original tempo (120 used if not specified), multiplied
+# by $4 and divided by $5. These audio files are for Learner use;
+# I've found that having the chords thumping away can make it hard to
+# distinguish the melody, so arrange for timidity to mute everything
+# except the melody track.
makeaudiofortempo()
{
- name=`basename $filename .abc`
- newspeedfilename="$2-${name}.abc"
+ name=`basename $1 .abc`
+ tunedir="$2"
+ newspeedfilename="$3-${name}.abc"
+ mkdir -p $tunedir
# Prepare new speed audio files.
# The tempo is either a plain number, or =.
@@ -57,23 +64,27 @@ makeaudiofortempo()
numtempo=${tempo:pos}
notelenprefix=${tempo:0:pos}
# Calculate new tempo.
- newtempo=$(( ( $numtempo * $3 ) / $4 ))
+ newtempo=$(( ( $numtempo * $4 ) / $5 ))
# Insert new tempo and delete old. Old may not exist,
# so do this rather than overwrite.
- sed -e "/^Q:/d" -e "/^K:/aQ: ${notelenprefix}${newtempo}" $1 > $builddir/$newspeedfilename
- makeaudiofiles $builddir/$newspeedfilename --mute=0,-1
- rm $builddir/$newspeedfilename
+ sed -e "/^Q:/d" -e "/^K:/aQ: ${notelenprefix}${newtempo}" $1 > $tunedir/$newspeedfilename
+ makeaudiofiles $tunedir/$newspeedfilename $tunedir --mute=0,-1
+ rm $tunedir/$newspeedfilename
}
# Generate audio files and slow speed (currently half speed) audio files.
find $booke -maxdepth 1 -name "*.abc" | sort |
while read filename
do
- makeaudiofiles $filename
+ name=`basename $filename .abc`
+ tunedir=$basetunedir/$name
+ mkdir -p $tunedir
+
+ makeaudiofiles $filename $tunedir
# Now make 1/4, 1/2 and 3/4 speed audio.
- makeaudiofortempo $filename "veryslow" 1 4
- makeaudiofortempo $filename "slow" 2 4
- makeaudiofortempo $filename "littleslow" 3 4
- makeaudiofortempo $filename "normal" 4 4
+ makeaudiofortempo $filename $tunedir "veryslow" 1 4
+ makeaudiofortempo $filename $tunedir "slow" 2 4
+ makeaudiofortempo $filename $tunedir "littleslow" 3 4
+ makeaudiofortempo $filename $tunedir "normal" 4 4
done
diff --git a/makeWebGraphics.sh b/makeWebGraphics.sh
index 5828711..546f86b 100755
--- a/makeWebGraphics.sh
+++ b/makeWebGraphics.sh
@@ -1,21 +1,25 @@
#!/bin/bash
#
# Make graphics required for the website but not for the book.
-# They go into web/.
+# They go into web/tunes/, or web/tunes-/.
#
-if [ $# != 1 ]; then
- echo "Usage: makeWebGraphics.sh "
+if [[ $# -lt 1 ]]; then
+ echo "Usage: makeWebGraphics.sh []"
exit 1
fi
dir=`pwd`
booke=$dir/$1
-builddir=$dir/web/$1
+basewebdir=$dir/web
+basetunedir=$basewebdir/tunes
graphicsdir=$dir/graphics/$1
+instrument=$2
-mkdir -p $builddir
+if [ -n "$instrument" ]; then
+ basetunedir="${basetunedir}-${instrument}"
+fi
# 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
@@ -24,16 +28,19 @@ find $booke -maxdepth 1 -name "*.abc" | sort |
while read filename
do
name=`basename $filename .abc`
- tmpname=${name}.tmp
- convert -colors 256 -quality 90 -density 200 $graphicsdir/${name}.pdf $builddir/${tmpname}.png
- convert -colors 256 -quality 90 -density 200 $graphicsdir/firstline-${name}.pdf $builddir/firstline-${tmpname}.png
+ tunedir=$basetunedir/$name
+ mkdir -p $tunedir
- mv $builddir/${tmpname}.png $builddir/${name}.png
- mv $builddir/firstline-${tmpname}.png $builddir/firstline-${name}.png
+ tmpname=${name}.tmp
+ convert -colors 256 -quality 90 -density 200 $graphicsdir/${name}.pdf $tunedir/${tmpname}.png
+ convert -colors 256 -quality 90 -density 200 $graphicsdir/firstline-${name}.pdf $tunedir/firstline-${tmpname}.png
+
+ mv $tunedir/${tmpname}.png $tunedir/${name}.png
+ mv $tunedir/firstline-${tmpname}.png $tunedir/firstline-${name}.png
# Make the web downloadable PDF with the tune title.
- abcm2ps -E -F singletuneweb -O $builddir/$name.eps $filename
+ abcm2ps -E -F singletuneweb -O $tunedir/$name.eps $filename
# And make the corresponding PDF.
- epstopdf --outfile=$builddir/$name.pdf $builddir/${name}001.eps
- rm $builddir/${name}001.eps
+ epstopdf --outfile=$tunedir/$name.pdf $tunedir/${name}001.eps
+ rm $tunedir/${name}001.eps
done