Once I started thinking about it, I realized that the Pivot
control was the perfect choice for realizing a program I had long been
contemplating. This program corrects what I perceive to be a major
deficiency of portable music players such as the Zune and Windows Phone
7, so a little explanation is necessary:
As you may know, the
landscape of music in the United States and Europe can be roughly
divided into performer-centric music and composer-centric music. The
performer-centric tradition has close ties with the rise and evolution
of recording technologies and encompasses performers from (say) Robert Johnson (1911–1938) through Lady Gaga (b. 1986). Performer-centric music consists predominantly of a musical form known as the song, generally several minutes in length, with a vocalist and instrumental accompaniment.
The composer-centric tradition is much older, stretching from (say) Claudio Monteverdi (1567–1643) through Jennifer Higdon
(b. 1962), and encompasses very many different forms (for example,
string quartet, piano concerto, symphony, and opera as well as songs) of
widely varying lengths, styles, and instrumentation.
People who listen to
composer-centric music generally prefer to organize their music by
composer, and then within composer by composition, and within
composition by performer. (As with the performer-centric tradition, the
word artist is satisfactory for referring to the person or people playing the music.) The Zune
desktop software allows you to enter composer information when
downloading music and ripping CDs, but that information is not
transferred with the files to portable devices such as the phone. Even
if composer information was included in the music files transferred to
the phone, it is not available through the public properties of the
classes used to access the music.
To compensate for this
deficiency, people who listen to composer-centric music often
incorporate the composer’s name in the album title followed by a colon,
such as:
Mahler: Symphony No. 2
Many CDs of music in the
composer-centric tradition rip with album titles in this format. For
albums that have music of more than one composer, I’ve also adopted the
convention of separating the composers’ names with commas:
Adès, Schubert: Piano Quintets
Over the years I’ve ripped
about 600 of my CDs to the PC, and most of them are identified in this
way. When the music player lists the albums alphabetically by album
title, the music is also listed alphabetically by composer, so that’s a
big help.
But I wanted more. I wanted a
hierarchical structure based around the composer. I wanted to see the
composers’ names up front so I begin by selecting Schubert or Debussy or
Messiaen.
So I decided to write a Windows Phone 7 program called MusicByComposer that takes this extra step. The program accesses the music
library on the phone and—under the assumption that the album titles
begin with one or more composer names followed by a colon—extracts the
composers’ names from the album titles. It then arranges the music by
composer, where each composer becomes a PivotItem. The content of that PivotItem is a ListBox that lists all the albums containing music by that composer.
The MusicByComposer program begins with a screen that looks something like this:
You should recognize this as a standard Pivot control where each PivotItem is a composer. On my phone the first PivotItem displays albums by American composer John Adams (b. 1947). The other PivotItem headers you can see here are for British composer Thomas Adès (b. 1971) and German composer Johann Sebastian Bach (1685–1750).
If none of your music has a colon in the album title, all your albums will be listed under a single PivotItem with the header “Other”.
The PivotItem for each composer contains a ListBox
where each item includes the thumbnail album art, the album title
(without the composer name) using the phone’s current accent color, and
the artist associated with the album in the foreground color.
Tapping any album brings you to a page for that album:
This is a standard PhoneApplicationPage with the standard two TextBlock
items for the application title and the page title, but as you can see,
the titles are the same size and in the same position as the Pivot control on the opening page. The larger album art is shown with the full album name and artist. Underneath is a ScrollViewer with an ItemsControl with all the tracks from the album. This screen has no touch interface except for scrolling: You control everything with the ApplicationBar
buttons: go to the previous track, play and pause, and go to the next
track. The currently playing track is indicated with the accent color
and time progress.
After an application starts
playing an album, it’s normal in Windows Phone 7 for the album to play
all the way through, even if the application ends or the phone’s display
shuts off. The MusicByComposer program allows you to navigate to other albums,
but it will only shut off an existing album and play a new one if you
press the middle button to pause the existing album and press again to
play the album on the page.