The invention relates to continuous positive airway pressure (CPAP) respiratory therapy apparatus for treatment of apnea, hypopnea and other sleep disorders, and particularly to a control for the CPAP apparatus. A blower is connected through a hose and a mask, such as a nasal mask or a nasal cannula, to the patient's respiratory airway. An air flow sensor and an air pressure sensor are located at the blower end of the hose. Optionally, a vent valve also may be located at the blower end of the hose. The sensor outputs are used to estimate the air pressure at the mask and the air flow sensor output is used to determine the gross air flow to the hose, the patient air flow and the occurrence of patient snoring. The air flow sensor output also is used to generate a square wave breathing signal. The breathing signal may be used by a microprocessor to control the optional vent valve to establish different levels in the applied pressure during inspiration and expiration. The applied CPAP pressure may be increased in response to the detection of apnea and hypopnea events. The microprocessor detects and ignores mask leaks, open mouth breathing and exhale puff breathing.