When it comes to studying heart sounds with algorithms, it is important to not be naive, technology is a tool, not an oracle. Mastering what we do is of utmost importance and having multiple informations helps to gain confidence in the outcome of algorithms.
One important information for segmenting the heart beat in sounds, is the heart rate, but it is much better to know approximatively when heart beats begins.
Heart beat events are easy to recognize with ECG because there is a very distinctive figure, the "R" peak which signals the contraction of ventricles.
However the ECG is difficult to sample and it does not give easily much other usable information. For example one has to interpret deflection of waves or figure out if missing beats are normal or not. Surprisingly our heart can miss beats, for example if we move during the sampling.
Phonocardiograms are easier to sample and they give more trusty information.
However automatically segmenting Phonocardiograms is not an easy task either. There is a well known challenge for heart specialists on this subject: Physionet/CINC and indeed there are the Kaggle challenges for the data scientists.
Phonocardiograms are usually obtained with Doppler ultrasounds or with electronic stethoscopes. But it could be sampled with ordinary microphones as well, providing that ambient sounds are not too loud.
As Webcams are often equipped with microphones and SBC like Raspberry Pi can use webcam out of the box I was thinking of using photoplethysmography to at least get the heart rate. This is an ongoing work but results are encouraging. I am using a Logitech 270 webcam.
The result of this study is intended to be included in my Hjerte software package that now runs on a Raspberry Pi.