cello lessons from a dead genius

By , January 28, 2013 8:05 pm

Well, it seemed like a good idea at the time …

In the summer of 2011, I quit my job to resume full-time music studies. During the summer semester at the Berkeley Jazzschool in California, I started learning John Coltrane’s solo on the title track of his famous album Blue Train. It was really tough going, but addictive – I was getting my arse handed to me on a plate on a daily basis by a dead person, but I felt like I was way off the well-trodden path and that was really satisfying!

After 3 months studying in various places in the USA, I got back home and resumed work on this transcription in earnest. It became part of my daily routine, and I craved the day that I could play the whole thing note perfect at the same speed as the original. There were so many notes to fit in that I had to come up with totally new ways to use my left thumb, on which the normal cellist’s callus grew to epic proportions. Trane became the best cello teacher I never had. Unfortunately, just around the time I was getting close to being able to nail it, real life intervened, and I had to refocus on earning money. Inspired by Benoît Sauvé’s incredible rendition of the same solo on recorder (recorder?! what a mofo – check out his other videos), I did a couple of very rough recordings with my compact camera for posterity, and moved on.

Sometime later, I discovered a John McLaughlin video on YouTube (sadly no longer available) which had an awesome animated transcription at the bottom – a really cool glimpse inside the craft of a master musician. Then it occurred to me that I could do the same kind of thing with my video, and publish it in case there are any other jazz cellists out there who would be interested in it. I put a lot of effort into notating and fingering it, so it seemed a waste to just let it rot and never see the light of day. After all, I already had the source files and a video, so it was just a simple matter of combining the two, right? How hard could it be?

Very very hard, it turns out. I had to write two new pieces of software, completely overhaul a third, and fix some obscure bugs hidden deep inside a fourth. But I didn’t discover that until I’d reached the point of no return …

I’ll probably blog more at some point about the software engineering hoops I had to jump through in order to make this all work. Email me if you’re interested.

In the mean time, hope you enjoy the video! (You can also view it on YouTube.)

Share

Tool-building hacks #1: audible pings

By , February 11, 2012 8:07 pm

I think I’m genetically a tool-builder. My dad and uncle both take great pleasure in carefully selecting and buying or building tools for their workshops, my mum’s an expert woodcarver with a fair array of sharp pointy things, and these are not the only examples in the family. For me, the habit has manifested in electronic form, and I really enjoy programming new scripts etc. to help me work more efficiently. In fact I’ve collected such a vast array of them over the years that I had to start tracking them under version control back in 1999. (CVS did me proud for many years, but it did not age well, and I finally migrated them to git a few months ago.)

I can’t claim to be remotely unusual in this respect though – there’s a whole subculture of programmers (“hackers”) who can relate to this mindset. Sometimes when I build a new tool, I get the impulse to share it with the world in case it turns out to be of use to anyone else. In the past, these hacks have ended up on my software web page, but I think this blog might be a better medium.

So, without further ado, here’s a cute hack I just built: bping, a wrapper around ping(8) which makes it do a lot of beeping 😉 – one beep per packet received, with pitch going up an octave for every doubling of the response latency. (See below for installation instructions.) Why did I want this?

I use ethernet over power to connect the machines in my bedroom to the equipment in the lounge. In a high-rise apartment block with about 100 wireless networks fighting over the same spectrum band, this is (normally) a much more reliable option. However yesterday the connections in my home network started behaving very weirdly. I tried pinging various machines on the network from each other to narrow down the problem, but it was annoying to have to keep going between rooms to visually monitor the output from the various pings when it would have been quicker to be able to hear the quality of the connections being tested. So I wrote bping, which also turns a laptop into a sort of Geiger counter for wifi.

Currently bping uses bip (here’s a suggested approach to installation) which in turns uses sox to make the beeps. This works fine on Fedora 15 but unfortunately for some reason takes longer than one second to run on Ubuntu 11.10 and openSUSE 12.1, regardless of how short the beep is. I think it’s something to do with pulseaudio, but I haven’t bothered to figure it out yet. Answers on a e-postcard please …

By the way, many of my hacks are already publically available on my github account, but most aren’t documented yet. The current exceptions are:

I’ll try to document some of the others soon. Watch this space!

Share

port redirection from kvm host to guest

By , January 23, 2012 2:58 am

I’ve just started using kvm in earnest, and immediately ran into the challenge of how to access my guest via ssh. My first instinct was to configure the guest in bridged mode, but this doesn’t work well (or at all) with wireless interfaces.

So plan B was to set up port redirection from the host to the guest, e.g. so that ssh’ing to localhost port 2222 would redirect to the guest’s port 22.

After a quick google, some fiddling with iptables, and a glance at the libvirt Networking wiki page, I was still having no luck. Then it hit me – my guest was using user-mode networking, and rather than getting its DHCP-allocated IP from the libvirtd-launched dnsmasq instance on the host, was receiving a hardcoded allocation of 10.0.2.15 from the host which is on 10.0.2.2. This can be extremely puzzling at first, because no network commands run on the host (such as ifconfig, iptables, brctl, route) will reveal this magic address, yet the host is still accessible from the guest via it.

After a lot more googling, I stumbled across a technique for configuring host to guest port redirection on a running VM. This sounded very promising, but virt-manager refused to accept the magic Control-Alt-2 key combination to switch to QEMU monitor mode. It turns out that this is no accident. However, since libvirt 0.8.8, the QEMU monitor can be accessed via virsh.
Note that the --hmp option is required, otherwise the monitor expects the command in JSON format, so omitting it leads to errors like error: internal error cannot parse json ... lexical error: invalid char in json text.

The final hurdle was figuring out the correct monitor command. The host_net_redir command as mentioned in the above article is no longer recognized. Luckily the QEMU monitor interface helped me out here – I spotted an encouraging sounding command hostfwd_add:

# virsh qemu-monitor-command --hmp sles11 'help hostfwd_add'
hostfwd_add [vlan_id name] [tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport -- redirect TCP or UDP connections from host to guest (requires -net user)

and google confirmed that the latter had superceded the former.

So finally we have the complete solution:

# virsh qemu-monitor-command --hmp sles11 'hostfwd_add ::2222-:22'
# ssh -p 2222 localhost
Password:
Last login: Mon Jan 23 00:37:44 2012
linux-mnsh:~ #

Hooray!

UPDATE: just found another very simple solution – add a new NIC to the VM which doesn’t use user-mode networking. Then it will get a IP (on 192.168.100.0/24 by default) which is still NAT’d but also routable via virbr0 on the host, meaning no redirection is necessary; just ssh directly to the guest’s IP from the host. A minor disadvantage of this is that the guest won’t be directly reachable from outside the host, but that’s unlikely to be an issue in most scenarios.

Share

Running Amazon MP3 downloader on 64-bit Ubuntu 11.04 (Natty Narwhal)

By , September 25, 2011 3:00 pm

Amazon MP3 store – a phenomenonly popular online music store. Ubuntu – a phenomenonly popular version of Linux. 64-bit x86_64 CPUs – been around for years. You’d think this was a good combination, wouldn’t you? Wrong 🙁 Amazon, along with Spotify and countless others, is dismally failing to support its rapidly growing set of customers who run Linux. As I’ve said elsewhere, even if 2% of your customers use Linux, that can still be a huge number. Hopefully some day these big companies will acquire some common sense.

Anyway, in the mean time a quick google brought up the following solution:

  • (unfortunately this link no longer works)

Unfortunately it doesn’t work – the step which installs the manually downloaded .deb files fails due to broken dependencies. However further googling found a post from 2008 which revealed a technique based on the very useful getlibs utility.

So here’s my solution:

  1. Download the 32-bit Amazon downloader app for Ubuntu 9.10.
  2. Run sudo dpkg -i --force-all AmazonMP3DownloaderInstall.deb
  3. Run sudo apt-get install getlibs if you don’t already have getlibs installed.
  4. Run sudo getlibs /usr/bin/amazonmp3 and answer yes to the confirmation.

At this point if you try to run /usr/bin/amazonmp3 you’ll probably hit Ubuntu bug 781870. The workaround is as follows:

export GDK_PIXBUF_MODULE_FILE=/usr/lib32/gdk-pixbuf-2.0/2.10.0/loaders.cache
/usr/bin/amazonmp3

You’ll still get an error that it’s trying to load the 64-bit version of libgvfsdbus.so thanks to Ubuntu bug 369498. I had hopes that export GIO_EXTRA_MODULES=/usr/lib32/gio/modules would fix this, but it seems that this variable only gets honoured too late. However, apparently this issue doesn’t stop the program working so can be ignored.

Another option is to use Banshee’s built-in Amazon downloader, but even without all the politics surrounding Ubuntu’s version of Banshee this didn’t suit my tastes.

UPDATE: Wow. Just found out Amazon doesn’t support re-downloading stuff you’ve already bought. This is truly pathetic, especially considering their Android app kind of implements a locker service. From now on I’ll be using 7digital whenever I can – unfortunately their selection isn’t as big though. The quest for the perfect music services continues … :-/

Share

email nirvana

By , May 15, 2011 4:33 pm

Back in November 2010 I blogged about how I was chasing my dream of catching up on all personal mail, by automatically measuring my progress. Well, it worked – I finally made it!  For the first time in years, I finally have an empty inbox.  It turns out Google even hid a little Easter egg in gmail to reward people who reach this state of bliss:

This feels good.  Next up is to purge my massive TODO list of out of date entries and then re-evaluate what’s left …

Share

Panorama Theme by Themocracy