Why Have You Stolen Our Earth

Today thousands of young people walked out their lessons to protest at political inaction over the climate change crisis engulfing us.

It is shameful to hear our politicians blame the students “bunking off” in order to raise awareness of those politicians own failure to act. Anyhow as part of the discussion someone asked us what the tune was for a song called Why Have You Stolen Our Earth because the lyrics seem particular appropriate given today’s news.

Update: This is a song that I’ve only ever heard it passed around at campfires and I wasn’t really sure where it came from. Having posted this I’ve discovered that to listen to the original track then you should track down an album called The Wild Side of Town by the Albion Band with Chris Baines.


Getting started with GStreamer 1.0 and Python 3.x

Way back in the mists of time (or a little over nine years ago if you prefer). Jono Bacon wrote a very detailed blog post describing how to use GStreamer with Python.

Getting started with GStreamer with Python

Mr. Bacon went into a lot of detail, so much so that now, almost ten years later it is still widely credited in other blog posts and remains highly ranked by search engines.

However both Python and GStreamer have moved on a bit over the last decade. The bindings too have moved on a lot as they now use the almost unspeakably awesome PyGObject to automatically generate most of the bindings by introspection.

In short, Jono’s code doesn’t work any more. However it doesn’t take much work to massage the first example until it does.

#!/usr/bin/env python3

import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstBase', '1.0')
gi.require_version('Gtk', '3.0')
from gi.repository import GObject, Gst, GstBase, Gtk, GObject

class Main:
 def __init__(self):

 self.pipeline = Gst.Pipeline("mypipeline")

 self.audiotestsrc = Gst.ElementFactory.make("audiotestsrc", "audio")

 self.sink = Gst.ElementFactory.make("autoaudiosink", "sink")




Roughly speaking “all” we have had to do to update this example:

  1. Update the imports to gather everything we need from the gi module.
  2. Add: Gst.init(None) (this should probably be Gst.init(sys.argv) but that’s not how the original code behaves so it’s not in this port either)
  3. Replace the lowercase g with an uppercase G in both Gst and Gtk.
  4. Tweak the Gst.ElementFactory and Gst.State calls; these were in a flatter namespace in the older PyGst bindings.
  5. Replace alsasink with autoaudiosink. Strictly speaking this is not required; alsasink will still work just fine. However autoaudiosink can adopt pulseaudio when available. Something else that has changed since this code was originally written.

… and that’s it. Not much to it really. Hopefully its enough to set you on your way if you want to grab ideas from old tutorials and blog posts into your own shiny new GStreamer application.

Happy hacking!


Fifteen minutes using a Boss Micro BR

The fifteen minute figure is a slight poetic license. I did record this track during my first fifteen minutes playing about with the recorder. However after that it took me nearly twenty minutes to figure out how to master it into a format I can share with the world!

Recording is an Epiphone Dot plugged directly into a Boss Micro BR using the P01 “SuperCln” preset. The preset has been changed from the factory setting only by turning off the chorus.

To be honest the chorus effect sounds pretty terrific but, with such a naked guitar part it makes it sound like I have something to hide.



Measuring a ’12 Nexus 7’s microphone to speaker latency

The recent release of patchfield for Android made me wonder whether Android’s audio system has developed sufficiently over the last three years to be suitable for real time signal processing. There have been a couple of developers at google working hard to reduce the output latency but their work does not yet encompass input latency.

However since patchfield allows the speaker to be digitally connected to the microphone it is easy to use patchfield itself to measure input to output latency of an Android system.

The following picture shows the test set up I used to measure it.


On the left is my 2012 Nexus 7. This is connected to the earphones sitting in top of the (red) sound card. Using earphones prevents feedback between the mic and speaker. Finally a microphone rests on top of the earphones. Critically the microphone picks up both the environment and the output of the earphones.

If you are particularly eagle eyed you might have notices a few missing cables in the above picture. Specifically the earphones are not actually plugged into the Nexus and the microphone is not plugged into the soundcard! I haven”t faked the photo however I only decided to blog about it after I had starting taking things apart again. In may haste to get a picture of it I forgot to plug it all back together.

Latency is measured simply by knocking in the table surface. This creates a short burst of noise that is captured both by the microphone in the picture and by the Nexus’ internal microphone. Patchfield captures the sound and replays it to the earphone which the microphone also picks up. The latency can then by calculated by looking at the waveform of the signals picked up by the microphone.

And the results are… 132ms from input to output. Just to put this number into perspective a piano, which is one of the highest latency musical instruments, takes about 25ms from the start of a keypress to the hammer striking a string. Another way to express it is that it is way too much for any musical application. The brain doesn’t just hear it as an echo… it hears it as a LOOONNNGG echo!

I repeated the same test on my Nexus 4 and that was better but not by enough to make much difference. That “only” took 124ms.

I guess there remains lots of very good reasons by iRig is not available for Android. There is one remaining ray of hope: the latest Samsung Mobile SDK includes a professional audio API based on jack and dedicated to handling low latency. It looks like Samsung really do want to take the fight to apple.


The Encore project – Introduction

Recently I allowed myself to be given a very old beat up Encore strat copy. The idea is to have something that is provably worthless to mess about with as a confidence building re-finish project.


Somebody has attempted to refinish this guitar before and failed in quite an extreme manner. The body, originally black, is still just as black but has a weird tar like coating on top of the slightly cracked original poly finish. It must have looked better before they started work, simple because I haven’t found much underneath that I wouldn’t have been happy to address with nail varnish and T-cut. In the picture below that big rectangular patch on the side is some of that charming tar. From the shape I can only assume the new paint reacted badly with the glue of some stickers.


The scratch plate is almost worse. It looks like it is coated in tipex…


This last pictures is a close up of the controls that shows the edge of the scratch plate nicely. Its actually a three ply scratch plate but you can hardly see the black middle ply in places.


Oddly the neck is actually in a pretty good state. Not only that but I was actually pretty stunned by its build quality (let’s just say I was not expected great things from this guitar). The wood of the fretboard is a bit cheap (and not stained enough) but the main wood of the neck is sufficiently pretty and the frets are really quite well finished. Its a fairly nice profile too so when I can get over my prejudices it doesn’t feel that bad to play.

The body? Not so much, they’ve put the money where is shows and put the MDF were it doesn’t! I had at least hoped for plywood (like my old Epiphone SG) so I could play about with transparent finishes. Not to be, so it goes…

Anyhow, ideas for how to refinish would be cool. I’ve more or less given up on the idea of a trans finish. I did briefly toy with doing an “industrial” finish of incompletely sanded back black poly next to very dark stained MDF under a tinted transparent finish. I might learn something doing that but I suspect what I would learn is not to put half sanded MDF under a transparent finish…


The Egmond Project – Update #2

The next part of the project turned out to be getting everything lined up. After rebuilding the guitar I left it at pitch for a week or two to see if anything moved… it didn’t. Since the last post I have also moved the bridge over a bit to improved the line up of the strings. Unfortunately with the bridge in the right place the bass string started popping out if anyone breathed too loudly so I took the bridge out to cut a much deeper saddle slot for the bass strings.

Note: This post is part of a series: [Update #1] -> [Original post]

Even with these changes it still lacked quite a bit in the playability department. After several hours trying to shave the bridge I concluded that the neck joint really did need the neck to lay back a bit more. The Egmond’s neck joint it rather different from the Fender-style neck joint you might see on electric guitars. Instead of the four big screws it relies on a single bolt to counter the tension of the strings.

The Egmond cantilever neck joint
The Egmond cantilever neck joint

Basically the neck pivots on the plywood at the top of the neck joint, whilst the single bolt goes through the heel of the neck, through the spring and into the body. Adding some shims to the pivot point allows the neck angle to be increases slightly, dropping the strings down a bit and making the guitar more playable.

Neck joint with shims inserted
Neck joint with shims inserted

The shims were made by setting a plane to a fairly brutal setting and running it up and down a piece of beech. Sadly they were not quite thick enough, even when doubled up. The folks over at The Guitar Grounds were very helpful. After they described how the 70s era Fender’s were generally shimmed using whatever was at hand (often business cards). I figured if business cards were good enough to US made Fenders then I could get away with four layers of wooden shims. Actually I have three shims on one side and four on the other so correct the angle slightly.

It’s done the job. The neck is now laid back enough that the little metal wheels on the bridge can adjust the action properly. I’ve been forced to set the action a little higher than I would like because the frets could really do with the attention of a crowning file (which I don’t have). Nevertheless it makes the world of different to its playability.

Electrification will come soon!


tintdrum – tintamp’s junior stablemate

For some time now I’ve been playing with constructing my own digital modeller.

By and large I’ve deliberately kept the scope of the project to be a make a practice tool (rather than a studio effect) in order to try an keep things achievable. The ultimate aim is to make a device that you use like an amPlug (or iRig for iPhone) to practice with. More exactly it is a battery operated “thing” that allows you practice without any wires except those joining the guitar to your ears.

I’m working in phases of very limited scope so that I can lose interest in the project whilst still having achieved something and there’s still a long way to go before I can call it a modeller. Nevertheless since Christmas I’ve been able to move from playing with software in the PC to playing with something real.

STM32F4-Discovery running an early version of tintdrum
The above is my recently acquired STM32F4-Discovery board running tintdrum, a fixed function groove machine designed to use like a metronome but with a stronger groove. The idea is that this type of drum machine is a vital component of a digital practice tool so tintamp will definitely have to have one when its finished. However it is actually useful enough to be a separate thing in its own right. Something I can put in a box and call “done”

The board above is running my own drum machine software. You can tell can’t you? Until last week all it was able to do was plug in and it started playing drums via the headphone socket at the bottom… it played a really basic 4/4, kick, snare, kick, snare beat (plus hi-hat)… at exactly 100 beats per minutes… and that’s it.

This week however I’ve been able to extend it to flash an LED on the beat (a vital feature in a practice tool) and also been able to rig up a tap tempo button. This means its starting to feel real. That said I still need to implement controls to change the groove and volume. I’d also like to extend the drum machine code to include humanization to stop is sounding quite so start.

Nevertheless the journey from PC to real hardware has begun. Bon voyage.


The Egmond Project – Update #1

The restoration/reassembly of this lovely old guitar is coming along nicely. I spent a good half hour the other day working methodically though the box of screws, pickups, electrics and hardware until I was sure I know what each screw was for. It turned out to be quite complex jigsaw, made a lot easier when I realized that the screws for the machine heads didn’t actually match (which is why I couldn’t find 16 identical little screws).

I also spent a fair bit of time with the bridge. As you can see on the photo below I needed to sand it down a bit to match the curvature of the guitar.

With the bridge feet set up to avoid damaging the top of the guitar I had all the bits ready to string it up and see what other adjustments might be needed. When I first strung it up I realized I would have to cut slots into the saddle to get the string spacing right (not quite sure how I overlooked that). So finally yesterday I was able to bring the guitar into a playable condition.

First impressions are pretty good. Its fun to play and sounds much more like a double bass than my electric basses. I understand the tapewound strings contribute to this.

At this stage I’m not quite ready to start the rewiring as there remain a few drawbacks. Some of this is just finishing what I started. The truss rode needs a little more tuning now the strings are at tension and I need to shave several mil of the bridge. I need to shave of a little more from the feet, a little from the saddle and then take the rest from the middle section.

The other issue is that the strings don’t quite run parallel to the fretboard.

Most of what you see in the picture above is actually caused by the bridge being incorrectly sited. However there is some play in the neck joint meaning I can pull the neck and bring the strings completely straight. The neck joint has odd single bolt plus one light duty woodscrew construction which I’ve not seen before and I haven’t yet decided whether or not to try and wedge it. I’m going to leave that decision until the bridge is at the right height.

Nevertheless I pleased with the progress so far. It’s bags of fun to play acoustically… looking forward to starting on the electrics.


The Egmond Project – Introduction

After my uncle’s sad, and rather too early, passing away I recently inherited a guitar project. Basically the guitar said something to me from the first photo I saw of it, perhaps because semi-acoustic basses really aren’t very common. It went from a passing whim to a potential project when my dad unearthed a cigar box full of all the guitar hardware that changed the body and neck from being firewood into being a viable project.

So now there is something potentially wonderful in my garage. It just needs a little time spent on it. Everything I’ve got is shown in the picture below, both main bits of guitar together with a cigar case containing all the missing hardware, right down to the strings.

Looking more closely at the box of bits is interesting.

In there are all the bits and bobs that need to be screwed, nailed, wedged and soldered together to bring the guitar back to life: pickups (one of which needs repairing), tail piece, machine heads, circuit components, switches. So far I’ve not thought of anything missing.

I have spent some time trying to work out why the guitar was taken to pieces. Was there something wrong with it? Certainly the bridge overs some clue that I might end up having to do something about the neck.

Those massive grooves really shouldn’t be there. It’s like they were cut to account for a neck that was practically falling off. However I’ve looked very carefully at the joint and I don’t see the problem. When properly tightened it sits at what looks like the right angle and doesn’t want to move much.  I guess I won’t find out until I buy a new bridge and try and bring the strings to tension.

For now I have concluded the guitar was in so many bits because my uncle was planning to refinish it. When someone takes so much of the hardware off it can only really be to get down to the wood! For me that’s terrific news, because it suggests it was playable and will fit back together again!

So there it is… a project. I’m looking forward to it.


A guitar preamp using biquads and a waveshaper

Let’s start this with a confession. This post is nothing more than a summary of an idea I picked up from an eight year old paper. I didn’t even go to the trouble of finding the paper myself but instead found it cited in the source code to guitarix. For that reason this should be quite a short post.

Firstly remember that at the moment tintamp is not really a modeller. It will be, but its not there yet. For now its just a fixed function digital signal processing chain that is “good enough” to allow each stage in the chain to be prototyped and developed further. On the plus side being fixed function makes things very easy to describe.

So the first revision attempt at a tintamp preamp consists of three similarly configured amplification stages based on an approximation of a class A 12AX7 amplifier. The heart of the tube stage is a waveshaper based upon the transfer function of a 12AX7. This is surrounded by three biquad filters that model the effects of the capcitors in the circuit being modelled.

All told it looks something like this (click to enlarge):

Please forgive the poor layout above. I rushing to press “Publish” just a little and I’m not very expert at graphviz just yet. Additionally if you want to see the ideas expressed more lucidly the Virtual Air Guitar folks have already done a very good job, take a look at their paper!