Dr. Daniel Mason, a prominent cardiologist, had a big heart, taking an active interest in each one of his grandchildren's summers on New Jersey’s Long Beach Island until his death in 2011 at age 92.

But he left behind another kind of legacy for his family, one that set his grandson Andrew Josephson on the path to medical school and, inadvertently, but luckily, helped to save his mother’s life.

Mason, who lectured and practiced for 50 years at Philadelphia’s Hahnemann Hospital, had produced a three-CD set of digitized heart sounds and murmurs, some extremely rare, to teach medical students the nuances of detecting heart disease.

“Whenever someone had a patient with an irregular pattern with their heart sounds, he would grab his recording equipment,” grandson Josephson said. “He used them as a teaching tool for students and cardiologists and other physicians in the field, anyone who used a stethoscope.”

“My grandfather was such an influence in my life,” Josephson, 23, who lives at home in Moorestown, N.J., said.

That was an understatement.

Josephson, after his graduation in biochemistry from Lehigh University in Pennsylvania, discovered on the family bookshelf his grandfather’s collection of 125 or more heart sounds, and created an app, “Listening to the Heart,” that uses the iPhone to record a person’s heartbeat, compare it to Mason’s recordings, and identify any abnormalities.

And in the process this year, he diagnosed his mother’s silent heart disease.

It all started in 2011, when Josephson was on a gap year and considering applying to his grandfather’s alma mater, Drexel University in Philadelphia.

“I was going through his stuff after he died and discovered the CDs,” he said. “He had spent years running around the hospital recording people. I thought about doing something with them, to republish them was my initial goal.”

As Josephson thought about it he was inspired by the music app Shazam, which matches songs with a musician’s body of work. Although he had taken only had one computer programming class in college, he bought some books and taught himself to learn writing code.

“With the platform of the iPhone, I extracted all the sample sounds he had recorded from lectures and did a little acoustic analysis on the computer,” Josephson said.

“At first, we really weren’t sure it worked,” he added. “I was not the most reliable programmer.”

He had to tweak the iPhone’s microphone but soon figured a way to hold the iPhone up to the chest and compare and analyze the sound to match the recordings in his grandfather’s collection and to get the five closest matches.

Josephson first began experimenting on friends and found that their heart sounds yielded “normal” results.

By 2013, one of his first guinea pigs for the prototype was his mother, Dr. Tina Josephson, the daughter of Daniel Mason and an internist in Cherry Hill, N.J.

“Mom kept coming up with the same abnormal heart sound,” he said. “We did it multiple times and in multiple locations and got the same result.”

Even though she had “complete faith” in her son, Tina Josephson ignored the results: a heart murmur, suggesting a potentially dangerous condition. “I was probably in denial,” she said, laughing. “I’m a doctor. I never get sick.”

But when the family went out to Steamboat Springs in Colorado to ski this year, she noticed a difference in her breathing.