The familiar “lub-dub” heard through a stethoscope contains two sounds within the same heartbeat. The first is associated with the valves between the atria and ventricles closing; the second with the aortic and pulmonary valves closing after blood has been pumped out of the ventricles.
The heart has four valves. They open and close during the cycle to keep blood moving in the right direction: first towards the lungs, then, once oxygenated, towards the rest of the body.
An internal electrical system coordinates the contractions. Sound, movement and electrical activity are therefore connected aspects of a heartbeat: listening to the heart and recording an electrocardiogram examine different aspects of how it works.