Monday, 26 September 2011

name that tune

book cover
I have great difficulty identifying tunes, even if I know them well. I have no way of asking for help, since all notes I sing are the same, and flat, even though I can hear the tune perfectly well inside my head.

So, many years ago I was excited to hear of a book that would help: it lists all tunes in order of whether their notes go up, down, or stay the same. I didn't know the author or title, but in 1990 I found copy --- it's "The Directory of Tunes" by Denys Parsons --- whilst browsing bookshelves. I excitedly bought it, thinking all my troubles were over (provided that the tune had been written before 1975, the book's publication date, of course).

How does it work? Well, consider a well known song, like "Do You Know the Way to San Jose".
music score

Write a star for the first note: "*". Then, since the next note goes down, write a D: "*D". The third note goes up, so that's a U: "*DU". Keep going: "*DUUUD", etc. Then look up the resulting string in the book:

Perfect! Problem solved.

Except for one tiny thing. I can hear the tune in my head. But I can't tell if the notes go up, down, or stay the same (unless they change a lot). So I can't construct the string! The book has sat, unused, on my shelf for the last 20 years...

Last week I was round at some friends, and talk moved to discussing the Web, as it does. One of them was saying how much easier it was now that so many things were available to be looked up. I mentioned an anecdote told by Bertrand Meyer in 1999, about using the web to identify an opera he was listening to, and said that would only help if you have lyrics (and it would help me only if they were in English, and if I didn't fall foul of a Mondegreen).

Shazam logo
The daughter of the house looked at me pityingly, and told me about Shazam. You point your phone in the direction of the music and "tag" it; the app records for about 10 seconds, sends it off, and the answer comes back. Perfect!

So, naturally, I downloaded the app then and there (well, after having a brisk discussion about whether it was Superman or Captain Marvel who said Shazam!), and we all spent the next few minutes playing random bits of music at it, and seeing what it could identify (despite the background noise of an excited budgie). At first I wondered if it was using a similar system to the book, but quickly realised it had to be quite different: you don't have to start at the beginning of the tune, and it not only tells you the song title, but also the artist -- and in the case of a piece of Mozart, the orchestra and conductor. So it must be matching against the actual recording. How does it work?

I found an article in the August 2006 issue of CACM which gives a brief explanation -- more technical detail can be found following the links from the wikipedia article. Essentially it looks for spectrogram peaks, takes adjacent pairs of these, does some hashing to increase the entropy, and matches the results against the music database. Many of these peaks are just noise, and so don't match. But enough do, with the added constraint that different pairs have to match at the right time intervals, to get a high quality matching system. So, a combination of a really clever algorithm and a massive database give a fantastic ability to match tunes.

But it's matching, not "recognition" as such. So it doesn't work with live music, including amateur singing (and I don't consider the noises I make to be singing as such). It's not quite the perfect system. But it's still mind-bogglingly amazingly useful.

Sunday, 25 September 2011

Me ears are alight

Last month I blogged on illusions, inspired by a Bad Astronomy blog entry on the "Flashed face distortion effect". In it I mentioned an aural illusion: the McGurk effect, where you perceive one of three different sounds, depending on whether you listen only, watch only, or do both.

Well, Bad Astronomy has a different example of the McGurk effect, from the BBC Horizon programme. This time, you perceive one of two different sounds, determined by the lip movements you observe whilst listening.

Interesting, of course, but what prompted my follow-up blog entry was a related comment, about mishearing song lyrics. This is accompanied to a link to O Fortuna from Carmina Burana, here transcribed as "oh, four tuna", and including lines like "some men like cheese", "Vimto can taste of kidneys", and more. Although one or two of the hypothesised lines are a little strained, the majority fit beautifully, giving a highly surreal reading.

This reminded me of a TV advert from the late 1980s (for Maxell batteries), on mishearing the lyrics to Desmond Dekker's The Israelites. Naturally, it's on You Tube.

Maxell Israelites advert

A misheard song lyric (or line of poetry, or whatever) is known as a Mondegreen. Before I ever knew the name given to this effect, I'd come across it in Maurice Dodd's Perishers cartoon strip: Baby Grumplin's teddy-bear is called "Gladly, the cross-eyed bear". There are lots of other examples I've heard from people over the years: "The ants are my friends", "Lucy in disguise", "Beelzebub has a devil for a sideboard", "Reverend Blue Jeans", and more.

Nowadays, the web makes it a lot easier to find the actual lyrics, of course. But if you don't know you've misheard it, there's no reason to look it up. (And let's face it, many lyrics are frankly unintelligible even if you know what the words are, so incomprehension is no real reason to suspect a mishearing.) Yet even after hearing a song a gazillion times, I can still sometimes suddenly hear it differently, and go, "Oh, so that's what that line is!" I doubt that my ears are more alight to the words: maybe it's because CDs are higher quality than cassette tapes and radios, even without the excuse of fading batteries?

Sunday, 18 September 2011

Saturday, 17 September 2011

full circle

On our recent Lake District holiday, I took a series of photos encompassing the Castlerigg stone circle. I wasn't intending to do anything with them; I was just testing out my new camera. However, after I got home, I wondered about trying to stitch them all together into a single panorama. A bit of googling later, I downloaded Hugin.

It took me a few goes to get things working -- mostly, I think, because I hadn't been thinking of taking a panorama originally, so had moved a bit between some of the shots. Still, after playing around with control points, and masking out the people, and removing the shots with the most parallax, I manage to get a panorama that includes nearly all the stones:

Castlerigg stone circle panorama

These are the actual photos that Hugin stitched together:

Castlerigg panorama sources

The panorama has a slightly wobbly horizon near the secondary circle, and there are some artefacts in the stitching. But given the poor quality of the original photos for this sort of thing, the result is amazingly good. And the ability to mask out certain areas (here, people) is really useful.

And all this with open source software that I downloaded of the web with the click of a button!

Thursday, 15 September 2011

serial commas

Well, Scalzi's blog Whatever is providing a rich source of grammatical fodder. One post gave me a great example of it's v its, then soon after we have a mention of the serial comma (the one that some put before the final "and" in a list).

We've all heard the famous example of how a serial comma can help disambiguate a sentence:
This book is dedicated to my parents, Ayn Rand and God.
Xopher's comment gives a a link to a great new example:
Among those interviewed were his two ex-wives, Kris Kristofferson and Robert Duvall.
Language Log also has something to say about this new example.

Despite the fact that the serial comma is standard American usage, and its omission is standard British usage, I tend to use it anyway, simply because it provides less chance of an ambiguous parse (even in less hilarious cases than those above). However, I do follow the British usage that punctuation goes outside the quotation marks when it is part of the quoting text and not part of the quoted text. It's only logical.

Wednesday, 14 September 2011

Perhaps it’s its forbidden nature

One of the many things that can get me riled is the use of "it's" when the writer means "its". C'mon, it's not difficult: "his" and "hers" don't have apostrophes, so why would "its"? And formal writing (where the mistake also often pops up) tends not to use contractions; it should either be "it is" or "its", never "it's".

Given my pedantrypassion on the subject, I immediately noticed the sentence
Perhaps it’s its forbidden nature that consumed me.
in a "Big Idea" blog post. What a gorgeous juxtaposition. Why have I never noticed such a construct before?


Sunday, 11 September 2011

Lake District holiday

We spent a couple of days in the lake District as part of our holiday this year-- neither of us had been before.
We had a great time -- marvellous scenery -- even some good weather! (View a larger map.)

We did the usual touristy things -- first off to see the Castlerigg stone circle, and try to spot how the stones are aligned on peaks and valleys:
brass map of stone ring part of stone ringpossible alignment of stones on valleys

We had a trip on a steam train, sitting in a carriage that is exactly like ones I remember from my childhood (except much cleaner!), and looking at the lovely views:
a very clean carriage the Repulsereflecting on the view

We did a lot of driving round, marvelling at the scenery of lakes and mountains. Some roads were a little alarming -- hairpin bends on steep inclines with little room to pass traffic in the opposite direction (fortunately there wasn't that much traffic) -- topping the brow of a hill and being unable to see anything but sky past the front of the car -- learning to sneer at "mere" 20% incline warning signs -- sitting at the top of a 30% incline, thinking, it looks vertical! But the scenery was worth it all.

We even made friends with some of the exotic local wildlife -- sparrows!! -- who were tame enough to eat crumbs from my hand. After I made the mistake of providing some food, lunchtime turned into a scene from Hitchcock ... suddenly sparrows, hundreds of them!
lake mountainscheeky sparrows

We were expecting scenery and stone circles -- it was why we went. But an unexpected highlight was the Cumberland Pencil Museum in Keswick. We saw this advertised in a tourist leaflet at our B&B, and so we just had to go. Now, I've never really given a lot of thought to pencils beyond the obvious "so how do they get the lead in there?", but, like just about everything really, there's more to them than meets the eye, as we learned at this fascinating museum.

The local pencil industry grew up around the local graphite outcrops (I learned that it was only relatively recently named "graphite", after the Greek for "drawing/writing", as in "grapheme" and "graphic"). The hardness is altered by adding clay -- more clay gives a harder "lead". Then the industry branched out into coloured pencils, watercolour pencils, and more. And there's lots more fascinating bits and pieces -- including wartime spy pencils, manufacturing tricks, and more. We would have stayed longer, but our car park ticket was expiring, so we had to leave after about an hour.
pencils through the ages putting the lead in a pencil

So, a good couple of days in the Lakes. I'm sure we'll be back.