Get Name of Previous Track in iTunes?

I know how to get the index of the previous track in a playlist. Is there any way to tell AppleScript “here’s an index, give me the track name (title)”? I want to somehow get the title of the previous track in the playlist. It would be nice to avoid making a big array of all the titles in the playlist and picking the second to last one as AS is sloooow.

I’m kluging together a script that fades the volume to CurrentVolume*0.5, speaks “You’re listening to by . Before that we heard by , and before that was by ”, delays 0.5, and fades back up to CurrentVolume.


It just so happens that I was listening with iTunes and got this:

tell application "iTunes"
	set current_playlist to current playlist
	set current_track_index to index of current track
	set previous_track_index to current_track_index - 1
	set previous_track_ref to (first track of current_playlist whose index is previous_track_index)
	return name of previous_track_ref
end tell

This was done in an intoxicated state so tomorrow I might think of a better way, but maybe not.