| Subscribe via RSS

Transformational

March 11th, 2009 | No Comments | Posted in classical music, shostakovich, visualization, youtube

My laptop is scorching my lap. It’s pushing 70C on both cores. Like me, it gets hot and confused when forced to think too hard about math all in one go. Unlike me, it doesn’t scribble all over it’s work and swear at the obnoxiously curly integral symbols.

Why the laptop torture sesh? Well, I’m back on the wildly careening Fast! Fourier! Transform! bandwagon (the exclamation marks are for extra excitement). FFTs are a way to break down a raw chunk of sound (for example, an MP3) into all of its individual frequencies. So for example, if you had a recording of a pure C chord, running an FFT on it would show that it had C, E and G tones in it.

It looks a lot more interesting when there is more stuff going on than that…

YouTube Preview Image

…but than it is also harder to see what is happening.

I’m excited about this again because I came across this page, in which they have an algorithm that can calculate the spectrograms waaaay faster than my old crummy one. I haven’t had time to pick apart why that is yet, but it’ll for SURE result in some sexy animations. Otherwise I want all my money back.

Tags: , , ,

Score Processing, Part III

December 3rd, 2008 | 1 Comment | Posted in beethoven, classical music, visualization, youtube

Here is the latest product of my epic battle to nicely animate a score to music:

YouTube Preview Image

(widescreen here)

The motivation here was to get a program to work out when notes were being hit, just by looking at the volume. The idea is that when the volume suddenly increases, a note is being played. If I can work out exactly when all the notes are being hit in a recording, then I can map the analyzed score (that is, the raw notes from the sheet music) onto the timings, and make a neat animation.

The video shows a moving plot of the volume. Well sort of. It’s the absolute value (i.e., all negative values are made positive) of the amplitude of the waveform. You know how when you look at a speaker cone real close you can see it vibrating? The amplitude tells you how how far it is moving. If the amplitude is large, it is compressing a lot of air, which sounds loud. If the amplitude is very small, the speaker is barely moving, and we can hardly hear anything. This doesn’t exactly correspond to what we hear as volume, because there are lots of psychological effects which affect our perception (for example, hearing low and high pitches differently).

As you can see, it works pretty well when not much is happening, like during the first few minutes. It is interesting to see how the sound slowly drops off after each note is struck. When things get more hectic it gets way harder to separate the notes, since the sound level is continuously fairly high. Quieter notes get lost in the sustains from previous ones.

Imagine hitting a low C on the piano and then immediately hitting a high one, much more quietly. We could probably hear both because they have such different frequencies, despite the volumes. But if instead of hitting the high C you quietly hit the low one again, it would be really hard to hear. That’s pretty much what is happening here. We are not using any of the pitch information.

There is a way to do that, but it is much trickier to program.

Tags: , , ,

Score Processing, Part II

November 29th, 2008 | 2 Comments | Posted in classical music, visualization, youtube

No-one exists here. We are still within the midst (or midsts? Which is it? Well, given that it is from the 15th century I guess I can get away with either. That’s how they used to roll.) of thanksgiving. No-one is here. Except me. I think my supervisor would have murdered me if I left this weekend, given that I was skipping around NYC for most of last week.

I did have some time to play around a bit more with the score processing. Here’s my standard guinea-pig type piece, Beethoven Op. 111:

YouTube Preview Image

Do you love the glorious widescreen? Oh wait… the embedded player doesn’t work with widescreen yet. Well, if you (like me) are hot for 16:9 you can watch the full thing here. HOWEVER. It still won’t have any audio. Why not? It turns out that synchronizing the audio is actually the real crux of this score analysis malarkey.

You see, the notes in the video are a literal transcription of the score (extracted from MusicXML versions of MIDI files), but no-one ever plays a literal transcription of the score. The tempos vary all the time. So making the audio match the notes is a much more difficult problem than getting the notes themselves. I have about five different ideas for getting this to work, but all of them are several day long programming sessions.

Still, the video looks kind of pretty, right?

Tags: , , , ,

More Open-Source Music

November 19th, 2008 | 4 Comments | Posted in classical music, visualization

Hooray! Free sheet music for all!

I only just came across this site, even though all the drama of it reappearing happened half a year ago. I didn’t notice it back then because my visits into sheetmusicland only occur rarely. In fact I only go in search of scores for one of about, errr, two reasons:

  • I’ve decided to try and play the piano again.
  • I am obsessing about a particular passage in a piece of music, and want to know the key, or time-signature, or which instrument is making that funny noise (like that weird buzzing in Shostakovich 4)

Well hang onto your three-cornered hats, because today it was for another reason. The reason of animation. I had this totally awesome idea for animating a piece of classical music in which you’d have an orchestra layout:

And then the different sections would light up when they were playing. I thought it’d be interesting to get a visual feel for how the melodies are getting passed around, like you do with a live performance. Of course, in order to do this you need a copy of the score (or an insanely good ear and lots of time).

Instead of doing it manually — that is, looking at the score and by hand turning that into frames of animation — I want to automate it, at least a little bit. In the most basic version you don’t even need to try and work out which exact notes are being played. All you need to do is draw a line (or rather, a rectangular box) vertically across the clef and see how many black pixels there are inside. When a note is being played it will be darker than average. If you do this for the whole score you should have a pretty good indication of when notes are being played by each instrument.

Of course, things like this are always way easier to describe then to actually accomplish, but I’m gonna give it a shot when I get a bit of free time that isn;t spent playing on teh internets.

Tags: , ,

Music Information Retrieval in a Post Bedtime Environment

September 8th, 2008 | No Comments | Posted in classical music, visualization, youtube

Oh dear, instead of being asleep I/we/me are perusing this guys thesis (PDF warning). His PhD project centered on writing software that can automatically identify the identity of a singer by analyzing a recording of their performance. The really neat thing is that it works for recordings which have other instruments in them, so he had to come up with a way to determine whether certain sounds we’re voice-like or instrument-like.

This thesis reading came about due to me taking another poke at my previous attempts at music visualization (or more fancy-schmancily: MIR – Music Information Retrieval). Like so many research related items, although the general concept is fairly well-defined and straightforward the devil is definitely in the heapings of details.

There are all kinds of issues that rapidly start cropping up after the basics have been sort of sorted out.

For example, humans are pretty good at picking a melody. It’s hard to tell a computer to do that. As soon as you have more than one note being played at a time it’s a very non-trivial problem to work out which notes belong to the melody and which to the accompaniment. Particularly if you have, for example, a melody which switches from high to low notes, or passes between instruments, or has sharp changes in its dynamics.

In short, this means it is pretty easy to extract the melody from a monophonic performance of “Mary Had a Little Lamb”, but nearly impossible to extract it from anything else. At least automatically.

However, this brings up an interesting point. Can people even accurately identify which notes form the melody in a piece of music? Here’s a quote from the above thesis which alludes to what I’m getting at, which in this case is talking about automatically identifying musical instruments:

Martin [41] examines the classification of isolated samples from 37 instruments using
hand-picked features as inputs to a quadratic classifier … best-case accuracy is reported at 71.6%.

Martin [41] and Brown [51] also cite human performance for instrument identification tasks. Brown notes that human performance on isolated tones for her two-instrument identification task is comparable to her system’s performance. Martin finds that humans score much worse than his system (i.e., 50-67% versus 71.6%) on the instrument identification task and with comparable accuracy for instrument family identification.

Some MIR goals might not actually be possible. This is possibly true for 100% accurate two-instrument identification, but I bet it’s definitely true for melody extraction. In fact, the more I consider this problem the more I realize that it would be frickin’ impossible to say which of the notes in a piece from part of the melody.

It’s like when you try whistling a famous piece. Whistling should be a perfect example of melody recall, right? We whistle the melodies we have extracted from music, it’s our best attempt at melody identification. Well, anyway, when I try to do this the first part usually goes pretty well, you can sometimes make it all the way through the exposition without getting too confused. However, as soon as you hit the development section you’re basically screwed. You try to whistle three parts at once and it falls apart like a… a… buttercup.

At least, that’s what happens when I try. Now I’ll probably get smarmy eMails from music majors who can whistle every orchestral part of Beethoven’s Ninth all the way through. At once.

Tags: ,