referring to fig1 there is depicted a block diagram of a cardiac control system in the form of an antitachycardia pacemaker 1 . although the preferred embodiment of the invention , an arrhythmia detector , is described as comprising one part of an implantable antitachycardia pacemaker and defibrillator , it is to be understood that the invention is intended for usage , in general , in any cardiac control and monitoring device which senses cardiac electrical signals . such devices may include bradycardia cardiac pacemakers , electrical sensing drug infusion pumps , and internal and external cardiac monitors and electrophysiology recorders . antitachycardia pacemaker 1 is designed to be implantable in a patient and includes an output generator 54 , which is controlled by commands from a controller 50 , and appropriate leads 56 for electrically connecting the output generator 54 to a patient &# 39 ; s heart 62 . the leads 56 also connect the patient &# 39 ; s heart to sensing circuitry , beginning with a preamplifier and attenuator 40 . if the antitachycardia pacemaker 1 is a dual chamber device , leads 56 will generally include an atrial cardiac lead pair extending to the atrium of the patient &# 39 ; s heart for sensing of atrial cardiac electrical activity and for the administration of pacing therapy to the atrium , and a ventricular cardiac lead pair extending to the ventricle of the patient &# 39 ; s heart for sensing of ventricular cardiac electrical activity and for the administration of a pacing therapy , cardioversion or defibrillation to the ventricle . in a single chamber device , leads will generally include a lead pair to only one of the heart chambers . commands from controller 50 to output generator 54 determine which cardiac chamber is stimulated and regulate the timing , amplitude , duration , and stimulus pulse waveform of the delivered pacing therapy . the controller 50 may , in response to inputs received from a digital absolute value block 44 and various inputs received from a digital comparator 46 or a telemetry block 52 , perform various operations so as to generate different control and data outputs to both the output generator 54 and a defibrillator 58 . a power supply 60 provides a reliable voltage level to the antitachycardia pacemaker 1 , including the controller 50 and the defibrillator 58 by suitable electrical conductors ( not shown ). defibrillator 58 produces a high voltage to charge its capacitors ( not shown ) and then discharges them in response to control signals from the controller 50 . a defibrillator electrode lead 64 transfers the energy of a defibrillator shock 66 from the implanted antitachycardia pacemaker 1 to the heart 62 . signals received from the telemetry block 52 permit an external programmer ( not shown ) to change the operating parameters of antitachycardia pacemaker 1 by supplying appropriate signals . thus , it is also possible for an external programmer to control operation of defibrillator 58 by means of signals provided to the controller 50 . the controller 50 receives various status and / or control inputs from the digital comparator 46 and the defibrillator 58 , such as a sense signal ( sns ) from the digital comparator and signals via a bidirectional bus 59 from the defibrillator 58 . the controller 50 performs operations , such as arrhythmia detection , and produces outputs , such as pace stimulation control of the output generator 54 . in this manner , the controller 50 determines the characteristics of pacing , such as pulse energy and the heart chamber to be stimulated , that is to take place . the controller generates other control outputs to deliver a shock to the patient , to dump the shock to an internal load within the defibrillator 58 , to control the charge of a capacitor ( not shown ) within the defibrillator which determines the voltage level of the shock to be delivered , and to provide a digital signal representative of charge voltage from an analog - to - digital converter ( not shown ) within defibrillator 58 , thus providing a feedback loop which assures that a shock of proper energy level is delivered by defibrillator 58 . the preamplifier and attenuator 40 amplifies the electrical signal from the heart by a gain of 30 in the preferred embodiment of the invention . an eight bit control signal from the controller 50 sets a variable attenuator setting in the attenuator between 0 and 255 / 256 to attenuate or scale the input signal . a change in the attenuator setting affects the voltage deviation required at the sensing electrode for a sense to be registered . a delta modulator and bandpass filter 42 receives analog signals from preamplifier and attenuator 40 , filters the incoming data , and converts it to digital form . a preamplifier and attenuator circuit and a delta modulator and bandpass filter circuit which are suitable for a device which incorporates the arrhythmia detector of the present invention is described in two patents by r . h . whigham , u . s . pat . no . 4 , 692 , 719 , entitled &# 34 ; combined pacemaker delta modulator and bandpass filter &# 34 ; and issued sep . 8 , 1987 , and u . s . pat . no . 4 , 779 , 617 , entitled &# 34 ; pacemaker noise rejection system &# 34 ; and issued oct . 25 , 1988 , and one patent by r . h . whigham et al ., u . s . pat . no . 4 , 821 , 724 , entitled &# 34 ; pacing pulse compensation &# 34 ; and issued apr . 18 , 1989 . fig2 represents a more detailed diagram of the combined delta modulator and bandpass filter 42 which operates on a pacemaker sense input signal e in from the preamplifier and attenuator 40 of fig1 . this circuit performs delta modulation and bandpass filtering using a single amplifier , thereby requiring less power to operate the antitachycardia pacemaker . in fig2 input signal e is applied to terminal 10 through a resistor r1 to the plus input of a differential amplifier 12 . the output of the differential amplifier is applied to the d input of a flip - flop 18 , which is clocked at a 32 khz rate . the q output of the flip - flop 18 reflects the state of the input at the preceding clock pulse . a dashed line 22 represents control over a switch 24 , which is shown in the position resulting when the q output of the flip - flop is high . a + 100 na current source 16 electrically interconnects with the circuit according to the position of the switch 24 , as shown . alternatively , the switch 24 may interconnect a - 100 na current source 14 with the circuit in response to an opposite state of the flip - flop 18 . the switch 24 may also take an intermediate position , which interconnects neither current source to the circuit . when current does flow , it flows through three capacitors , one ( c1 ) having a given magnitude and two ( c2 and c3 ) having the same magnitude which may be different from the magnitude of c1 . the capacitors c1 , c2 and c3 and resistors r1 and r2 , in combination with the differential amplifier 12 , perform bandpass filtering of the pacemaker sense signal . by virtue of control line 22 , which determines the position of switch 24 , the circuit operates as a delta modulator in response to changes in the input signal e in . for example , when the input signal e in increases such that the plus input potential to differential amplifier 12 becomes larger while the minus input potential to differential amplifier 12 remains at virtual ground , the amplifier output goes high . the next 32 khz clock pulse causes the q output of flip - flop 18 to go high , causing current to flow from the current source 16 through capacitor c1 . as a consequence , this restores the potential at the minus input to the differential amplifier 12 to return the potential difference between the minus and plus potential connections to the differential amplifier 12 to the quiescent level . in a similar manner , when the input signal e in decreases to lessen the potential difference between the plus and the minus inputs to the differential amplifier 12 and to bring the amplifier output low , the flip - flop 18 resets . this causes control line 22 to set switch 24 and connect the circuit with current source 14 , driving the current through c1 and reducing the potential at the minus input to the differential amplifier 12 to the quiescent level . accordingly , the output of the differential amplifier 12 serves the dual purposes of controlling the switch to the current sources and representing a bit sample indicative of the manner in which the input signal is changing . the differential amplifier minus input is a virtual ground . capacitor c1 is charged and discharged by the current sources so that the potential at the input is increased or decreased by a capacitor potential to create a result in which the potential at the minus input to the amplifier is equal to a reference potential at the plus input . in a quiescent condition , the flip - flop output is alternating 0 and 1 bit samples . a change in the potential at the input causes the flip - flop output to convert to a number of bit samples of the same value until the capacitor charges or discharges to an extent which compensates for the change at the input . in this manner , the number of bit samples of constant value at the output of the delta modulator represents the magnitude of the change in the input signal . the value of the output bits depicts the direction of the change . the output of flip - flop 18 , a sequence of bit values expressing changes in the input signal over time , is applied to the data input of an accumulator 20 , which is also clocked at the 32 khz rate ( actually 32 , 768 hz ), but on alternate phases . during each clock cycle , after the flip - flop state is established , the accumulator count increments or decrements according to the state of the flip - flop . the accumulator resets at a 0 . 5 khz rate . during each 2 millisecond accumulator cycle , there are 64 clock pulses . the flip - flop is clocked for 62 of these clock pulse cycles to delta modulate the input signal . in the remaining two clock pulse cycles , the flip - flop is not clocked , the switch 24 connects neither current source to the circuit , and the circuit performs &# 34 ; housekeeping &# 34 ; functions such as loading a register from the accumulator , resetting the accumulator , and balancing the current sources . when the accumulator is reset , it takes the value of - 31 . therefore , every 2 milliseconds the accumulator provides a sum of the string of 62 zero and one bits to produce an output number n between , and including , the limits of - 31 and + 31 . the controller 50 of fig1 may read this output every other 0 . 5 khz cycle to provide a sampling frequency of 500 hz . in an alternative embodiment of the invention , an additional accumulator ( not shown ) may sum the values within the 2 millisecond accumulator to provide for a lower sampling frequency . for example , an accumulator may sum two consecutive 2 ms samples to provide 250 hz samples with values ranging from - 62 to + 62 . again referring to fig1 the digital data signal from the delta modulator and bandpass filter circuit 42 progresses both to a digital absolute value circuit 44 and to the controller 50 . the digital absolute value circuit derives the absolute value of the digital data signal and delivers it to a digital comparator 46 . the digital data signal passes to the controller 50 without absolute value rectification to preserve signal polarity information for further processing . the controller 50 presets a threshold value into a threshold register 48 which the digital comparator 46 compares with the absolute signal value from block 44 . if the absolute signal value is greater than the threshold , the digital comparator generates a sense wakeup signal ( sns ) to notify the controller 50 of such an event . note that in a dual chamber device the signal sns includes a signal for both the atrium and the ventricle . the controller 50 , which may be a microprocessor , controls all operations of the antitachycardia pacemaker 1 . in the preferred embodiment of the invention , the arrhythmia detector is a software routine performed by the controller 50 . it is to be understood that the invention is not limited to a software implementation but may also be embodied in other forms including analog and / or digital electronic circuits . more particularly , the controller 50 writes command signals to the output generator 54 to determine , in a dual chamber device , which heart chamber is stimulated and to set the stimulating pulse timing , amplitude , duration , and morphology of the stimulating pulse . for example , the controller 50 sets the pulse delivery parameters for the purpose of charge balancing a stimulus output . the controller 50 sets the sensing sensitivity and threshold by writing attenuator settings to the preamplifier and attenuator circuit 40 , and threshold settings to the threshold register 48 , respectively . in a dual chamber device , there are separate attenuator and threshold settings for each heart chamber . the controller receives sensed signals from the delta modulator and bandpass filter 42 and governs the timing and number of intracardiac electrogram samples in addition to determining and executing any signal filtering required for signal analysis . as the controller 50 performs signal sampling , it carries out the analysis necessary for the diagnostic purposes of the pacemaker , as described below . telemetry circuit 52 provides a bidirectional link between the controller 50 of antitachycardia pacemaker 1 and an external device such as a programmer . it allows data such as the operating parameters to be read from or altered . a template matching procedure requires some means for determining when a signal of interest occurs . for template matching procedures which analyze cardiac signals , the signal of interest normally begins with a p - wave , lasts through the duration of a qrs complex and may include a t - wave . the standard timing marker for cardiac signal analysis is the r - wave of the qrs complex , which sets forth the time of ventricular depolarization . to reliably detect r - waves , the controller 50 ( fig1 ) performs an automatic procedure for setting the sensing threshold which the controller writes to the threshold register 48 ( fig1 ). the controller should set the value of the threshold so that false detections of r - waves do not occur but true r - waves are not missed . one procedure for appropriately and automatically setting sensing threshold , which may be employed in the arrhythmia control apparatus of the present invention , is described in conjunction with the flow chart of fig3 . other cardiac signal sensing schemes , which are known in the art of cardiac pacemakers , may be used in place of the following procedure . referring to fig3 there is illustrated a block diagram flow chart of an adaptive linear decaying sensing threshold procedure which may be performed by the controller 50 of fig1 . a compare - signal - with - threshold block 70 compares the amplified and delta modulated signal from the digital absolute value block 44 of fig1 with a dynamically - set sensing threshold level . if the signal is greater than the dynamic sensing threshold , then a &# 34 ; sense &# 34 ; signal is evoked which indicates the presence of natural cardiac activity . a greater - than logic block 72 controls the branching control operation in response to the comparison of block 70 . if the signal is smaller than or equal to the dynamic threshold , under the control of logic block 72 , subsequent incoming signals are compared with the dynamic threshold until the threshold value is surpassed . although a controller may perform this comparison operation and its associated control branching , in the preferred embodiment of the invention , the comparison is performed by a hardware comparator such as the digital comparator 46 of fig1 in which the sns signal output from the digital comparator is the &# 34 ; sense &# 34 ; signal . while the compare and logic operations of blocks 70 and 72 are taking place , a parallel operation of threshold adaptation is taking place . discussion of initialization of this operation takes place in conjunction with the description of start - threshold - adaptation block 92 of fig3 . the threshold adaptation procedure is delineated in the discussion of fig4 . after a &# 34 ; sense &# 34 ; signal occurs , initialize - maximum - peak - to - 0 block 74 sets the maximum peak memory location to zero to allow determination of a new maximum peak for the next cardiac cycle . in sample - signal block 76 , the controller continues to input regularly timed ( for example , 4 ms interval ) signals from the delta modulator and bandpass filter block 42 of fig1 . compare - signal - to - maximum - peak block 78 compares each incoming signal to the maximum peak and , under the control of greater - than logic block 80 , sets the maximum peak to the incoming signal in set - maximum - peak - to - signal block 82 when it is larger than the previously determined maximum peak . in next - refractory - sample block 84 , the controller determines whether the next sample will remain within the absolute refractory period ( arp ) interval ( for example , 100 ms ). under the control of a more - than - arp logic block 86 , the controller continues to sample refractory sample signals in block 76 if the refractory interval has not ended . after the refractory interval is complete , set - threshold - to - maximum - peak / 2 block 88 sets the dynamic threshold to half the maximum peak found during the refractory interval . the controller enables sensing and starts a threshold adaptation procedure in block 92 . control of the procedure returns to the compare - signal - with - threshold block 70 to complete a cardiac cycle . fig4 is a block diagram flow chart that illustrates this threshold adaptation procedure , which may be performed by the controller 50 of fig1 . the threshold adaptation procedure occurs in parallel with blocks 70 and 72 of fig3 . in wait - for - sense - or - 20 - ms block 94 , the controller waits for the &# 34 ; sense &# 34 ; signal , for example arising from the digital comparator 46 of fig1 or for a 20 ms wakeup timer ( not shown ) within the controller . if a &# 34 ; sense &# 34 ; signal occurs , the threshold adaptation procedure is finished due to its termination by the 20 - ms - or - sense logic block 96 . otherwise , upon a 20 ms wakeup , the controller tests an internal timer ( not shown ) to determine whether the heart is functioning inside or outside of a qt interval , the time when the heart is finishing its depolarization and repolarization phases . if the time is past the qt interval , qt - interval - done logic block 97 directs the threshold adaptation procedure to decrease the threshold in block 98 . otherwise , qt - interval - done logic block 97 directs the threshold adaptation procedure to return to block 94 to wait for the next sense or timer event . a physician , using a telemetric programmer ( not shown ) may set the duration of the qt interval according to the needs of a particular patient . alternatively , the pacemaker may set the qt interval duration dynamically in response to variations in the patient &# 39 ; s heart rate , wherein a higher heart rate should correspond to a shorter qt interval , within bounds set by a physician . in either case , the controller waits for the predetermined qt interval , for example 400 ms , before decreasing the dynamic threshold value by one in block 98 and then comparing the dynamic threshold value with a predetermined minimum sensing level in block 100 . if the dynamic threshold , after being decremented , is greater than the minimum sensing level , under control of logic block 102 , the controller continues to wait for a &# 34 ; sense &# 34 ; signal or the next 20 ms wakeup in block 94 . in this manner , the threshold remains constant for the predetermined qt interval after a &# 34 ; sense &# 34 ; signal , then it is decremented by one every 20 ms until either a &# 34 ; sense &# 34 ; occurs or the minimum sensing level is reached . the minimum sensing level is determined according to an automatic gain level set procedure that is discussed in conjunction with a template acquisition procedure , which is specified hereinafter . if the controller reaches the minimum sensing level , the sensing threshold remains at this value until a &# 34 ; sense &# 34 ; signal occurs , at which time the threshold adaptation procedure is repeated . referring to fig5 there is shown a block diagram flow chart of an arrhythmia detection procedure which is performed by the controller 50 of fig1 in the preferred embodiment of the invention . a select - sinus - rhythm - template block 104 acquires the template which is the basis for comparison in determining whether sensed signals indicate the presence of a cardiac arrhythmia condition . one such arrhythmia condition is ventricular tachycardia . after selection of the template in block 104 , the controller defines a template amplitude &# 34 ; window &# 34 ;, which allows for physiological variability of the cardiac signal , and stores the template in memory in store - sinus - rhythm - template block 106 . the procedures of blocks 104 and 106 are initialization procedures which are discussed in detail in conjunction with the description of fig7 hereinafter . after the initialization procedures of blocks 104 and 106 , the controller continuously performs the loop of operations in blocks 108 through 120 for subsequent cardiac cycles . each pass through this loop corresponds to one cardiac cycle . in sample - cardiac - cycle - electrogram block 108 , the controller reads a stream or sequence of incoming signal data from the delta modulator and bandpass filter block 42 of fig1 . the controller may input and store every sample for the duration of a cardiac cycle or may input only a predetermined number of samples preceding and following either the occurrence of a &# 34 ; sense &# 34 ; signal generated by the digital comparator 46 of fig1 or the location of the peak sensed electrogram signal of the cardiac cycle . after acquiring the electrogram , align - electrogram - with - template block 110 performs data alignment to &# 34 ; synchronize &# 34 ; the waveform of the incoming signal with the template waveform . a &# 34 ; best fit &# 34 ; alignment procedure determines an alignment which matches the signal and template waveforms most closely , using an area of difference ( ad ) method of comparison , according to equation 1 : ## equ1 ## where t i are the template samples , s i are the signal samples and n is the total number of samples in the template . the minimum ad corresponds to the alignment of samples in which the best fit is obtained between the signal and the template . an ad value of zero corresponds to a perfect match . signal alignment may be accomplished using other procedures . for example , the controller may align the sequences so that the maximum amplitude signal sample coincides with the maximum amplitude template sample . alternatively , the controller may align the sequences according to the timing of the sns signal generated by the digital comparator 46 of fig1 or may determine the differences between each sample and its sequentially previous sample and align the waveforms according to the maximum difference ( having a like sign ). in another alternative , the controller may align the waveforms by performing the signature coefficient ( sig ) calculation of equation ( 5 ), discussed hereinafter , and aligning the waveforms so that the maximum signature coefficient sig factors coincide . the alignment method of equation ( 1 ) was chosen , despite requiring more computations than some other methods , because it produces a superior alignment correspondence . next , the controller normalizes the electrogram amplitude in block 111 . physiological signals may vary in amplitude over time . for example , sinus tachycardia or atrial tachyarrhythmias may alter the amplitude of the ventricular signal . normalize - electrogram - amplitude block 111 compensates for such variations by comparing the sum of the absolute values of the signal samples to the sum of the absolute values of the template samples . the method of normalization is shown below in equations 2 , 3 and 4 : ## equ2 ## where s i are the signal samples after alignment with the template and t i are the current template points . this adjustment for electrogram amplitude is intended to maintain the template samples within the signature window for amplitude changes ranging from 0 . 25 to 3 times the template amplitude range . this level of variation compensates for physiological variability . after performing normalization , the controller calculates the signature coefficient sig in block 112 . signature analysis is a new template matching method . it was created in an attempt to increase the sensitivity of template matching techniques in the context of ventricular tachycardia detection while requiring only low computational complexity . signature analysis consists of defining , for each template waveform sample , a minimum and maximum amplitude value . these minimum and maximum values define the template window boundaries . fig6 illustrates an example of a template derived from a sample intracardiac electrogram signal waveform indicating a normal sinus rhythm cardiac behavior . in this example , the controller samples only a predetermined number of samples preceding and following either the occurrence of a &# 34 ; sense &# 34 ; signal generated by the digital comparator 46 of fig1 . the sampling interval τ is delineated by respective solid lines 89 and 91 preceding and following each detected r - wave 90 . the controller constructs a signature window for each sample within the sampling interval τ . a normal sampling interval τ may have a duration of 80 milliseconds . if the sampling interval of the delta modulator and bandpass filter 42 of fig1 is 4 milliseconds , the template and cardiac signal include 20 sample points . dashed lines have been superimposed on the waveform of fig6 to depict a signature window . the window height is set individually for each template sample . in the preferred embodiment of the invention , the maximum 93 and minimum 95 window boundaries are centered around the template r - wave 90 sample value and are set at plus and minus the maximum of either one - half the amplitude of the template sample or one - half of a predetermined minimum window value . the predetermined minimum window value is set to a value of about 20 % of the initial template peak . a common minimum window value is ten . amplitude windowing of the signal provides the capability to account for physiological variability in the cardiac signal . if the amplitude of a signal sample lies within the window , it is considered to be a normal physiological signal . other prior art morphology analysis methods consider any signal which is not identical to the predetermined signal to be abnormal to some degree . this is contrary to the physiological variability of the heart . the controller counts the number of signal samples falling outside the window boundaries . the greater the number of samples outside the window , the lesser the morphologic match between the template and the signal . the result of signature analysis is a coefficient called sig which the controller calculates according to equation 5 : ## equ3 ## where t cnt is the number of template samples ( or counts ) having an absolute amplitude greater than one - half the predetermined minimum window value . the controller determines and stores t cnt in conjunction with template selection and updating in blocks 104 , 106 , 120 , 142 and 144 ( fig5 ). the t cnt disregards template samples that are close to the 0 ( or baseline ) level which contain little of the information that distinguishes signals of different classes of cardiac activity . s out is the number of signal samples which fall outside the template window . the sig coefficient has a value of 1 when all signal samples are within the template boundary . sig values less than 0 may occur since s out can have a maximum value of the total number of samples in the template , while t cnt is usually less than the total number of template samples . the controller creates the template window during the select - sinus - rhythm .- template block 104 and adjusts the template window via update - template block 120 , determine - and - store - template - counts block 142 and determine - and - store - template - window block 144 . by simply counting the number of samples falling outside the template amplitude window , the method and apparatus of the present invention prevent overemphasis of the influence of large amplitude noise spikes on cardiac signal analysis . in other prior art morphology analysis procedures , a large amplitude noise spike influences cardiac signal analysis beyond its reasonable physiological importance . the method of the present invention is independent of the amplitude of noise spikes once the amplitude is greater than the maximum template window . in compare - sig - to - arrhythmia - threshold block 113 , the controller compares the calculated signature coefficient to a preset threshold level which defines a signature value at which the signal does not match a normal sinus rhythm waveform . for example , signature values consistent with normal sinus rhythm and sinus tachycardia waveforms may range from about 0 . 6 to 1 . 0 . in the preferred embodiment of the invention , the arrhythmia threshold may include an analysis of the rate at which the heart is beating . for example , the compare - sig - to - arrhythmia - threshold block 113 may include analysis of the sig coefficient when the heart is beating within one or more rate windows . at heart rates below a preset minimum ( e . g . 100 beats per minute ( bpm )) and above a preset maximum ( e . g . 200 bpm ), the controller may disable the arrhythmia detection procedure of fig5 since arrhythmias do not occur below the lower limit and ventricular tachycardia or ventricular fibrillation are definitely occurring at rates above the upper limit . at a heart rate above a highest level , a sig coefficient below about 0 . 6 may indicate the occurrence of an arrhythmia condition . at a lower heart rate , but a rate which may be indicative of the possibility of an arrhythmia condition , a sig coefficient below approximately 0 . 5 may be considered to evidence an arrhythmia condition . in the preferred embodiment of the invention , the controller compares the number of sample points falling outside the template amplitude window to a preset maximum . the preset maximum is equal to the product of the number of template samples larger than a predetermined value and one minus the sig arrhythmia threshold ( e . g . 1 - 0 . 6 = 0 . 4 ). if the number of sample points outside the template window is greater than the preset maximum , the controller initiates the control response in block 115 . if analysis of the sig coefficient or , in some embodiments of the invention , analysis of the sig coefficient in combination with heart rate , show evidence of the occurrence of an arrhythmia condition , the controller may initiate a control response in block 115 . the respond logic block 114 controls whether the controller executes initiate - control - response block 115 . in initiate - control - response block 115 , the controller may begin an arrhythmia control response such as cardioversion or one of the various known antitachycardia pacing procedures . u . s . pat . no . 4 , 406 , 287 issued to t . a . nappholz et al . on sep . 27 , 1983 , entitled &# 34 ; variable length scanning burst tachycardia control pacer &# 34 ;, and u . s . pat . no . 4 , 408 , 606 issued to r . a . j . spurrell on oct . 11 , 1983 , entitled &# 34 ; rate related tachycardia control pacer &# 34 ;, are illustrative of some of the methods of antitachycardia pacing which may be initiated by block 115 . in block 116 , the controller analyzes a predetermined criterion to determine whether to update the template . this criterion includes an analysis of the sig parameter . in the preferred embodiment of the invention , template updating takes place when sig is greater than 0 . 75 , the heart rate is less than a preset maximum ( e . g . 150 bpm ) and at least a predetermined number of cardiac cycles ( for example , 100 ) have occurred since the previous template updating operation . more or less frequent updating is possible to accommodate more or less rapidly changing physiological signals and to conserve power . under the control of update logic block 118 , the controller updates the template in update - template block 120 if the predetermined criterion is achieved , otherwise the controller samples data for the next cardiac cycle in block 108 . in update - template block 120 , the controller performs template updating to provide minor adaptation to changes in electrogram morphology which can occur over time . the controller updates each template point according to the rules of equations 6 through 8 : where s i are the most recently acquired signal samples and t i are the template samples this template updating procedure provides gradual tracking of changes in the signal morphology . after template updating , the controller again samples data for the next cardiac cycle in block 108 . although the preferred embodiment of the invention performs template updating according to the description of equations 6 , 7 and 8 , alternative methods of template updating may be used in other embodiments of the invention . in one such alternative template updating method , a group of memory locations is provided for accumulating aligned sample sequences over time . these aligned sample sequences are averaged point - by - point to produce an averaged waveform template sequence . after determining a new template sequence , the controller then analyzes the template data by counting the number of template samples having an absolute amplitude greater than the aforementioned predetermined number ( for example , 5 ) to set and store the number of template counts t cnt in determine - and - store - template - counts block 142 . in determine - and - store - template - window block 144 , the controller derives the template window by setting the maximum and minimum template window boundaries in a manner such as those disclosed previously . a block diagram flow chart of a template acquisition and storage procedure which is performed by the controller 50 of fig1 is shown in fig7 . in the preferred embodiment of the invention , a signal from an external programming device ( not shown ) activates template acquisition . wait - for - template - acquire - activate - signal block 122 waits for the instruction code from the programmer which starts template acquisition . when the controller receives the template acquisition code , acquire - electrogram - samples ,- 1 - cycle block 124 begins sampling electrogram data for the purpose of determining an appropriate gain setting for the electrogram signal . the controller performs an automatic gain control procedure in a loop of subprocedures comprising blocks 124 through 130 of fig7 . each pass through this loop corresponds to one cardiac cycle . in acquire - electrogram - samples block 124 , the controller reads a stream or sequence of incoming signal data from the delta modulator and bandpass filter block 42 of fig1 . the controller may input and store every sample for the duration of a cardiac cycle or may input only a predetermined number of samples preceding and following the occurrence of either the detection of a waveform peak or the &# 34 ; sense &# 34 ; signal which is generated by the digital comparator 46 of fig1 . in find - depolarization - peak block 126 , the controller determines the maximum signal amplitude for the cardiac cycle and compares this amplitude to a predetermined peak value . under the control of logic block 128 , if the peak signal amplitude does not meet the target criterion , adjust - gain block 130 increases the gain setting if the signal is too low to meet the desired criterion or decreases the gain setting if the signal is too large . in the preferred embodiment of the invention , the automatic gain control procedure of blocks 124 through 130 adjusts the signal amplitude control by means of control lines ctrl from the controller 50 to the preamplifier and attenuator 40 ( both of fig1 ) on successive &# 34 ; sense &# 34 ; detect signals until the depolarization peak signal is approximately 80 % of the entire positive or negative signal range . this may be done by waiting for the preamplifier gain setting to cross the value ( determined by the 80 %- of - range threshold value ) five times . when the automatic gain control procedure is complete , the controller acquires electrogram samples for subsequent cardiac cycles in block 132 and transmits this electrogram data to the programmer ( not shown ) in block 134 . the controller may send every electrogram sample to the programmer or send only those samples which occur within a time window which begins a predetermined number of samples before a &# 34 ; sense &# 34 ; signal and lasts for a preset number of samples after the &# 34 ; sense &# 34 ; signal alternatively , the controller may send a predetermined number of samples previous to and following the peak amplitude signal . the controller may then receive a control signal from the programmer in block 136 . the control signal may inform the controller to terminate the acquisition of signal data . when the controller receives a signal to terminate template acquisition , logic block 138 directs the controller to begin receiving the template from the programmer in block 140 . if the programmer does not send the signal to terminate template acquisition , the controller continues to acquire electrogram signals and send these signals to the programmer in a loop comprising blocks 132 - 138 . while the controller is sending the signal data in the loop of blocks 132 through 138 , the programmer reads this data and derives an appropriate template data sequence . the programmer may derive the template sequence in any appropriate manner . for example , the programmer may average a number of suitable waveforms to define the template . in an interactive manner , an operator handling the programmer may select an appropriate sinus rhythm template data sequence or sequences ( if waveforms are averaged ). if a particular template waveform is not suitable , the operator can restart the template selection process . the template waveform should encompass the qrs complex of an electrogram . furthermore , the template waveform should be produced from the analysis of the qrs complex of an electrogram which is characteristic of electrograms acquired when the heart is functioning in a known condition . in the preferred embodiment of the invention , the template begins 12 ms prior to the &# 34 ; sense &# 34 ; detect signal and has a duration of 80 ms . when the operator has chosen an appropriate template data sequence , the programmer sends the template samples to the controller using the telemetry block 52 of fig1 . the controller receives this data in block 140 . the controller then analyzes the template data to set the number of template counts t cnt in determine - and - store - template - counts block 142 . again , in determine - and - store - template - window block 144 , the controller sets the template window by setting the window to extend the delta value less than and greater than the template sample value . as was described in the discussion of fig5 delta is set to the larger of either half the template sample value or half the predetermined minimum window value . after performing block 144 , the controller again waits for the programmer to issue another template acquire activation signal in block 122 . it will be apparent from the foregoing description that the present invention provides a method and apparatus for performing signature analysis on acquired cardiac signals , which method and apparatus are capable of differentiating ventricular tachycardia from sinus rhythm in a patient while accepting normal physiological signal variability , and which require only low computational complexity . although this invention has been described with reference to particular embodiments , it is to be understood that such embodiments are merely illustrative of the application of the principles of the invention . numerous modifications may be made therein and other arrangements may be devised without departing from the true spirit and scope of the invention , as set forth in the appended claims .
a method and apparatus for detecting cardiac arrhythmias are disclosed . the detecting method and apparatus sense cardiac electrical signals when the heart is functioning in a known cardiac state , such as a physiologically normal cardiac state , then define and store an array of amplitude windows wherein each sample in the array of amplitude windows corresponds to a sample of the known cardiac signal . each amplitude window delineates a range of signal amplitudes bracketing the amplitude of the known cardiac electrical signal sample . the array of amplitude windows corresponds in time to periodically occurring known cardiac signal samples occurring within a predetermined time of interest . subsequently , when the heart is functioning in an unknown cardiac state , the method and apparatus monitor cardiac electrical signals by time aligning samples and comparing , on a sample by sample basis , the amplitude of unknown state cardiac signal samples with the amplitude range within the stored array of amplitude window samples . the relative number of samples falling outside the amplitude windows is the basis for analyzing cardiac signal morphology for the purpose of detecting cardiac arrhythmias .