In the 11 days he spent fighting Covid-19 at Montefiore Nyack Hospital, there was one thing Mark Schwarz couldn’t figure out.

“Occasionally throughout the days there, you would randomly start hearing music playing and wonder, ‘What’s that for?’” Mr. Schwarz, 54, said on Tuesday.

On Monday, when it finally came time for Mr. Schwarz to go home from the hospital in Nyack, N.Y., he heard for himself: The cheerful chorus of the Beatles’ “Here Comes the Sun” rang through the hospital hallways to celebrate his discharge.

Pick a hospital in the metropolitan area of New York these days, and you are likely to find that the staff has identified a song as the fitting soundtrack to the release of patients who had been hospitalized because of the virus.