A musical 12-tone alarm for the Raspberry Pi (part 4)

This page is to detail an error which occurred in the scripts I wrote last year in this series of articles.

One of the procedures which is used in several scripts is called getbarlist
Unfortunately this had two or three errors in it.

the erroneous version is listed below:

getbarlist () {
 #generates a file containing the structure of the 28 possible distinct
 #bar types  in the structure name n n n x
 #first build as a string
b="1n1 2. x "
b+="2n1 2 4 x 2n2 4. 4. x "
b+="3n1 4.. 4 16 x 3n2 4.. 8. 8 x 3n3 4. 4 8 x 3n4 4. 8. 8. x \
3n5 4 4. 8 x 3n6 4 4 4 x "
b+="4n1 2 8 16 16 x 4n2 4.. 8. 16 16 x 4n3 4.. 8 8 16 x 4n4 4. 4 16 16 \
x 4n5 4. 8. 8 16 x 4n6 4 4 8. 16 x 4n7 4 4 8 8 x 4n8 8. 8. 8. 8. x"
b+="$5n1 2 16 16 16 16 x 5n2 4.. 8 16 16 16 x 5n3 4. 8. 16 16 16 \
x 5n4 4. 8 8 16 16 x 5n5 4 4 8 16 16 x 5n6 4 8. 8 8 16 x 5n7 4 8 8 8 8 x"
b+="$b6n1 4. 8 16 16 16 16 x 6n2 4 4 16 16 16 16 x 6n3 4 8. 8 16 16 16 \
x 6n4 4 8 8 8 16 16 x"
echo $b |sed -e 's/\s\s*/\n/g' > $barlist
#convert string to file with one entry on each line (spaces replaced by LF)
pvar 'list of bar structures' barlist
} #------------ end of getbarlist ------------

The correct version should be:

getbarlist () {
#generates a file containing the structure of the 28 possible distinct
#bar types in the structure name n n n x
#first build as a string
b="1n1 2. x "
b+="2n1 2 4 x 2n2 4. 4. x "
b+="3n1 4.. 4 16 x 3n2 4.. 8. 8 x 3n3 4. 4 8 x 3n4 4. 8. 8. x \
3n5 4 4. 8 x 3n6 4 4 4 x "
b+="4n1 2 8 16 16 x 4n2 4.. 8. 16 16 x 4n3 4.. 8 8 16 x 4n4 4. 4 16 16 \
x 4n5 4. 8. 8 16 x 4n6 4 4 8. 16 x 4n7 4 4 8 8 x 4n8 8. 8. 8. 8. x "
b+="5n1 2 16 16 16 16 x 5n2 4.. 8 16 16 16 x 5n3 4. 8. 16 16 16 \
x 5n4 4. 8 8 16 16 x 5n5 4 4 8 16 16 x 5n6 4 8. 8 8 16 x 5n7 4 8 8 8 8 x "
b+="6n1 4. 8 16 16 16 16 x 6n2 4 4 16 16 16 16 x 6n3 4 8. 8 16 16 16 \
x 6n4 4 8 8 8 16 16 x"
echo $b |sed -e 's/\s\s*/\n/g' > $barlist
#convert string to file with one entry on each line (spaces replaced by LF)
pvar 'list of bar structures' barlist
} #------------ end of getbarlist ------------

I have amended the original articles and the downloadable scripts, adding a line
(debug 10Mar2014)
in the comments at the top of each script affected

I have also added a previously unpublished script called lpinverted.sh
This plays a sequence of the 12 tone tunes against an inverted version of itself.
This is fairly simple to achieve using a powerful command built into lilypond,
using a line such as \inversion fis’ fis’ \tune
which takes a defined tune and includes an inversion or mirror image, in this case about the note f sharp.

The extra program is included in the zip file containing all the scripts here
or it can be viewed here
y
ou can see and here typical output in this post here

SEE THIS ADDITIONAL POST WHICH HAS MORE INFORMATION

Advertisements

One thought on “A musical 12-tone alarm for the Raspberry Pi (part 4)

  1. Pingback: Sounding Off…bugs corrected and a new script | rbnrpi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s