Mercurial > dottes
comparison makeWebAudio.sh @ 1029:1139aa0eb0c2
Revist tempo change code when generating web audio.
Now Mac friendly.
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Wed, 19 Feb 2020 10:33:55 +0000 |
parents | e4d31e094d24 |
children | 70e1ff83fe34 |
comparison
equal
deleted
inserted
replaced
1028:ac7e1edc114f | 1029:1139aa0eb0c2 |
---|---|
58 tempo=`$dir/abcfield.py --field Q $1` | 58 tempo=`$dir/abcfield.py --field Q $1` |
59 if [ -z $tempo ]; then | 59 if [ -z $tempo ]; then |
60 echo "Warning: $1 has no tempo. Using 120." | 60 echo "Warning: $1 has no tempo. Using 120." |
61 tempo="120" | 61 tempo="120" |
62 fi | 62 fi |
63 pos=`expr index $tempo '='` | 63 numtempo=${tempo##*=} |
64 numtempo=${tempo:pos} | 64 notelenprefix=${tempo%%=*} |
65 notelenprefix=${tempo:0:pos} | 65 if [ "$notelenprefix" = "$numtempo" ]; then |
66 notelenprefix= | |
67 else | |
68 notelenprefix="${notelenprefix}=" | |
69 fi | |
66 # Calculate new tempo. | 70 # Calculate new tempo. |
67 newtempo=$(( ( $numtempo * $4 ) / $5 )) | 71 newtempo=$(( ( $numtempo * $4 ) / $5 )) |
72 echo "Old tempo $tempo new tempo ${notelenprefix}${newtempo}" | |
68 # Insert new tempo and delete old. Old may not exist, | 73 # Insert new tempo and delete old. Old may not exist, |
69 # so do this rather than overwrite. | 74 # so do this rather than overwrite. |
70 sed -e "/^Q:/d" -e "/^K:/aQ: ${notelenprefix}${newtempo}" $1 > $tunedir/$newspeedfilename | 75 sed -e "/^Q:/d" -e "/^K:/a\\ |
76 Q: ${notelenprefix}${newtempo}" $1 > $tunedir/$newspeedfilename | |
71 makeaudiofiles $tunedir/$newspeedfilename $tunedir --mute=0,-1 | 77 makeaudiofiles $tunedir/$newspeedfilename $tunedir --mute=0,-1 |
72 rm $tunedir/$newspeedfilename | 78 rm $tunedir/$newspeedfilename |
73 } | 79 } |
74 | 80 |
75 # Generate audio files and slow speed (currently half speed) audio files. | 81 # Generate audio files and slow speed (currently half speed) audio files. |