makeWebAudio.sh
changeset 400 f1c4abe4fc75
parent 399 aeef7b1ca0ad
child 567 cb7a4eff9d5b
--- a/makeWebAudio.sh	Mon Sep 02 10:15:56 2013 +0100
+++ b/makeWebAudio.sh	Mon Sep 02 11:48:16 2013 +0100
@@ -16,27 +16,23 @@
 
 mkdir -p $builddir
 
-# Make MP3 and OGG files for the input .abc. In case we're generating
-# to a live site (which we won't be), do this to temp files and rename
-# into place to make updates as atomic as possible.
+# 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.
 makeaudiofiles()
 {
     name=`basename $1 .abc`
-    tmpname=${name}.tmp
 
-    abc2midi $1 -o $builddir/${tmpname}.mid
-    timidity -OwM -o $builddir/${tmpname}.wav $builddir/${tmpname}.mid
-    lame -m m -V 9 --quiet $builddir/${tmpname}.wav $builddir/${tmpname}.mp3
+    abc2midi $1 -o $builddir/${name}.mid
+    timidity -OwM -o $builddir/${name}.wav $builddir/${name}.mid
+    lame -m m -V 9 --quiet $builddir/${name}.wav $builddir/${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/${tmpname}.ogg $builddir/${tmpname}.wav
+    oggenc -Q -q 0 -o $builddir/${name}.ogg $builddir/${name}.wav
 
-    mv $builddir/${tmpname}.mid $builddir/${name}.mid
-    mv $builddir/${tmpname}.mp3 $builddir/${name}.mp3
-    mv $builddir/${tmpname}.ogg $builddir/${name}.ogg
-    rm $builddir/${tmpname}.wav
+    rm $builddir/${name}.wav
 }
 
 # Make audio for a new tempo for the abc file $1, giving the output files