2012-03-04 12:39:12 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2013-02-22 01:09:37 +00:00
|
|
|
# Make audio required for the website but not for the book.
|
2012-03-04 12:39:12 +00:00
|
|
|
# They go into web/<book>.
|
|
|
|
#
|
|
|
|
|
|
|
|
if [ $# != 1 ]; then
|
2013-02-22 01:09:37 +00:00
|
|
|
echo "Usage: makeWebAudio.sh <book dir name>"
|
2012-03-04 12:39:12 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
dir=`pwd`
|
|
|
|
|
|
|
|
booke=$dir/$1
|
|
|
|
builddir=$dir/web/$1
|
|
|
|
|
|
|
|
mkdir -p $builddir
|
|
|
|
|
2013-02-22 01:09:37 +00:00
|
|
|
# Now, for each tune, make the tune bitmap and sound. Do this to temp
|
2012-03-04 16:09:06 +00:00
|
|
|
# files and rename into place to make updates as atomic as possible.
|
2012-03-04 12:39:12 +00:00
|
|
|
find $booke -name "*.abc" | sort |
|
|
|
|
while read filename
|
|
|
|
do
|
|
|
|
name=`basename $filename .abc`
|
2012-03-05 09:33:07 +00:00
|
|
|
tmpname=${name}.tmp
|
2012-03-04 12:39:12 +00:00
|
|
|
|
2012-03-05 09:33:07 +00:00
|
|
|
abc2midi $filename -o $builddir/${tmpname}.mid
|
|
|
|
timidity -Ow -o $builddir/${tmpname}.wav $builddir/${tmpname}.mid
|
|
|
|
lame --quiet $builddir/${tmpname}.wav $builddir/${tmpname}.mp3
|
2012-03-04 16:09:06 +00:00
|
|
|
|
2012-03-05 09:33:07 +00:00
|
|
|
mv $builddir/${tmpname}.mid $builddir/${name}.mid
|
|
|
|
mv $builddir/${tmpname}.mp3 $builddir/${name}.mp3
|
|
|
|
rm $builddir/${tmpname}.wav
|
2012-03-04 12:39:12 +00:00
|
|
|
done
|