annotate makeWebAudio.sh @ 373:0a2c60e8e7e4 build-default-166

Automated merge with ssh://hg.cryhavoc.org.uk/dottes
author Jim Hague <jim.hague@acm.org>
date Wed, 28 Aug 2013 16:11:46 +0100
parents e5f59f0e7dd5
children c5d404bf68a3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
43
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
1 #!/bin/bash
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
2 #
223
0ef955669a9a Make transposed tunes use the original audio.
Jim Hague <jim.hague@acm.org>
parents: 197
diff changeset
3 # Make audio required for the website but not for the book.
43
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
4 # They go into web/<book>.
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
5 #
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
6
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
7 if [ $# != 1 ]; then
223
0ef955669a9a Make transposed tunes use the original audio.
Jim Hague <jim.hague@acm.org>
parents: 197
diff changeset
8 echo "Usage: makeWebAudio.sh <book dir name>"
43
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
9 exit 1
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
10 fi
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
11
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
12 dir=`pwd`
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
13
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
14 booke=$dir/$1
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
15 builddir=$dir/web/$1
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
16
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
17 mkdir -p $builddir
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
18
223
0ef955669a9a Make transposed tunes use the original audio.
Jim Hague <jim.hague@acm.org>
parents: 197
diff changeset
19 # Now, for each tune, make the tune bitmap and sound. Do this to temp
48
6f4667d1372d Try to make web item updates atomic-ish.
Jim Hague <jim.hague@laicatc.com>
parents: 43
diff changeset
20 # files and rename into place to make updates as atomic as possible.
43
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
21 find $booke -name "*.abc" | sort |
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
22 while read filename
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
23 do
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
24 name=`basename $filename .abc`
61
3464d5154f49 Fix temp file name to convert.
Jim Hague <jim.hague@acm.org>
parents: 48
diff changeset
25 tmpname=${name}.tmp
43
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
26
61
3464d5154f49 Fix temp file name to convert.
Jim Hague <jim.hague@acm.org>
parents: 48
diff changeset
27 abc2midi $filename -o $builddir/${tmpname}.mid
3464d5154f49 Fix temp file name to convert.
Jim Hague <jim.hague@acm.org>
parents: 48
diff changeset
28 timidity -Ow -o $builddir/${tmpname}.wav $builddir/${tmpname}.mid
3464d5154f49 Fix temp file name to convert.
Jim Hague <jim.hague@acm.org>
parents: 48
diff changeset
29 lame --quiet $builddir/${tmpname}.wav $builddir/${tmpname}.mp3
369
e5f59f0e7dd5 Add audio player to tune web page.
Jim Hague <jim.hague@acm.org>
parents: 223
diff changeset
30 # Timidity can generate OGG directly. But we need to generate WAV
e5f59f0e7dd5 Add audio player to tune web page.
Jim Hague <jim.hague@acm.org>
parents: 223
diff changeset
31 # for lame, and oggenc produces smaller output. OGG is needed for
e5f59f0e7dd5 Add audio player to tune web page.
Jim Hague <jim.hague@acm.org>
parents: 223
diff changeset
32 # Firefox's audio tag. FF doesn't support MP3, some others support
e5f59f0e7dd5 Add audio player to tune web page.
Jim Hague <jim.hague@acm.org>
parents: 223
diff changeset
33 # MP3 but not OGG.
e5f59f0e7dd5 Add audio player to tune web page.
Jim Hague <jim.hague@acm.org>
parents: 223
diff changeset
34 oggenc -Q -o $builddir/${tmpname}.ogg $builddir/${tmpname}.wav
48
6f4667d1372d Try to make web item updates atomic-ish.
Jim Hague <jim.hague@laicatc.com>
parents: 43
diff changeset
35
61
3464d5154f49 Fix temp file name to convert.
Jim Hague <jim.hague@acm.org>
parents: 48
diff changeset
36 mv $builddir/${tmpname}.mid $builddir/${name}.mid
3464d5154f49 Fix temp file name to convert.
Jim Hague <jim.hague@acm.org>
parents: 48
diff changeset
37 mv $builddir/${tmpname}.mp3 $builddir/${name}.mp3
369
e5f59f0e7dd5 Add audio player to tune web page.
Jim Hague <jim.hague@acm.org>
parents: 223
diff changeset
38 mv $builddir/${tmpname}.ogg $builddir/${name}.ogg
61
3464d5154f49 Fix temp file name to convert.
Jim Hague <jim.hague@acm.org>
parents: 48
diff changeset
39 rm $builddir/${tmpname}.wav
43
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
40 done