I discovered a little program called
Ditty a while ago (there's
a Debian package available). It can make tuneful beeps through the console
speaker on a Linux machine, or through /dev/dsp. I spent some of my
evenings in Stevenage trying to pick out my favourite bit of Bach with it,
and got fairly close. Now I'm back I was able to go through the
sheet music (PDF)
and work it out better. Here's the first bit (although you can only do
one melody line at once, unfortunately):
#!/usr/bin/ditty -df # J. S. Bach, Fugue in G minor # BWV 578 # # Simple version of the first bit, right hand only. # Based closely on the sheet music: # # http://www.sheetmusicarchive.net/compositions/bach_578.pdf # # Dittified by Geoff Richards <qef@ungwe.org>. # This is in the public domain. g3q d4q bb3qe ae g3e bb a g f# a dq g3e d a d bb as g ae d g3e ds g ae ds a bbe as g a d d4 c bb3s a g bb a g f# a g d g a bb c4 d e f4s e d f e d c# e d4e a3 d4 e f4s g f gt . ges ft g as g a bb a g f e f4s a g a c# a g a d a g a c# a g a f4s d c# d g d c# d a d c# d g d c# d a3e f4 g3 e4 f3 a d4 f eb4e a . eb eb g . d c4s bb3 c4 d c a g a bb3 g4 f# g a3 f#4 e f# g4h .
Ditty won't recognise the comments, so you'll have to strip them out to play it. I wrote this for a slightly hacked version which ignores the comments (and I've sent the patch to the author, so hopefully the next version will allow self-executing tunes like this).