An implantable device for treating congestive or chronic heart failure in a patient, which comprises a waveform energy control system for delivering software generated waveforms comprising one or more differentially driven Class D amplifier sections, wherein the Class D amplifier section or sections produce ascending waveforms and have a programmable dual polarity LPF, and wherein intraventicular septum and bundle branches of the patient's heart can be stimulated to increase the ejection fraction of the patient's heart.