From 6df224a53d5f54558455dda5a4bb9644a8e6c515 Mon Sep 17 00:00:00 2001 From: Jim Hague Date: Sun, 1 Sep 2013 22:20:25 +0100 Subject: [PATCH 1/3] Add tempo to Astleys Ride and Enrico. --- Library/AstleysRide.abc | 1 + Library/Enrico.abc | 1 + 2 files changed, 2 insertions(+) diff --git a/Library/AstleysRide.abc b/Library/AstleysRide.abc index 3c13e64..cf5861b 100644 --- a/Library/AstleysRide.abc +++ b/Library/AstleysRide.abc @@ -1,6 +1,7 @@ X:1 T:Astley's Ride M:4/4 +Q:180 K:G dB|"G"G2G2 G2FG|"D"A2A2 A2BA|"C"GFED E2F2|"G"GABc dcBA| G2G2 G2FG|"D"A2A2 A2BA|"C"GFED "D7"E2F2|G4G2::GA|B2B2 B2AB|"Am"c2c2 cdcB| diff --git a/Library/Enrico.abc b/Library/Enrico.abc index 5dda19c..c84580e 100644 --- a/Library/Enrico.abc +++ b/Library/Enrico.abc @@ -3,6 +3,7 @@ T:Enrico R:Reel M:C| L:1/8 +Q:150 K:D |: A2 | "D" d2 fe "G" dc dB | "D" ABAG F2 A2 | "D" d2 ef "G" gfgf |\ "A" e2 a2 a2 f2 | From 3dc65395b43cba9673ac918e2eaf1c381c690564 Mon Sep 17 00:00:00 2001 From: Jim Hague Date: Sun, 1 Sep 2013 22:24:58 +0100 Subject: [PATCH 2/3] Reduce size of generated audio files. Set Timidity to produce mono output and crank up the compression on MP3 and OGGs. --- makeWebAudio.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/makeWebAudio.sh b/makeWebAudio.sh index bc0effd..95a478c 100755 --- a/makeWebAudio.sh +++ b/makeWebAudio.sh @@ -25,13 +25,13 @@ find $booke -name "*.abc" | sort | tmpname=${name}.tmp abc2midi $filename -o $builddir/${tmpname}.mid - timidity -Ow -o $builddir/${tmpname}.wav $builddir/${tmpname}.mid - lame --quiet $builddir/${tmpname}.wav $builddir/${tmpname}.mp3 + timidity -OwM -o $builddir/${tmpname}.wav $builddir/${tmpname}.mid + lame -m m -V 9 --quiet $builddir/${tmpname}.wav $builddir/${tmpname}.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 -o $builddir/${tmpname}.ogg $builddir/${tmpname}.wav + oggenc -Q -q 0 -o $builddir/${tmpname}.ogg $builddir/${tmpname}.wav mv $builddir/${tmpname}.mid $builddir/${name}.mid mv $builddir/${tmpname}.mp3 $builddir/${name}.mp3 From 5a08c5c1b0cce072c68e65dfd189b4c46d081cf4 Mon Sep 17 00:00:00 2001 From: Jim Hague Date: Sun, 1 Sep 2013 23:13:06 +0100 Subject: [PATCH 3/3] Make slow speed web audio files. --- makeWebAudio.sh | 59 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 16 deletions(-) diff --git a/makeWebAudio.sh b/makeWebAudio.sh index 95a478c..9bf017c 100755 --- a/makeWebAudio.sh +++ b/makeWebAudio.sh @@ -16,25 +16,52 @@ builddir=$dir/web/$1 mkdir -p $builddir -# Now, for each tune, make the tune bitmap and sound. 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. 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. +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 + # 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 + + 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 +} + +# Generate audio files and slow speed (currently half speed) audio files. find $booke -name "*.abc" | sort | while read filename do + makeaudiofiles $filename + name=`basename $filename .abc` - tmpname=${name}.tmp + slowspeedfilename="slowspeed-${name}.abc" - abc2midi $filename -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 - # 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 - - 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 + # Prepare slow speed audio files. + # The tempo is either a plain number, or =. + tempo=`$dir/abcfield.py --field Q $filename` + if [ -z $tempo ]; then + echo "Warning: $filename has no tempo. Using 120." + tempo="120" + fi + pos=`expr index $tempo '='` + numtempo=${tempo:pos} + notelenprefix=${tempo:0:pos} + # Make new tempo half original speed. + newtempo=$(( $numtempo / 2 )) + # 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}" $filename > $builddir/$slowspeedfilename + makeaudiofiles $builddir/$slowspeedfilename done