In I Am Legend, the protagonist, Robert Neville, plays music in order to retain his sanity while living among vampires. As he listens, he is thankful to his mother for having taught him to appreciate classical and symphonic music. As the novel begins, he is listening to Beethoven's Third, Seventh, and Ninth symphonies while he makes stakes for killing the inactive vampires he sees during the day. Every night Neville must barricade himself in the house; during this time, he is forced to resort to crucifixes, mirrors, and strings of garlic in order to keep the marauding groups of vampires away.
Another piece of music we see mentioned is Schoenberg's Verklarte Nacht (or Transfigured Night), a string sextet. Later, as he listens to Roger Leie's The Year of the Plague, Neville loses his temper. The fury of instrumental chaos and 'atonal melodies' which assault his ears remind him of his present abysmal situation, and he breaks the record in a display of frustration.
In Chapter Three, Neville listens to Brahms' Piano Concerto no. 2 as he reads Bram Stoker's Dracula, drinks whiskey, and smokes a cigarette. Later, after having cut his hand when he crushes the whiskey glass he is holding, Neville changes the record to Leonard Bernstein's Symphony no. 2 (The Age of Anxiety).
In Chapter Six, after cleaning up house and garage and making some improvements on his house, Neville settles down to listen to Mozart's Symphony no. 41, the Jupiter. In Chapter 9, Neville recalls the day his wife, Virginia, died. He remembers going to his neighbor, Ben Cortman's house, to borrow his car so that he can bury his wife quietly. At Ben's house, the door chimes play How Dry I Am by Irving Berlin.
In Chapter 11, Neville thinks that he has found the cause for the presence of vampires: the 'vampiris' germ. Alas, despite this new and hard-won knowledge, he has no way of finding an immediate cure; he doesn't know enough about bacteria to concoct a defense against the germ. As he sits down and ponders his predicament, he listens to Ravel's Daphnis and Chloe Suites One and Two.
In Chapter 17, Neville promises Ruth, the sole infected survivor he finds, that he will do everything he can to cure her. They listen to Schubert's Fourth Symphony as they ponder the ramifications of their experiment; Ruth reluctantly agrees to let Neville test her blood to determine whether she is infected with the bacillus germ. Later, Ruth asks whether she can play Rachmaninoff's Piano Concerto no. 2 on the record player. Neville replies in the affirmative, and Ruth soon settles down to ask him some personal questions.
The novel ends with Neville being given some pills by Ruth so that he can die without being executed by members of the new, infected society.