Archive

Archive for June, 2009

Programming Journal

June 29th, 2009 Comments off

I thought I might try to start writing about what coding I’m doing, without going in to a lot of detail, but just to record my day-to-day struggles with this programming business.

Updating Chapter Master

At the moment, my main challenge is trying to get out another version of my shareware software Chapter Master.

New Chapter Master

It’s going on for a year since the last release, and at that stage the software, while working well for most people, was still in my mind a little experimental. Certainly time to consolidate what I have learned since the last release, add some requested features, and some ideas of my own.

The purpose of the software is to create or manipulate ‘chapter stops’ and optionally ‘chapter images’ in AAC files (*.m4b or *.mp4 extension). These are the files treated as audiobooks or ‘enhanced podcasts’ by Apple’s iTunes and the iPod. Chapter stops create points within the file to which the user can easily navigate. Ideally, of course, one would position these chapter stops at the exact times in the audiobook where the narrator says “Chapter Five” or “Book Three” or “Part Two”. The software will let you do that manually, but no way can I imagine what artificial intelligence would be required for the software to automatically find such points, though it has been requested.

My companion software MarkAble will allow you to merge together a bunch of source files and insert chapter stops at the beginning of each new file. Sometimes the source files are such that these points are at the logical breaks in the book. Chapter Master lets you edit these existing chapter stops to your heart’s content.

Most of my programming struggles over the last week, though, have been to do with trying to pull out – or create – the ‘cover art’ which iTunes can associate with any audio file.

There are two types of image which can be embedded in an AAC file which has been through, or is going to be used by, iTunes and the iPod. The first is the above-mentioned ‘cover art’, which is what shows up in the cover flow mode of iTunes, or in its grid view. The second type of image is embedded along with the audio data. These images can change at different times as the audio is played, and are what gives ‘enhanced podcasts’ some of their charm.

Chapter Master originally only handled the latter type of image, and some users found it puzzling that the ‘cover art’ didn’t turn up in Chapter Master. So most of my efforts over the last week or so have been to alter the program so that it can manipulate either kind of image. In the case of cover art, this meant that I had to parse and unpack the iTunes meta data, which includes the cover art images.

The AAC file structure is based on the structure Apple originally developed for QuickTime, and consists of ‘atoms’ which can be nested (that is, atoms can contain other atoms). Each atom starts with a data length (a 32-bit unsigned integer) and an atom type indicator which can be read as a 4-character ASCII string.

The iTunes meta data is stored in a ‘user data atom’, type-string ‘udta’. Now this type of atom can contain anything the encoder software desires – which means one has to be careful to check that it contains data structured in the iTunes manner. Apple structure their udta atom with yet another atom hierarchy containing the meta data and any images.

I managed to decode all this without too much trouble if the meta data atom already existed. But I also wanted to allow people to add a new cover art image in Chapter Master, and fill in any meta data, if it didn’t already exist. This meant that I had to create my own ‘fake’ meta data atom and trick iTunes into recognizing it. This proved considerably trickier than I had anticipated, but I think I have managed it. It took a lot of careful working with a hexadecimal editor (I use the excellent Hex Workshop), lots of trial and error, and lots of thinking. Anyway, it looks like I got there.

Books in iTunes

One trick I will pass on to others is that it seems that iTunes expects the udta meta data atom to be the LAST atom inside the ‘moov’ (or ‘movie’) atom. If it’s not in that location, it’s ignored.

Other features I’ve added include the ability to add titles to an image, the ability to do sophisticated search/replace on chapter text, and multi-selection ability in the chapter list.

I’ll be releasing the new version of Chapter Master (1.2.0) as a beta for a while, as so much has changed.

Recent Reading

June 20th, 2009 Comments off

My fortnightly summary of what I’ve been reading and listening to.

The Jetty Journals

The Jetty Journals by Ian Buchanan

E-book on my iPod.

This is a short novel aimed at teenagers, written by a good friend of mine and now published as an e-book through Smashwords.

Ian sent me an electronic copy of his novel a couple of years ago and urged me to read it; but what with one thing and another I didn’t get around to it. A large part of my reluctance, I think, was just that I hate reading anything of any real length on the computer screen. Reading for pleasure is part of what I call the ‘couch culture’. Reading stuff from the computer screen is part of ‘desk culture’ and too much like hard work.

Anyway, when he let me know that it was available as an e-book in a format suitable for my iPod Touch, I downloaded it and read it with pleasure in a few days.

The book tells the story of a small group of Melbourne teenagers who survive a global pandemic which kills off a very large percentage of the population. Well, it turns out, it didn’t actually kill everyone – some people survive, but unpleasantly changed

The book is strong on the group’s desperate struggles to survive, and full of local color – set mainly on the Mornington Peninsula which runs along the eastern edge of Melbourne’s Port Phillip Bay.

I found it very enjoyable, though I felt the ending was a little incomplete. Ian tells me, though, that he has a sequel in the works, which should satisfy that feeling.

Secret Asset by Stella Rimington

E-book on my iPod.

This is the second novel by the one-time head of Britain’s MI5, and as with her first novel, is full of convincing detail about the management of agents and the investigation of terror threats.

A terrorist plot is detected, but with insufficient information to track down the suspects; an old IRA member lies dying and reveals a secret vulnerability of Britain’s security forces; our heroine Liz Carlyle is delegated to investigate some of her fellow staff, looking for a mole.

I found the ending of this one to be a little unsatisfactory – perhaps not quite credible – as the mole is finally identified, their motivation discovered, and the terrorist plot revealed. But still, good page-turning stuff.

Current Reading

I’m currently part-way through:

  • Team of Rivals by Doris Kearns Goodwin (Hardcover, my own library)
  • The Great War – Breakthroughs by Harry Turtledove (Audiobook)
  • South by Sir Ernest Shackleton (E-Book)

Little-Ease – Part 2

June 19th, 2009 1 comment

‘Are you in pain, dear mother?’

‘I think there’s a pain somewhere in the room,’ said Mrs.
Gradgrind, ‘but I couldn’t positively say that I have got it.’

– Charles Dickens, Hard Times

So a few weeks back I wrote about my back problems. Just to continue the story….

A couple of weeks ago, after continuing lack of improvement (and some deterioration) in my pain levels, the doctor sent me off to get a CT scan of my spine.

My wife drove me across to a nearby medical center to get the scan done, results would be with my doctor the following day.

So, after being scanned, I went home, spent a reasonable evening and just before I went to bed had a dose of the new brand of painkiller my doctor had prescribed, hoping to last through the night.

Instead, at about 1 am, I managed to turn over in a funny way and something seemed to go CLICK! And it wasn’t a good click, let me tell you. In pain, I got up to go to the bathroom and once there everything got much much worse pain-wise. I started to groan very loudly and my wife got up to find me on the edge of passing out, cold sweat, dizzy, the whole damn thing. She got me out of the bathroom, where I sank to the floor and lay on my face on the carpet, unable or unwilling to move.

I’ve found from experiment that a face-down position is the one which gives me least pain, and so it was here. “I’m staying here!” I said, as the pain started to ease a little. Any attempt at getting up created new waves of pain.

We agreed to wait for a while to see if things settled down, so my wife brought me a pillow and a quilt and that’s where I stayed for the next few hours. At about 6 am that morning, we debated and finally agreed that the only option seemed to be to call for an ambulance. She did manage to get me up from the floor and on to a couch to make it easier for the ambulance people, which we managed, but not without re-invoking the whole screaming pain, almost passing out exercise.

So the ambulance arrived and gave me one of those pain-reducing inhalers (which seemed to do very little good). Just before we got to the hospital, they gave me an injection of something stronger (low dose of morphine, I imagine), which after about half an hour waiting in casualty seemed to be having some effect.

In due course I was seen by a doctor, and my wife was able to give her the phone number of the place which had done the CT scan, so the hospital could be faxed a copy of the report.

The good news is that apart from fairly normal age-related deterioration of the spine, there didn’t seem to be any sign on the scan of a prolapsed disc or other nasties. The bad news is that it didn’t show any good reason for the excrutiating pain, either.

I was given more pain relief, and the good news there is that it seems that good old Panadine Forte and Neurofen seemed to be the most effective medications tried so far on my problem. With a good dose of those, my pain started to ease, and eventually they let me go home about mid-morning.

The upshot of all of this is that if I get any more episodes of such severe pain, I’ll need to have an MRI scan done (much more detailed than a CT scan, apparently), but in the meantime, keep taking the tablets. My wife had a good talk with my GP (who had also been faxed the CT results), and her impression is that my problem may still largely be a muscular one, albeit a muscle or two which is severely annoyed with me.

We all hope that I don’t hit another such episode of severe pain, but only time will tell.

Categories: Personal Tags:

The Pleasures of Poetry

June 5th, 2009 Comments off

“Blasts from the Past” is a collection of re-published articles dating from wa-a-a-y back to the time when I was publishing sf fanzines (1970s), through to some more recent articles published on (and about) the early days of the web (1990s).

The Heavenly Host

The Pleasures of Poetry

(First published in February 1996)

The trouble with a lot of high school courses, I suspect, is that rather than leading you down to the pool and inviting you to drink, they drag you down screaming and try to push you in, leading to a life-long aversion to water.

At least that seems to have been the way it was when I went to school, thirty years or so ago. But I’m not confident that things have changed since.

Among the subjects that seem to have been spoiled in this way for people are most of mathematics and literature. Being forced to digest either algebra or Dickens before you have acquired a taste for them is probably the main reason that most adults appear to suffer indigestion at the very mention of either.

In particular, I fear that many people have their taste for poetry spoilt by their experiences at school. Few adults, I imagine, nowadays read or re-read poetry for pleasure. If you have any books of poetry in your house, the odds are that they are the remnants of your school or university education rather than the result of a deliberate purchase.

I have to confess that this certainly applies to me, but on the other hand every few years or so I seem to re-discover the pleasures of poetry, and I start picking up my old school volumes and begin to dip here and there, rediscovering my old favourites and from time to time discovering new ones.

What exactly is ‘poetry’? It’s a curious word, suggesting that it can only be defined as the result of what poets do – as though all furniture could only be defined as ‘carpentry’ – that is, the result of what a carpenter does.

Poetry often but not always involves some kind of rhyme – an odd convention when you think about it. And poetry often uses rhythm, with or without rhyme. But neither of these is essential to what makes something poetry. Is the following a poem? I think it is, yet it has neither rhythm nor rhyme:

You say grace before meals.
All right.
But I say grace before the play and the opera,
And grace before the concert and the pantomime,
And grace before I open a book,
And grace before sketching, painting,
Swimming, fencing, boxing, walking, playing, dancing;
And grace before I dip the pen in the ink.
(1)

What seems to be constant, at least in the best poetry, is a heightened, almost ceremonial use of language, a precise care about how every word should sound.

More than anything poetry expresses a profound emotion, or tries to call up some deep feeling from us:

Ah, love, let us be true
To one another! for the world, which seems
To lie before us like a land of dreams,
So various, so beautiful, so new,
Hath really neither joy, nor love, nor light,
Nor certitude, nor peace, nor help for pain;
And we are here as on a darkling plain
Swept with confused alarms of struggle and flight,
Where ignorant armies clash by night.
(2)

This is in danger of starting to sound like one of those English Lit classes that destroy so many people’s love of literature! That is the opposite of my intention. What I want to show you here is why some poetry appeals to me and why I am drawn back to it. Poetry which works for me calls forth some profound sympathetic feeling, as when Yeats writes out for us the city dweller’s yearning to escape to a simpler life:

…for always night and day
I hear lake water lapping with low sounds by the shore;
While I stand on the roadway, or on the pavements grey,
I hear it in the deep heart’s core.
(3)

“I hear it in the deep heart’s core”. That is a phrase that strikes for me a resounding chord. To analyse why that phrase works, as one would do in school, would be to destroy it.

I have a poor memory for recalling whole poems. It is individual verses or phrases of great power and beauty that stay in my mind:

But at my back I always hear
Times winged chariot hurrying near.
And yonder all before us lie
Deserts of vast eternity.
(4)

How well that expresses the urgency of time, as Marvell urges his coy mistress not to waste it, in what must surely be the most famous of all come-ons in literature.

Or, another example in the same vein, the wry humour as Shakespeare debunks the overblown romantic nonsense of some poetic lovers:

My mistress’ eyes are nothing like the sun;
Coral is far more red than her lips’ red;
If snow be white, why then her breasts are dun;
…I grant I never saw a goddess go,
My mistress, when she walks, treads on the ground:
And yet, by heaven, I think my love as rare
As any she belied with false compare.
(5)

Or poetry can inspire in us a sense of magic and mystery:

Go and catch a falling star,
Get with child a mandrake root,
Tell me where all past hours are,
Or who cleft the Devil’s foot…
(6)

It can range from humorous playing with words and ideas…

O who shall from this dungeon raise
A soul enslaved so many ways?
With bolts of bones, that fettered stands
In Feet, and manacled in Hands…
(7)

…to the tragedy of modern times:

…Things fall apart; the centre cannot hold;
Mere anarchy is loosed upon the world,
The blood-dimmed tide is loosed, and everywhere
the ceremony of innocence is drowned;
The best lack all conviction, while the worst
Are full of passionate intensity….
(8)

The subject of love poetry is a large one, but this poem is dear to my heart (it formed part of our wedding ceremony):

If questioning could make us wise,
No eyes would ever gaze in eyes.
If all our tale were told in speech
no mouths would wander each to each…
(9)

And then there’s poetry which one loves just because of the wonderful sound of it:

In Xanadu did Kublai Khan
A stately pleasure-dome decree
Where Alph the sacred river ran
Through caverns measureless to Man
Down to a sunless sea.
(10)

A great deal of the pleasure I find in reading poetry is re-discovering the context of magical fragments like these.

There is a delight in the sound and texture of this language on one’s tongue, and an upwelling of feeling that, for me, makes poetry well worth returning to again and again:

…I hear it in the deep heart’s core.

————————-
Sources:

(1) G.K.Chesterton, untitled poem
(2) Matthew Arnold, “Dover Beach”
(3) W.B.Yeats, “The Lake Isle of Innisfree”
(4) Andrew Marvell, “To His Coy Mistress”
(5) W.Shakespeare, Sonnets CXXX
(6) John Donne, “Song”
(7) Andrew Marvell, “A Dialog Between Body and Soul”
(8) W.B.Yeats, “The Second Coming”
(9) Christopher Brennan, “Because She Would Ask Me Why I Love Her”
(10) S.T.Coleridge, “Kublai Khan”

(It may be objected, and with justice, that these examples are all drawn from the now fashionably-discredited white male-dominated Anglo-Saxon culture. That’s true. But while I have no objection to others celebrating their culture in their own way, the fact is that I am a white Anglo-Saxon male – this is my culture, and I see nothing wrong with celebrating it and, indeed, rejoicing in it.)

Categories: Blasts From the Past Tags:
Performance Optimization WordPress Plugins by W3 EDGE