comparison makeWebAudio.sh @ 400:f1c4abe4fc75 build-default-175

First go at adding the tune learner page.
author Jim Hague <jim.hague@acm.org>
date Mon, 02 Sep 2013 11:48:16 +0100
parents aeef7b1ca0ad
children cb7a4eff9d5b
comparison
equal deleted inserted replaced
399:aeef7b1ca0ad 400:f1c4abe4fc75
14 booke=$dir/$1 14 booke=$dir/$1
15 builddir=$dir/web/$1 15 builddir=$dir/web/$1
16 16
17 mkdir -p $builddir 17 mkdir -p $builddir
18 18
19 # Make MP3 and OGG files for the input .abc. In case we're generating 19 # Make MP3 and OGG files for the input .abc. Since we're listening to
20 # to a live site (which we won't be), do this to temp files and rename 20 # a doorbell playing the tunes, go for lowest quality (and hence smallest)
21 # into place to make updates as atomic as possible. 21 # MP3 and OGG.
22 makeaudiofiles() 22 makeaudiofiles()
23 { 23 {
24 name=`basename $1 .abc` 24 name=`basename $1 .abc`
25 tmpname=${name}.tmp
26 25
27 abc2midi $1 -o $builddir/${tmpname}.mid 26 abc2midi $1 -o $builddir/${name}.mid
28 timidity -OwM -o $builddir/${tmpname}.wav $builddir/${tmpname}.mid 27 timidity -OwM -o $builddir/${name}.wav $builddir/${name}.mid
29 lame -m m -V 9 --quiet $builddir/${tmpname}.wav $builddir/${tmpname}.mp3 28 lame -m m -V 9 --quiet $builddir/${name}.wav $builddir/${name}.mp3
30 # Timidity can generate OGG directly. But we need to generate WAV 29 # Timidity can generate OGG directly. But we need to generate WAV
31 # for lame, and oggenc produces smaller output. OGG is needed for 30 # for lame, and oggenc produces smaller output. OGG is needed for
32 # Firefox's audio tag. FF doesn't support MP3, some others support 31 # Firefox's audio tag. FF doesn't support MP3, some others support
33 # MP3 but not OGG. 32 # MP3 but not OGG.
34 oggenc -Q -q 0 -o $builddir/${tmpname}.ogg $builddir/${tmpname}.wav 33 oggenc -Q -q 0 -o $builddir/${name}.ogg $builddir/${name}.wav
35 34
36 mv $builddir/${tmpname}.mid $builddir/${name}.mid 35 rm $builddir/${name}.wav
37 mv $builddir/${tmpname}.mp3 $builddir/${name}.mp3
38 mv $builddir/${tmpname}.ogg $builddir/${name}.ogg
39 rm $builddir/${tmpname}.wav
40 } 36 }
41 37
42 # Make audio for a new tempo for the abc file $1, giving the output files 38 # Make audio for a new tempo for the abc file $1, giving the output files
43 # the same name with a prefix $2. The new tempo is the original tempo 39 # the same name with a prefix $2. The new tempo is the original tempo
44 # (120 used if not specified), multiplied by $3 and divided by $4. 40 # (120 used if not specified), multiplied by $3 and divided by $4.