Sounding Off

I have always been interested in the generation and playing of music using a computer. In the late 1980s I was working with the BBC B computer and had a network of 24 machines in the classroom where I taught. I used a program called TMS (The Music System) which was originally available on tape cassette ( happy loading not!) but which I converted for use on the Econet System. This enabled the keyboard entry of three part music with a visual score. I wanted to be able to use more parts than this, so I devised a system to synchronise the computers together via the network and was able to enter parts for a Brandenburg Concerto played with an orchestra of 24 computer. It sounded amazing!
I was interested to see on the BBC News Site recently an article about some Exeter University Students winning a prize for doing something similar syncing mobile phones together!

However I digress. I have also recently been looking at playing music on the Raspberry PI. I came across a cool article by Johnathan Kulp which used a bash script to generate and play a short piece of 12 tone music, which he was using for an alarm clock. The script used a music engraver program called lilypond to generate the music which is available on the Raspbian Wheezy distribution, together with the program Timidity to  play a midi file of the score. I have played with the script, which is a superb example of the use of the sed text stream editor, and initially I couldn’t get it to work. It produced a lilypond file, but it contained errors, and I didn’t know enough about the structure of the lilypond file to debug it. The author Jon was extremely helpful, and sent me a copy of a working lilypond file from which I was able to debug the script and get it working. I have since modified it to produce an mp3 file of the music as well as the midi file, and the output of the currrent version are posted on my website here.

I look forward to adding full details on the script, detailing how it works, and also my experiences in installing and using the necessary software to make it work in a day or two. I am  occupied with Ruby Wedding anniversary celebrations this weekend!

For now you can look at the working output on my website, or just admire the picture below, of a typical computer generated score. Be warned that if you press ahead using the original published script in Johnathan’s article, you may run into problems as I did.

tonerow.preview

An easy start

One of the things I like about the Raspberry Pi is the ease with which you can change the system you are using merely by swapping in a different SD card. When I start a new project, especially if I want to write it up later for others to use I like to start with a fresh install of Raspian. However, it is a bit tedious to have to go through the raspi-config settings, sudo apt-get udate and sudo apt-get upgrade every time, and also in my case to set up the connection to a local nfs share on my Synology NAS, and a fixed Wifi ip address.

The solution is to carry out all these processes once, and then to save the resulting SD card image, and use this as a starting point for new projects. Of course every so often, you need to update it again, but this can easily be done.

If you have a windows PC you probably use win32diskimager to write an image to your SD card. You can equally use this to save an image. The program likes to save to an existing image, or at least I can’t find a way of creating a new one from the program. However this can easily be done by right clicking in a suitable windows directory and choosing new -> text document. Rename the text document from New Text Document.txt to SDbackup.img and then you can use this as the document into which to read the image from the SD card.

Note you will have to set your PC to display file extensions for this to work, which is done in the Folder Options control panel in the View tab advanced settings. Untick the line Hide extensions for known file types and click OK

Place the SD card you wish to backup in a card reader attached to your PC, and note the drive letter when it mounts (in my case F:) Start up win32diskimager and select the drive for the SD card (F) and click the folder icon and navigate to your new SDbackup.img fileClick the Read button to copy the SD card to the new image file.readSdcard
In future, you can use this image file to re-write to your SD card when you want a new pristine operating system with which to start a new project.

Setting up Wireless motion-detect cam

Today I have been experimenting with the Rasperry Pi camera board, and setting it up with a wireless connection as a motion detect surveillance camera with my Synology NAS surveillance module.

I used an excellent article by dozencrows here as the basis, and added the code to the wifi-ethernet router raspberry pi I discussed a couple of days ago. This has a fixed wifi address which is ideal as a server to send video to the Synology module, although it will equally work just for viewing by any computer on my local network with a suitable browser.

For now, here are some pictures showing the output from the completed project in the Synology module, and the camera itself. I’ll add a write up later.

Project write up now added here

The configuration screen for the Synology modulepi-cam1

The live display from the Synology module
pi-cam2

The Raspberry Pi with a lego mounted camera boardpi-cam3

WiFi to ethernet adapter for an ethernet-ready TV article

i have just completed my first article for the site. It is available on a separate page here
I
t describes in detail how to setup a Raspberry Pi as a router, fed from the wireless lan to a TV (or computer or network switch) connected to the ethernet port. This enables a device with an ethernet port but no wireless adapter to connect to your local network (and hence the internet) via a wireless connection.

Let’s get started

Having had two Raspberry Pi(s) for some time, I thought it was time to put down some thoughts on what I’ve been doing with them. They are great fun to use, and complement well my previous interest in using Lego Mindstorms kits, the results of which can be seen here.

Both my Pi are model B but the early versions with only 256Mb of RAM. So far this has not been a problem, but I may get a 512Mb model later. I have played with various distributions. One of the great things about the Pi is being able to change the SD card so easily and switch from one distribution to another. Thus one minute it is an XBMC system, the next a Wireless Access Point, and the next (my latest project) a WiFi to ethernet adaptor to allow my TV to connect to the internet via my ADSL Wireless Router. Along the way I have had a play with breadboards and programming the GPIO, and one novel feature is the pink case on the Pi shown in the photo which is produced on a 3D printer at the School where I used to work.

I think my first technical post will be to describe the TV WiFi adaptor which I have just finished. I’d better make a start on writing it up!