Over the past two decades, live performances and recorded music have flowed into hospitals and doctors’ offices as research grows on how songs can help ease pain.