An active medical device that is able to detect and treat ventiliatory
activity disorders during sleep. This device measures the patient's
respiratory activity, delivers a signal of the ventiliatory activity of
the patient, analyzes the ventiliatory activity signal, and detects the
occurrence of hypopneas. The analysis includes calculating at regular
intervals a sliding average of the signal of ventiliatory activity,
comparing the values of the successive sliding averages thus calculated,
and detecting an occurrence of an hypopnea when, for two successive
sliding averages, the difference between the averages crosses a
predetermined threshold of comparison. When the device is one that also
delivers cardiac stimulation pulses, it is advantageously envisaged to
modify an operating parameter, in particular the stimulation rate based
on the detected hypopnea, to treat the hypopnea.