forked from CryHavoc/dottes
Make 1/4, 1/2 and 3/4 speed audio for tunes.
Name them 'veryslow', 'slow' and 'littleslow'.
This commit is contained in:
parent
652808a894
commit
fc1d7cfc88
|
@ -39,29 +39,41 @@ makeaudiofiles()
|
||||||
rm $builddir/${tmpname}.wav
|
rm $builddir/${tmpname}.wav
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Make audio for a new tempo for the abc file $1, giving the output files
|
||||||
|
# the same name with a prefix $2. The new tempo is the original tempo
|
||||||
|
# (120 used if not specified), multiplied by $3 and divided by $4.
|
||||||
|
makeaudiofortempo()
|
||||||
|
{
|
||||||
|
name=`basename $filename .abc`
|
||||||
|
newspeedfilename="$2-${name}.abc"
|
||||||
|
|
||||||
|
# Prepare new speed audio files.
|
||||||
|
# The tempo is either a plain number, or <notelen>=<number>.
|
||||||
|
tempo=`$dir/abcfield.py --field Q $1`
|
||||||
|
if [ -z $tempo ]; then
|
||||||
|
echo "Warning: $1 has no tempo. Using 120."
|
||||||
|
tempo="120"
|
||||||
|
fi
|
||||||
|
pos=`expr index $tempo '='`
|
||||||
|
numtempo=${tempo:pos}
|
||||||
|
notelenprefix=${tempo:0:pos}
|
||||||
|
# Calculate new tempo.
|
||||||
|
newtempo=$(( ( $numtempo * $3 ) / $4 ))
|
||||||
|
# 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}" $1 > $builddir/$newspeedfilename
|
||||||
|
makeaudiofiles $builddir/$newspeedfilename
|
||||||
|
rm $builddir/$newspeedfilename
|
||||||
|
}
|
||||||
|
|
||||||
# Generate audio files and slow speed (currently half speed) audio files.
|
# Generate audio files and slow speed (currently half speed) audio files.
|
||||||
find $booke -name "*.abc" | sort |
|
find $booke -name "*.abc" | sort |
|
||||||
while read filename
|
while read filename
|
||||||
do
|
do
|
||||||
makeaudiofiles $filename
|
makeaudiofiles $filename
|
||||||
|
|
||||||
name=`basename $filename .abc`
|
# Now make 1/4, 1/2 and 3/4 speed audio.
|
||||||
slowspeedfilename="slowspeed-${name}.abc"
|
makeaudiofortempo $filename "veryslow" 1 4
|
||||||
|
makeaudiofortempo $filename "slow" 1 2
|
||||||
# Prepare slow speed audio files.
|
makeaudiofortempo $filename "littleslow" 3 4
|
||||||
# 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