He was able to manage the fatigue well enough to return to Brown in the fall of 2012 for his junior season, but he soon realized he was just a shadow of himself. A heartbreaking epiphany, after the best game that he ever played, pushed him even further into music. In a nationally televised matchup that December against Providence, Mr. Halpern hit the winning shot, his eighth 3-pointer of the night, to upset the Friars.

“I sat down and cried,” he said. “I was so exhausted I couldn’t celebrate. I knew it was over. My body couldn’t do it.”

The next summer, Dr. Scott Hammer, an infectious disease specialist, made it official. “He told me I was going to kill myself,” Mr. Halpern said, “and he would not clear me to play.” (It was not until months later that Mr. Halpern was told he had a severe strain of the Epstein-Barr virus, which causes mononucleosis and often presents, as it did in Halpern’s case, with symptoms like debilitating fatigue.)

On the day in 2013 when Dr. Hammer told him his basketball career was over, Mr. Halpern stopped at a music store and bought a D.J. setup and speaker. He promised his parents he would finish his studies of the history of art and architecture, and graduate, but he already had another plan in mind.

“I’m sure the last thing they wanted to hear was that I wanted to be a D.J.,” Mr. Halpern said.

Just as he once roamed playgrounds and gyms in search of pickup basketball games, Mr. Halpern hustled D.J. gigs around campus. He lugged his gear and speakers to midnight house parties or Sunday morning brunches, mostly working free.

“I have approached music like I did basketball,” Mr. Halpern said. “I wanted to see how good I could get.”

It was at a gig at an art gallery that he met Ms. Hawley-Weld. She was playing bossa nova music in a trio. She was playing beautifully but, he thought, much too slowly. So Mr. Halpern laid down a computer beat and asked Ms. Hawley-Weld to go through the song again. Pleased with what they heard, the two agreed to meet the next day and record it.