Bach on console speaker

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).

< C++ in Stevenage | Whitelocks and jalapenos >

Miniblog

(nuggets of inanity)

Tuesday Apr 24th 2007, 16:54 »
Just took the annual web design survey that AListApart do. I don't realy consider myself to be a web designer, but I have been doing a lot of HTML and CSS lately.
Monday Apr 23rd 2007, 18:23 »
Strange, there appears to be a bare-knuckle boxing match going on in the field outside my flat. Wish they wouldn't make so much noise about it.
Thursday Mar 1st 2007, 18:47 »
“In its written form, Hebrew has no vowels, making it the ideal language for texting.”
—Said in jest on some Radio 4 programme just now.

Archive: 2007 · 2006 · 2005 · 2004
Feed