Alfred Brendel, Maurizio Pollini: Part 1

April 17, 2010

For a while now I’ve been eager to get a good recording of Moonlight Sonata, since the one I’ve had thus far is entirely unsatisfactory. So today I searched for recordings of Sonata 14 on iTunes, and I found two albums whose reviews and ratings warranted a purchase – an album by the Austrian pianist Alfred Brendel, and another by the Italian pianist Maurizio Pollini. Brendel’s album consists of Piano Sonatas 14 (“Moonlight”), 8 (“Pathetique”), 23, and 26; Mollini’s of 13, 14, and 15.

I downloaded Pollini’s album first. It was good, satisfying, and impressive, but he played it a little too fast for my ears. I like to “dwell” in the piece – slow down the tempo. So next I downloaded Brendel’s album. I believe he plays it slower, or slows it down more at key parts, and I found it much more stirring. But what I wasn’t expecting was to be completely blown away by another piece – Brendel’s performance of Piano Sonata no. 8, popularly called “Pathetique”. I would be asleep right now if I weren’t so addicted to this piece – I decided to go to sleep when Sonata 8 came on, and then I couldn’t stop listening, so I figured I would write this blog post while the first movement played.

But the first movement is now over, and the second isn’t quite as gripping, nor is the start of the third – so I am free to go. When I am less tired (it is 1 am and I am exhausted) I would like to write my reaction to Brendel’s performances of no. 8 and 14. The experience of listening to no. 8 is something like a uniform bliss; however, I am ashamed to say (as I think it probably reflects on my own scant knowledge of classical music) that I find Moonlight Sonata to be a little redundant in the third movement… it’s almost as if the score is being replayed several times. I will ask my guru pianist roommate what he thinks of my perceived “redundancy” and write that into my follow-up post.

Until part 2, au revoir, imaginary audience!

Emily Dickinson, William Carlos Williams

April 2, 2010

I’ve been reading some anthologies of poetry lately and I thought I would reproduce the poems that really struck me. My experience of reading an anthology of a certain poet is that four out of five of the poems “miss” but that lucky number 5 really floors you. This is especially true for Thomas Johnson’s Final Harvest, a five hundred-odd selection of Emily Dickinson’s poems. The best way to read it seems to be to jump to the poems mentioned in the introduction- but even then, a lot of poems fail to make an impression. However, by doing so I came across this poem:

The soul that hath a Guest
Doth seldom go abroad –
Diviner Crowd at Home –
Obliterate the need –

And Courtesy forbid
A Host’s departure when
Upon Himself be visiting
The Emperor of Men –

Emily Dickinson 277 (674)

This is quite simply one of the most clever poems I have come across.

Now for a bizarre (and bizarrely pleasing) poem:

Dans Russe

If I when my wife is sleeping
and the baby and Kathleen
are sleeping
and the sun is a flame-white disc
in silken mists
above shining trees,-
if I in my north room
dance naked, grotesquely
before my mirror
waving my shirt round my head
and singing softly to myself:

‘I am lonely, lonely.
I was born to be lonely,
I am best so!’
If I admire my arms, my face
my shoulders, flanks, buttocks
against the yellow drawn shades,-

Who shall say I am not
the happy genius of my household?

William Carlos Williams

The succession of images is just so ridiculous that it’s hilarious. The last line really knocks you out.

Compiling GTK+ apps on Snow Leopard x86-64

March 27, 2010

So for a while now I have been wanting to write GUIs in C using the GTK+ toolkit, but I have been unable to do so on my Macbook Pro. I googled the matter and saw something about GTK-OSX, which I tried to install but failed to do so, due to dependency issues or the like. I got Qt working with C++, but I didn’t want to write C++. So I gave up on GTK+ and put it off for the future.

Just today I got GTK+ working, with a catch: at the moment I can only compile for 32-bit applications. This is annoying, as I have a 64-bit architecture and I want to write 64-bit applications. However, 32-bit apps can run on a 64-bit architecture, so I’ll take what I can get.

Here’s what I did:

First, I installed GTK+ and GTK+2 using fink. You can find out the GTK packages on fink by typing:

fink list gtk | less

You’ll see that gtk+ and gtk+2 are listed. Install them with

fink install gtk+

fink install gtk+2

Now that GTK is installed (it will show up in /sw/include and /sw/lib like almost all other fink installs) we can write a quick hello world application. I stole the code from here.

// hello.c

#include <gtk/gtk.h>

int main(int argc, char *argv[])
{
	GtkWidget *window;
    
	gtk_init(&argc, &argv);
	
	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 	gtk_widget_show(window);
    
    	gtk_main();
	
	return 0;
}

Now it’s time to compile. Since GCC doesn’t know GTK’s whereabouts, we have to specify it with some include paths and library paths. We can get these paths by typing

pkg-config --cflags --libs gtk+

We’ll now set up an environment variable to contain the output of that command. Edit ~/.profile so that you have in it

export GTK="`pkg-config --cflags --libs gtk+`"

We should now be able to compile (theoretically). Type

gcc hello.c -o hello $GTK

You’ll probably get the error messages

ld: warning: in /sw/lib/libintl.dylib, file is not of required architecture
ld: warning: in /sw/lib/libglib.dylib, file is not of required architecture
ld: warning: in /sw/lib/libgmodule.dylib, file is not of required architecture
ld: warning: in /sw/lib/libgdk.dylib, file is not of required architecture
ld: warning: in /sw/lib/libgtk.dylib, file is not of required architecture
Undefined symbols:
"_gtk_main", referenced from:
_main in cc80Plip.o
"_gtk_widget_show", referenced from:
_main in cc80Plip.o
"_gtk_init", referenced from:
_main in cc80Plip.o
"_gtk_window_new", referenced from:
_main in cc80Plip.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

That’s because the GTK files that pkg-config gives us are made for a 32-bit architecture. For some reason, pkg-config doesn’t give us the gtk-2.0 files which I suspect would be for x86-64. You’ll see if you echo $GTK that we instead include glib-1.2 and gtk-1.2. So we have to compile under a 32 bit architecture.

The following should compile and run without problem:

gcc -m32 hello.c -o hello $GTK

./hello

Well that’s it, and I’m very happy to finally be able to compile GTK apps on OS X. (Even if I’m stuck writing 32-bit apps…)

Beethoven’s Piano Concerto No. 3

March 25, 2010

I’m obsessed with Beethoven. I love his Piano Concerto No. 3 — I listen to it over and over again. I’m only worried I’ll get sick of it, just like I do with pop music. But Beethoven isn’t exactly pop music so perhaps that fear is unfounded 🙂

I also love Symphony no. 5 and Symphony no. 9. I haven’t really gotten into any of the other symphonies. Same with the concertos: I only really listen to Concerto no. 3. And of course Moonlight Sonata is to die for, especially when you listen to all the movements. At the moment I am listening to the first movement of Concerto for Violin, Cello and Orchestra Op. 56, and it is very good. Let’s see what the next movements have in store 🙂

battle.net bot

March 25, 2010

I am writing a battle.net bot in C. As I said before, I wrote one in Java two summers ago, and I wrote a telnet bot in Java (when I was first learning programming) in high school. I never learned VB so I didn’t write any Clean Slate bots 😛

I now want to write a nice command-line bot in C. Maybe I’ll make a GTK+ GUI at the computer labs. I have already worked out the design and I am writing the implementation as I speak.

irc client version 1.1

March 24, 2010

I’ve abandoned my intentions of learning C++ and Qt, because frankly I don’t want to learn C++ at the moment — it is too unwieldy. I am very fond of the C language and comfortable writing code in it, so I am going to continue to write in C primarily. I plan to write a battle.net bot in C in the near future, but right now I’m more inclined to learn GTK+ so I can write C GUIs. Unfortunately my laptop runs OS X, and it’s not easy to develop GTK applications in OS X… I will probably end up learning it on the Linux computers in my school’s computer lab.

After returning to C I revisited my irc client, and wrote a second version: version 1.1. (Version 1.0 is the first.) The major difference is that 1.1 is single-threaded via the use of select(). Multithreading is quite simply bad practice in C since the language was not designed for parallelism. I am quite glad that select() went so smoothly, and that my program is now single-threaded. I am also quite pleased with my ring buffer — both select() and the ring buffer were suggestions I received in ##C.

Here is the code to my irc client 1.1: ircc1.1.

Tomorrow I’m going to the computer lab to learn GTK+.

Current Hit Song

March 11, 2010

I can’t stop listening to it! I’m going to make myself sick of it! Ahhhhhh… the tragedy of me and pop music: I wear it thin, and then it dies on me! Oh well, savor the good moments while they last.

New Project

March 11, 2010

Battle.net bot in C++. The first one I did was in Java, and only connected over telnet. This one had a GUI. The second one I did was in Java, and connected as a Starcraft client. Unfortunately, I never got around to making a GUI for it, and I also didn’t bother to implement Warden.

So this time I plan to make a complete one, in C++ with a GUI, using the Qt framework as my widget toolkit. Maybe I’ll implement Warden… but since it doesn’t hamper War 2 logons, and I only have a War 2 key, I don’t really see the point. Perhaps for learning. But first I’ll just make the bot with its GUI, and learn C++ and Qt in the process.

I just learned today that a lot of glorious applications were written in C++/Qt. These include: Google Earth, Adobe Photoshop Album, Last.fm Player, Mathematica, Opera, Skype, TeamSpeak, VirtualBox, and VLC Media Player. This really piques my enthusiasm for learning Qt 😛

Steps 2 & 3: Threading and Packet Handling

March 11, 2010

Multithreading didn’t turn out too bad. Actually, it was painless. But that’s because I did it the lazy way — I haven’t gotten around to making it thread-safe. So it sometimes happens that when you’re sending text you all of a sudden get a message received print out in the middle of your text, messing up the display of text on terminal. For personal use I can certainly live with it, but for the sake of learning threading I should learn how to use mutexes and semaphores.

Packet handling was all about string processing, which isn’t exactly C’s forte. I ended up using a mixture of strcat, strtok, and ptr++ to parse the packets I received. I also created a map that maps the string identifiers of messages in RFC to the integer constants I define for each RFC message, so this way I can switch the packet with ease.

Here is the working code. I plan to improve it later on by adding more functionality as well as thread synchronization.

Multithreading in C

March 5, 2010

This is going to be a nightmare.