# HG changeset patch # User Jim Hague # Date 1582108435 0 # Node ID 1139aa0eb0c26e837f299fbf6c2522bec05cb818 # Parent ac7e1edc114fc4653c76f529fca7ecf37b058ed9 Revist tempo change code when generating web audio. Now Mac friendly. diff -r ac7e1edc114f -r 1139aa0eb0c2 makeWebAudio.sh --- a/makeWebAudio.sh Tue Feb 18 18:20:19 2020 +0000 +++ b/makeWebAudio.sh Wed Feb 19 10:33:55 2020 +0000 @@ -60,14 +60,20 @@ echo "Warning: $1 has no tempo. Using 120." tempo="120" fi - pos=`expr index $tempo '='` - numtempo=${tempo:pos} - notelenprefix=${tempo:0:pos} + numtempo=${tempo##*=} + notelenprefix=${tempo%%=*} + if [ "$notelenprefix" = "$numtempo" ]; then + notelenprefix= + else + notelenprefix="${notelenprefix}=" + fi # Calculate new tempo. newtempo=$(( ( $numtempo * $4 ) / $5 )) + echo "Old tempo $tempo new tempo ${notelenprefix}${newtempo}" # 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 > $tunedir/$newspeedfilename + sed -e "/^Q:/d" -e "/^K:/a\\ +Q: ${notelenprefix}${newtempo}" $1 > $tunedir/$newspeedfilename makeaudiofiles $tunedir/$newspeedfilename $tunedir --mute=0,-1 rm $tunedir/$newspeedfilename }