On a flight home to New York last week, the jazz musician John Pizzarelli received a text message saying that Barbara Cook, the 89-year-old star of Broadway and cabaret, was in failing health. He and his wife, the singer Jessica Molaskey, had met Ms. Cook a decade earlier at Café Carlyle, one of her musical haunts, and they had become close. Would the couple like to come to her bedside and say their goodbyes?

“The first thing I said was, ‘Well, can I bring my guitar?’” Mr. Pizzarelli recalled.

In the days before Ms. Cook’s death on Tuesday, friends from her legendary career delivered a fitting farewell: More music. Vanessa Williams and Norm Lewis, who starred with Ms. Cook in the 2010 Broadway revue “Sondheim on Sondheim,” were among those who came by her Upper West Side apartment and sang to her. Josh Groban, Hugh Jackman, Audra McDonald, Kelli O’Hara and others sent audio and video recordings full of memories and melodies.

Ms. Cook was in and out of consciousness, able to recognize voices and respond with a squeeze of the hand.

“So often music can kind of connect in ways that just speaking can’t,” said Mr. Groban, the singer and recent star of Broadway’s “Natasha, Pierre & the Great Comet of 1812,” who sent an audiotape.