Echocardiography, or echo, is a painless test that uses sound waves to create pictures of the heart. It can help doctors diagnose endocarditis.