Peterborough Raspberry Jam

Just back from the Peterborough Raspberry Jam held today. A great occasion which I enjoyed. Thanks to Mike Mills for all his hard work in organising the event.

For my sins, I spoke about the Pi and Music, and gave demos of the Sounding Off articles (entitled a Musical 12 tone alarm for the Raspberry Pi parts 1-4 on the project pages ) and also the Musical Dice Game (see Post)  and using Sonic-Pi (see post). All the Sonic_Pi programs I have written can be downloaded here. I also gave a short talk on using the PiRingo board with ScratchGpio.

If you were there and want more details, or if you missed it, you can find all the details and download links on this site. The PiRingo programs I used can be downloaded here There is a post about PiRingo here

Please note there is a bug in ScratchGpio5 when used with PiRingo which is corrected in ScratchGpio5dev which you can download from
http://cymplecy.wordpress.com/2013/11/26/scratchgpio-development-testing/
I
f you already have version 4 that works OK.

It never rains but it pours!

Yesterday I posted a correction to a routine in the Sounding Off series of articles. In the process I realised that the analysis of the possible bar structures was incomplete, and that there were in fact four further possibilities, 3 with 8 notes per bar, and 1 with nine notes.

The additions 8n1, 8n2, 8n3 ands 9n1 are shown in the image below (click it to enlarge)
The additions give rise to two further possible bar structures for the 3 bar tune, namely
bars patterns 128 and 119 notes.Bar Analysis

Happily it is easy to modify and update the affected files, which are:
serialrpi.sh, serialr.sh, longplay.sh,makearchive.sh,longplaymakearchive.sh
This is done be replacing the procedures getallowedbars() and getbarlist() with the new versions shown below:

getallowedbars () {
 #read in list of allowed bar patterns for 3 bars of 11 notes total
cat > $allowed3bars << EOFallowed3bars 146 155 236 245 335 344 128 119 EOFallowed3bars pvar "allowed 3 bar lengths" allowed3bars } #------------ end of getallowedbars ------------ 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 \a 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 " b+="8n1 4 8 16 16 16 16 16 16 x 8n2 8. 8. 16 16 16 16 16 16 x \ 8n3 8 8 8 8 16 16 16 16 x 9n1 4 16 16 16 16 16 16 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 ------------

or you can view it here

I will leave it as an exercise for the reader to apply these updates. The programs will work without them, but from an analysis point of view these give a more satisfying solution.

Sounding Off…bugs corrected and a new script

Next week I am giving a talk at the Peterborough Raspberry Pi Jam, and in the course of preparing for it I discovered that there was a bug which appeared in several of the Musical 12 tone alarm scripts I wrote last year. This occurred in the procedure called getbarlist.
I have amended all the incorrect scripts in the original articles and they should now work fine.

At the same time I have added a new script which plays two parts of the random tunes against each other, written at the same time but not published.

It produces tunes like these:
invertedtune

You can listen to the tune here

All of the corrected scripts and the new addition can be downloaded in a zip file here

Details of how to use them are in the original article series starting here

Here is page 4 of the series containing details of the changes.