Crazy idea: Hold music cadence machine

I’ve just been on a call with a client. They have Strauss or somesuch a hold music. Orchestral waltzes. The person on the other end picked up exactly at the end of a phrase. It was perfect.

My idea:

On-hold music programmed with meta-information that stores the exact timecodes of cadences and the end of phrases. When the person who is being waited on picks up the phone, the system keeps playing the music until the next point.

This would only result in a second or two extra hold time, but would result in the person appearing to pick up at the ‘perfect’ time, every time!

Posted in Crazy Ideas, Work | 3 Comments

Agency, empathy and the 0736 service to Manchester Piccadilly

I am sorry to announce that the 0736 service to Manchester Piccadilly is delayed by approximately 40 minutes due to engineering works. I am extremely sorry for the severe disruption to the service.

Luckily I wasn’t trying to get to Manchester Piccadilly, but from the reaction on the platform someone was. This well-spoken automatic pre-recorded announcement was clear, and told us everything we immediately needed to know. It was spoken courteously in perfect Recieved Pronunciation. It is the same voice that is used to announce all the official goings-on at Platform 2 of Oxford Station, and at stations across the country. I quite enjoy hearing the voice if I’m honest.

But when there is a 40 minute delay, it doesn’t quite seem right. I’ve been on the receiving end of delayed train notices, and I’ve borne the automatic announcement a grudge. I feel that it should be a human on the end of the PA system making a personal apology to all those involved. The people who conceived the system went some way toward trying to emulate this. Words like ‘extremely sorry’, human-like repetition and even a slight plaintive tone to the voice all add to the effect, in theory. But ultimately, the speaker was not addressing directly to this group of people, she was speaking of some imagined late service that may or may not have been going to occur in the future.

I think to myself “I don’t want a pre-recorded voice, I want a human!”. The question is agency: the right and ability of the announcer to actually account for what they are saying. Not only in terms of being in control of the situation, but also to feel the gravity in what they are saying and sympathise with the audience.

But if I did get my way, what kind of human would I get? Probably a harassed station staffer who is desperately trying to deal with suddenly-upset passengers. His apology would be mumbled and stressed, possibly not immediately understandable. The mellifluous tones of announcer lady would be replaced by scruff regional Oxford man suddenly dropped in it by engineers in another part of the country. He would be in no better situation to do anything about the situation in any case. The only difference would be that we knew that someone real knew and was being hassled about it. A severed head on a plate but not very constructive.

The wish to have a human making the announcement is, of course, nonsense. It is far better to have the pre-recorded message, voiced in clear and relaxed tones. It gets the job done, does not escalate emotions any higher than they need to be and, ultimately is no better or worse placed to pass on information provided via an automatic system by some engineers up north somewhere.

But it’s something to think about on the 0804.

Posted in Uncategorized | 1 Comment

Tracks that use Gradual onset of Distortion to Great Effect

I love Spotify. I refuse to participate in the ‘social networking’ aspect of things. Indeed I find the idea of assuming I want everyone knowing what I listen to, and the assumption that I want to see what other people are listening to mildly offensive. That’s ok, I don’t mind being offended.

That said, here is a list of songs (not a playlist) which use the gradual onset of distortion to great effect. Distortion has been used since the dawn of time to make guitars fuzzier, vocals warmer, snares more brutal.

These tracks don’t just stick some fuzz on an instrument. I’ve chosen tracks that use the gradual saturation of an amplifier to slowly overdrive and distort, and change the character of the sound. This has the effect of introducing a part with a given timbre and then gradually changing the timbre of the sound bit by bit. The result is an extra side to the musical journey throughout the track.

Lithuania by Jaga Jazzist

The rhodes piano, which has provided a rhythmical bed throughout the piece (and a clever trick at the start) slowly distorts in the last 30 seconds of the track to something truly grimy. This transforms it from ‘mainstay’ of the track into something a bit more rebellious. Jaga Jazzist are my favourite contemporary group, I think.

Impossible – Shuttle remix

The main part in this track is rhythmical almost-tuned shouting. The voices initially have a well-defined punch with very slight distortion but quickly descend into a very squelchy sound. There’s also some other kind of degradation, possibly reduction of bit-depth. The effect is a spreading, straining and then dissipating into something more nebulous. Glorious.

La Nocturne

A number of parts become increasingly distorted. This is more of a subtle timbre-change than the others.

Boom Bip – The Birdcatcher’s Return

The drums become increasingly grimy and distorted towards the end. More of a ‘fuzz sound’, but a nice end to the track.

Sorry if you don’t have Spotify.

Posted in Music | Leave a comment

WordPress on Apache being Reverse Proxied by Nginx in an Endless Loop

I have a couple of WordPress installations running on Apache (on a non-80) port, and I’m reverse proxying them through nginx. Somewhere along the line WordPress is getting its knickers in a twist about the port not being the same as it expects. This results in WordPress going into an infinite redirect loop.

To solve this, I put this in the nginx virtual server config:

proxy_set_header Host $host;

Fixed.

Posted in Computers | Leave a comment

A snowy journey to work

I’m not normally given to taking photos of my commute, but in the case of the snow I made an exception.

Posted in Arts, Boat, Life, Work | Leave a comment

In Which we Discover Some Rules About Python Scoping (which we already knew)

I’ve just been bitten by scoping in Python. If you gave me this code and asked me what it did, I’d probably guess that it was a trick question and look carefully at it. What would you say?

def demo():
  number = 100
  one = number / 100

  numbers = [one, one+1, one+2]
  big_numbers = [number * 100 for number in numbers]
  bigger_numbers = [big_number * 100 for big_number in big_numbers]
  print number

 

It’s not obvious. You’d be forgiven for saying 100. Forgiven by me, unfortunately not forgiven by the Python interpreter. When you’re reading and writing code day to day you’re not always on the look-out for trick questions. The Python interpreter specialises in looking out for trick questions (aka correct behaviour), and would give you the correct  answer of 3.

The mistake I made was to re-use a variable name in a list comprehension.

The problem here is that there is no extra scoping in the list comprehension. The variable number isn’t bound in some kind of magical special scope for the list comprehension. So the binding of number in the list comprehension is the same as number in the function closure scope. The value of number in the function closure is the last value it was assigned, in the last iteration of the loop. In many languages (Java, C#, C, Haskell, Scala) this wouldn’t happen and the function would print the number 100. This is a symptom of Python taking functional features (list comprehensions in this case) from purer languages without the attendant purity.

This closure scoping is something about Python that I really don’t like. And JavaScript for that matter. (At least in JavaScript functions are cheap and plentiful supply, and can be used as callbacks to an iteration, as in underscore.js‘s _.each.) A little lexical scoping wouldn’t kill anyone.

I’ve been writing Python for years and this still bit me. Look out, you may be the next victim.

Posted in Computers, Work | Leave a comment

Old entries from simpler times: Busking

Whilst going over (and deleting) unwanted content on Facebook, I came across a few bits and pieces. I miss busking.

Found this old post from 4th August 2007.

Day five of ‘my’ Fringe, and the thought police are out in force. It feels like day two to me, but a lot has happened (including a technical rehearsal that finished at midnight, a street urchin and a stand-up routine about health and safety). The Fringe is getting started proper and potential audiences wonder round the city being picked off by hungry flyer-ers.

Thus far, things have been quite slow and civilised. The Fringe has definitely been Brewing, but to-day the Royal Mile has blossomed into the Fringe that I know and love. Lucky for those crowds of innocents, they have Fringe Staff to protect them from vagrants and unlicensed performers. Such as myself.

For a few days now I’ve positioned myself on the Mile, sometimes sitting on a bollard, sometimes standing, sometimes leaning against a wall at a jaunty angle. It’s a great way to pass the time; one can’t be seeing or working in a production all the time, there’s only so much flyering to be done, and a finite amount of money and time that can be spent in pubs or cafes with friends. So every day I leave with my melodeon (look it up), take the 23 into town and pass the time playing music.

I don’t seem to have made any enemies – my adoring public have so far stood me about fifteen quid a day (which, considering I only spend an hour or two tops and it’s for fun anyway, isnae’ ba’). I am not, as it were, a public nuisance. I do have one character, a man playing a guitar rather feebly and ‘singing’ who eyes me across the street with mistrust and not a little hostility (and considering I’m playing jolly traditional music and he’s playing bleary nonsense isn’t such a surprise). But he’s my only ill-wisher.

Then there’s Lee, a real street urchin. He can’t be more than ten or eleven, he’s always to be found sitting on the steps of some Building or other (the same building, I just don’t know which one). He has an accordion, and can play two tunes, the first of which is ‘Amazing Grace’ and second uses five consecutive notes. Repeatedly. He seems to enjoy himself. Many are the hours (well, time enough) I’ve sat and chatted with him about this and that. He came up to me as I was packing up once and said ‘eh, you were playin’ that accordion wan’t yeh. I got one, come with me’. And that was that. There’s a whole community of street performers (including a man who I don’t think ever takes off the silver paint that covers every visible part of his body).

And then in wade the Fringe Officials with their jackboots, following orders. I have great sympathy with them, but I don’t agree with their manifesto (which includes coming up to me, asking if I have a permit and telling me to move on). The man in the Fringe office blithely tells me that I’m only breaking the law if I don’t move on when asked to, and that is that. So I am banished to the Fringes of the Royal Mile, out of sight and out of mind of the Fringe Officials. I did test the water by busking just inside the permimeter but I was asked to move. And I wasn’t about to break the law. A busker’s pass is out of the question as long as I’m involved in some other Fringe Activity. Which I am.

The Swingers (for it is this) is in the Baby Belly on Cowgate in ‘The Caves’. It’s an incredible venue (literally, you wouldn’t believe it). It’s housed in one of the many hollows under bridges that are to be found in Edinburgh. It’s cold, dark, with high stone walls and valuted ceilings. Water drips from the walls and a deathly cold shrouds everything. But the play’s good fun and the audience enjoy it.

And that’s what counts. I haven’t told you about Uncle Edwyn’s amazing hedge or the Tale of the Baggage. Or the health-and-safety themed standup (he was very good by the way). But that’s for another day and other note. With pictures.

I’m including a photo of Uncle Edwyn’s hedge for your amusement.

 

And from the 4th April 2008

Today the following things happened:

• I woke and it was sunny

• I handed in 24,000 words of dissertation

• A woman stopped me in the street and asked me the name of a flower (it was a bluebell)

• I went into town with an instrument and bumped into a friend and we started playing music in the street

• I made £15 busking

• An American girl came up to me whilst I was playing and gave me a bottle of wine

• A South African girl came up to me and played me some SA folk music from her iPod

• I bought a tube of smarties

Posted in Arts, Life, Mucking around, Music, Old Things | Leave a comment

A white birthday…

Posted in Life | Leave a comment

A polecat comes to visit.

I put my rubbish out on the deck last night. Today I heard a rustling and looked out to see a polecat had come aboard, unbidden, and nicked some pasty packaging.

For those unsure what a polecat is, wikipedia defines it thus:

A polecat is an animal.

Here is a video of the encounter. I can see why they named this animal ‘polecat’. It’s a bit like a pole and a bit like a cat.

A polecat comes to visit on Vimeo.

 

 

Posted in Boat, Life, Mucking around | Leave a comment

From La Mantovana to the Moldau. Musical similarity in the absence of rhythm and what it means to FolkTuneFinder

Má Vlast is a set of pieces written by the composer Smetana in the late 1800s about his homeland, Czechoslovakia. One of the pieces in the set, The Moldau (Vltava in Czech) is one of my favourite symphonies of all time ever. It could be something in my partially Czech blood, it could be the fact that I’m soppy about Romantic-period orchestral music, whatever it is, I love this piece of music and know it intimately.

The theme from it is very well known, and deeply expressive. It goes something like this:

(I’ve transposed it into G for the sake or argument)

In theory it’s quite straightforward: after a dominant up-beat, it starts on the tonic and goes up a minor scale to the dominant, hangs around at the top and then heads back down again at half speed. It employs a simple swung rhythm. As themes go, it’s not massively complex in terms of melody or rhythm. And yet is is arguable that much of this very powerful piece of music is based upon it.

The theme is repeated in different transpositions, in different modes, with variations. The subject of the piece is a river and, to my mind, the movement of the melody, and the variations of it mirror the flow of the river.

~

I have a habit of looking things up when I don’t know enough about them as I would like, and it was whilst looking for a nice performance of it on Spotify that I decided to look the piece up on Wikipedia.

The article claims that the theme is an adaptation of an old mediaeval melody, called La Mantovana. “Oh aye,” thought I, “that’s a shame.”. I followed the link through, and was surprised to see a tune that I know by the name of The Italian Rant, which has come to me via a tune collector you may have heard of, Mr Playford.

I know this tune well. I have played it at sessions. In my head there was absolutely zero connection between the theme from the Moldau and the Mantovana.

Here is a simplification of the section from the piece in question:

Seeing it written down, it clicked. Of course, the melodies are identical. I have known these two pieces well for years, but it took seeing them written down, and it being pointed out to me, to recognise the similarity.

~

Here’s an MP3 of the me playing Moldau and La Mantovana for comparison.

~

Still, I think it a bit unfair to say, as it does in the Wikipedia article, that the tune is virtually based on La Mantovana. It would be musically criminal to suggest that just because two melodies can be written down and the pitches look similar, that they are the same, or copied. It’s all about feeling, how the music is written, how the rhythm places stress on which pitches, what relationship those pitches have to the tonic, what harmony is used. Phrasing is everything.

If we line up the two scores, we see they are essentially identical:

But if you’ll permit me a brief excursion into a graphical score, to indicate the phrasing and stress, as I have heard them performed:

These are quite, quite different.

~

So, it is an unforgivable mistake to cast away phrasing and rhythm (not to mention harmony) in the artistic analysis of music.

And yet I can name two parties who are guilty of this besides the author of the wikipedia article.

The first is the United States copyright law, which considers two melodies the same for the purposes of copyright if they have the same sequence of pitches. Legal cases have been fought and won on this basis, and the law holds even when the two tunes are perceptibly ‘not the same’. The argument here is, I suppose, whether one artist has stolen the substantial portion of a creative work and used it themselves. I can see the argument myself, as it pertains to legal wrangling rather than criticism and analysis of art. A full colour photograph is artistically very different to a monochrome version, but you can see the similarity if you look. No-one is saying that they are identical pieces of art, but the argument for them being broadly ‘the same’ can be made.

The second party is yours truly. When I started researching FolkTuneFinder, I did a lot of background reading on the topic of music storage and retrieval and drew my own conclusions. FolkTuneFinder treats two melodies with the same pitches but different rhythms in the same way. The only reason that FolkTuneFinder is storing melodies in its index is for the purpose of allowing people to search for and find tunes, so the aim is not to store the tunes in a precise musicological fashion, but to store them in a way that is most likely to allow them to be found with a melody search. The melody index itself isn’t something that people can browse, it is a data structure in a computer that enables search.

~

Whenever you take some data and transform it in a way that loses information, you have to consider the likelihood of collisions, that is to say, if two different pieces of information were transformed, what is the chance that the transformed values would be the same. One example would be the transformation “make some text lower case”. If I gave it the word “Sandwich” and the word “sandwich”, they would both come out “sandwich”. This is no bad thing if that’s what you actually want to happen.

FolkTuneFinder has always used some kind of fuzzy matching, which means that almost-correct matches work: if you get a note wrong you should still find the tune you’re after, and the most similar matches get a better score. Early versions of FolkTuneFinder based this score on the length of notes. It took the position that if a note is short it is less important, and if it is long, it is more important. If you made a ‘mistake’ on a shorter note, therefore, it would be more more forgiving. Casual research over the years showed that this didn’t actually make much difference, and complicated things somewhat, so that feature was eventually removed. It really comes down to which melodies exist in the index. If there are very few clashes in the actual tune data, then the likelihood of collisions is low.

So, if FolkTuneFinder throws away rhythmical data, and the rhythm and phrasing is so crucial to the melody, isn’t that a Bad Thing?

Well no, not unless it leads to poor quality results. The only way that poor quality results could happen is if the user was thinking of a sequence of notes which makes up a tune, and they’re in a given rhythmical formation, but a ‘false match’ is found where the same notes occur in a different formation. To quantify this, we need a process which effectively takes the melody for each tune and searches the index for it to see if it matches any other similar tunes. This gives the specificity of the search term, that is to say, given a search input, how specific is it when it comes to identifying tunes: how far can it narrow them down?

If a given search term, clearly excerpted from a known tune, returns lots of tunes for which it is a reasonable match, but which the person doing the search does not want, that means the input has low specificity, it has a large number of collisions, and the search results are probably low quality.

The flip side of this is that there are lots of tunes in the index (around 200,000) and many near-duplicates. The search is ultimately a function of similarity: “given this input phrase, find tunes that are similar to it”. If a search for a tune turns up lots of very highly similar tunes (i.e. very slightly differing transcriptions, possibly of the same tune), having a low specificity for that search term is a good thing, not a bad thing.

(Of course, the above paragraph is totally spurious. Search engines manage to cluster results just fine. If I was paid to write FolkTuneFinder (or did it as an academic) and had expensive computing power and spare time to burn this could be achieved.)

~

I get emails from people regarding FolkTuneFinder, probably at least one every week or two over the last 3ish years, a small number of them saying ‘my search didn’t work’. Whenever this happened, I condensed the above into a sentence or two by way of reply. I also explained exactly how their search results came about. In only one or two cases over the years I have been unable to explain the results.

In the new version, I have done this automatically, adding result highlighting to explain how a search result was arrived at.

Here is an example in which I search for ‘Foxhunter’s Jig’.

After three pages of correct results such as this:

I come across a partial match (i.e. some but not all of the input was matched). If it isn’t my old friend ‘Merrily Kiss the Quaker’s Wife’. But what’s this? That tune has absolutely nothing to do with what I typed!

Well actually, if you look at the highlighted notes, it really does. Not a perfect match, but some of the notes are there. Furthermore, they’re in … the wrong rhythm! Note that this was on page 3, after at least 20 correct results.

~

This is the kind of confusion that can ruin search results, and if it does ruin them, that’s a problem. But in the last three weeks since I launched FolkTuneFinder version 4, I have received a lot of mail but not a single one about crazy incorrect matches. I think if people do have unexpected matches, if they get a satisfactory explanation from the result highlights and think “Oh, I was wrong”, they carry on and find the tune they were really looking for.

Of course, I have also re-written the search agorithm. It could just be that the quality of the search results has increased anyway…

 ~

So the conclusions I draw are that

  1. Rhythm and phrasing matter a huge amount on a personal artistic level, and it’s not enough for the pitches to be the same. Tunes only sound the same if they are broadly similar in rhythm as well as pitch.
  2. The US Patent Office fly in the face of this. But perhaps that’s OK.
  3. FolkTuneFinder flies in the face of this, but so long as that doesn’t cause any problems, that’s OK too.

I welcome your feedback!

 

Posted in Arts, Computers, FolkTuneFinder, Music | 1 Comment