Make slow speed web audio files.
This commit is contained in:
parent
3dc65395b4
commit
5a08c5c1b0
|
@ -16,15 +16,15 @@ builddir=$dir/web/$1
|
||||||
|
|
||||||
mkdir -p $builddir
|
mkdir -p $builddir
|
||||||
|
|
||||||
# Now, for each tune, make the tune bitmap and sound. Do this to temp
|
# Make MP3 and OGG files for the input .abc. In case we're generating
|
||||||
# files and rename into place to make updates as atomic as possible.
|
# to a live site (which we won't be), do this to temp files and rename
|
||||||
find $booke -name "*.abc" | sort |
|
# into place to make updates as atomic as possible.
|
||||||
while read filename
|
makeaudiofiles()
|
||||||
do
|
{
|
||||||
name=`basename $filename .abc`
|
name=`basename $1 .abc`
|
||||||
tmpname=${name}.tmp
|
tmpname=${name}.tmp
|
||||||
|
|
||||||
abc2midi $filename -o $builddir/${tmpname}.mid
|
abc2midi $1 -o $builddir/${tmpname}.mid
|
||||||
timidity -OwM -o $builddir/${tmpname}.wav $builddir/${tmpname}.mid
|
timidity -OwM -o $builddir/${tmpname}.wav $builddir/${tmpname}.mid
|
||||||
lame -m m -V 9 --quiet $builddir/${tmpname}.wav $builddir/${tmpname}.mp3
|
lame -m m -V 9 --quiet $builddir/${tmpname}.wav $builddir/${tmpname}.mp3
|
||||||
# Timidity can generate OGG directly. But we need to generate WAV
|
# Timidity can generate OGG directly. But we need to generate WAV
|
||||||
|
@ -37,4 +37,31 @@ find $booke -name "*.abc" | sort |
|
||||||
mv $builddir/${tmpname}.mp3 $builddir/${name}.mp3
|
mv $builddir/${tmpname}.mp3 $builddir/${name}.mp3
|
||||||
mv $builddir/${tmpname}.ogg $builddir/${name}.ogg
|
mv $builddir/${tmpname}.ogg $builddir/${name}.ogg
|
||||||
rm $builddir/${tmpname}.wav
|
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`
|
||||||
|
slowspeedfilename="slowspeed-${name}.abc"
|
||||||
|
|
||||||
|
# Prepare slow speed audio files.
|
||||||
|
# The tempo is either a plain number, or <notelen>=<number>.
|
||||||
|
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
|
done
|
||||||
|
|
Loading…
Reference in New Issue