Computerized analysis of snoring in Sleep Apnea Syndrome

Abstract The International Classification of Sleep Disorders lists 90 disorders. Manifestations, such as snoring, are important signs in the diagnosis of the Obstructive Sleep Apnea Syndrome; they are also socially undesirable. Objective The aim of this paper was to present and evaluate a computerized tool that automatically identifies snoring and highlights the importance of establishing the duration of each snoring event in OSA patients. Material and Methods The low-sampling (200 Hz) electrical signal that indicates snoring was measured during polysomnography. The snoring sound of 31 patients was automatically classified by the software. The Kappa approach was applied to measure agreement between the automatic detection software and a trained observer. Student's T test was applied to evaluate differences in the duration of snoring episodes among simple snorers and OSA snorers. Results Of a total 43,976 snoring episodes, the software sensitivity was 99.26%, the specificity was 97.35%, and Kappa was 0.96. We found a statistically significant difference (p <0.0001) in the duration of snoring episodes (simple snoring x OSA snorers). Conclusion This computer software makes it easier to generate quantitative reports of snoring, thereby reducing manual labor.


INTRODUCTION
At present, the International Classification of sleep disorders lists about 90 disorders 1 , including snoring, the obstructive sleep apnea hypopnea syndrome (OSAHS), insomnia, narcolepsy, bruxism, restless leg syndrome, and others. It is important to study these disorders, as human adults sleep about 7.5 h to 8.5 h daily.
Snoring may be defined as noisy breathing produced by vibration of soft tissues in the oropharynx 2 . Systemic arterial hypertension, heart conditions, angina, and strokes are more frequent in snorers 3 . Snoring is a relevant diagnostic sign of the obstructive apnea syndrome, as most apneic patients snore 4 . Depending on the age, up to 62% of men and 45% of women snore regularly.
Snoring is a social inconvenience; the noise makes it difficult for spouses, bed partners, or roommates to sleep. Bed partners of snorers may have poor quality sleep 5 , and may develop secondary sleep disorders 6 . A snorer may become socially unacceptable, loss of harmony in marriage, divorce, aggression, and even homicide may ensue 7 . There is evidence that people chronically exposed to snorers tend to have presbycusis (age-related hearing loss) 8 .
Polysomnography is the gold standard in the diagnosis of respiratory sleep disorders. At present, technicians in sleep clinics that offer polysomnography describe snoring subjectively -patients are described as non-snorers, moderate snorers, or snorers. In a few cases, an electric recording of snores is made; in this case, technicians may manually identify and classify snoring events during polysomnography. This method is time-consuming, expensive, and inconsistent.
The treatment of snoring consists of behavioral measures, CPAP, and surgery. Monitoring of these cases is generally subjective -done by the spouse or partner.
A few researchers have measure the intensity of sound 9 , the energy of sound, and the zero passage rate 10 to quantify snoring more objectively and automatically, and to associate it with OSAHS. However, these values depend on the microphone, the amplifier, the A/D converter, and the distance between the patient and the microphone. Furthermore, the signal energy intensity may vary with time in the same patient 10 .
A few voice recognition techniques have been applied in the detection of snores and OSAHS; these include 500 Hz sub-band energy distribution analysis 11 , the Hidden Markov Models (HMM), a statistical technique to model, classify, and segment samples of a time series 12 , and Linear Predictive Coding 13 . These algorithms require snoring sounds to be recorded at a sampling rate above 7500 Hz 4,14 .
Most of the polysomnography devices in Brazil do not record or count snoring events. However, these devices generally have extra channels that are not used.
Although these channels do not record snoring sounds (because of their low sampling rate -usually from 256 Hz to 2,000 Hz), electrical recording of snores may be done by using those extra channels. A low-cost piezoelectric microphone in contact with the skin and connected to a low sampling rate may be used to make an electrical recording of snores. This is not done, however, because it is complex to manually identify and quantify snoring events recorded in polysomnography.
It is reasonable to develop an open source computer code for quantifying snoring based on a low sampling rate electric signal because electric recordings of snores can be made using the installed base in polysomnography laboratories -therefore without major costs or changes in routines -and especially because information about the quality of snoring is relevant for clinical practice and science.
Several researchers have correlated snoring and its intensity [15][16][17][18] ; however, few studies have investigated the importance of the duration of snoring events in patients with or with no apnea, possibly because this information is difficult to extract and quantify.
The purpose of this paper is to introduce a tool that automatically identifies snores, to underline the importance of quantifying the duration of each snoring event in OSAHS patients, and to point out other events that may be found in the signal and that may contaminate the electric snoring signal, such as voice, coughing, and other artifacts.

Description of the study population
The study sample in this preliminary study comprised 31 patients that presented 43,976 snoring events. Each patient underwent a single polysomnography. Exams were carried out in Sao Paulo at night from April 2009 to May 2009. The exam was done from 10 p.m. to 6 a.m. The age of subjects ranged from 5 to 64 years (mean -41 years). The percentage of male subjects was 74% (23/31), and the percentage of female patients was 26% (8/31). The institutional review board of UNIFESP approved this study (no. 0896/08).

Polysomnography
Cardio-respiratory and electroencephalographic recording were made with a BrainNet BNT-POLI device (EMSA -Equipamentos Médicos, Brazil) running the Captacoes proprietary software (data acquisition) and the Poliwin software for evaluating the exams. Acquisition and evaluation of polysomnography was done based on the American Sleep Disorders Association instruction guide. Recording were made of the following channels: EEG (electroencephalogram), ECG (electrocardiogram), EOG (bilateral electrooculogram), EMG (electromyogram), belts measuring chest wall and abdominal wall movements, nasal air flow by thermistor, oxygen saturation, and the equivalent electric snoring signal.
Sleep parameters were taken from the official report; confidentiality of the information was respected.

Recordings of snores
The original recordings of snores were made using a small (about 5 mm diameter) common microphone with a 50-16,000 Hz response frequency, which was attached to the skin of the neck with Micropore ® adhesive tape (3M ® ). All signals, including snoring signals, were fed into a analog/digital converter with a 200 Hz sampling rate (each channel has 200 points or samaples per second).
The digital values were saved as a file; the contents of this file were organized as a proprietary protocol (.plg) defined by EMSA, a Brazilian manufacturer of medical devices.

Computer program (algorithm) -snore detector
A Hsu algorithm 19 was used in detecting snores and quantifying the duration of each event. This algorithm consists of four steps: 1. The snoring signal is sampled in 100 ms windows ( Figure 1; Figure 2); 2. The effective value of each 100 ms window is computed ( Figure 3); 3. A low-pass filter (moving-average filter) is applied using a 10-sample delay window ( Figure 4); 4. A time series was made to define whether the electric signal generated in step 2 was compatible with snoring. This analysis identifies the beginning and the end of the snoring event. With this information (beginning and end) we calculated the duration (T duration ) of the electric event. If the duration (T duration ) of the event was within 0.6 to 2 seconds, it was classified as snoring. If an electric event did not match the duration (0.6 to 2 seconds), it was marked as a probable non-snoring event. Spurious sounds, such as voice or coughing, may contaminate these recordings and generate undesired events or artifacts.
The abovementioned algorithm was implemented in MatLab. The result of the algorithmic classification was fed into the JBioSignal Viewer software.

JBioSignal Viewer -validating the automatic snore detector
A biological signal viewer was developed in Java ® (Oracle) -within the Eclipse ® (IBM) development environment -so that trained observers could validate electric     events as snoring or non-snoring). Figure 5 shows a screen of the JBioSignal Viewer.
The JBioSignal viewer marks in green (rectangle) if the algorithm classified an electric event as snoring (R); non-snoring events are marked black (NR).
All snores and artifacts detected by the algorithm were validated objectively by a trained observer, using the JBioSignal viewer, to assess the automatic snore detector.
During the evaluations, if the algorithm classified an event as a snore (green rectangle), but the trained observer considered it non-snoring, the observer was able to change the mark by clicking twice (from snore to non-snore); in this case, the rectangle became red. A mark in red indicated a difference between the algorithm (that identified a snore) and the observer (that identified a non-snore).
If the algorithm classified an event as a non-snore (black rectangle), but the trained observer considered it a snore, the observer could change the mark by clicking twice; in this case, the rectangle became purple. A mark in purple indicated a difference between the algorithm (that identified a non-snore) and the observer (that identified a snore).
To reduce uncertainty when making a visual judgment on the automatic detector, trained observers applied the following inclusion criteria to validate a given electric event as a snore: 1) The electric event (snore) should be in phase with the nasal airflow signal, and the signals from the belts measuring chest wall and abdominal wall movements. Figure 6 shows snoring events in phase with nasal airflow, and chest wall and abdominal wall movements; 2) The shape of the snoring signal should fit into the pattern marked by the rectangle in green, as in Figure 6; 3) The duration of snores should be within 0.6 to 2 seconds; 4) The signal amplitude should be at least double that of silence. Figure 6 shows this ratio; 5) Patients should be sleeping, a condition which was assured by taking into account the hypnogram of the medical report when making a visual judgment.
Trained observers validated each snore (S) that was classified as such by the automatic snore detector. If any of these four criteria were not met, the event was considered a non-snore (NS).
An isolated electric event that fit into the five criteria was defined as a non-snore (NS), as shown in Figure 7.

Statistics
Results were expressed as percentages, means, and standard deviation. We used variables with a normal (Gaussian) distribution when applying the parametric test (Student's t test).
The confidence interval throughout the study was 95% (and α=0.05).
The comparison between the computer system and the trained observer was coded as True Positive (TP), False Positive (FP), True Negative (TN), and False Negative (FN).
The kappa (K) value was applied to measure the agreement between the computer system and the trained observer.

Defining the groups -primary snorers and snorers with OSAHS
After trained observers using the JBioSignal Viewer validated all exams, we separated each event that was classified as a snore into two groups. One group consisted of primary snorers in which the apnea/hypopnea index (AHI) was below 5; the other group consisted of snorers with OSAHS (AHI ≥ 5).
It should be noted that the total number of snoring events was the sum of events classified by the algorithm (TP) added to the snores that were classified as such by trained observers (FN). The duration of each snoring event was shown in the JBioSignal Viewer. Table 1 shows the descriptive statistics of each variable in this study. Table 2 presents a comparison of classifications made by trained observers and the computer algorithm. There were 43,976 snores; the sensitivity of the computer program was 99.26% (ranging from 89.74% to 100%), the specificity was 97.35% (ranging from 59.57% to 99.74%), the accuracy was 98.24%, the positive predictive value was 97%, and the negative predictive value was 99.34%. The agreement between the computer system and trained observers was 0.96 (kappa). Table 3 shows a descriptive analysis of the duration of snoring episodes (in seconds), separated into two groups: a group of obstructive sleep apnea syndrome patients and a group of primary snorers.

Duration of snoring episodes in obstructive sleep apnea patients
The t test was applied in both groups to check for mean differences in the duration of snoring episodes. The result was a statistically significant difference (p<0.0001).

DISCUSSION
This study presents a description and evaluation of an algorithm to detect snoring episodes during sleep by applying a time analysis of electric signals that are equivalent to snoring sound signals.
In recent years, several researchers have analyzed snoring sounds under the same light as voice recognition because of their physiologic similarities and available digital processing and analytical methods. The analogy between snoring and voice stems from their common origin in the vocal tract 20 . However, voice recognition techniques have not been widely adopted in clinical practice. Pevernagie 4 argues that the acoustic analysis of snoring is still in its initial phases as medical science, and few techniques are applicable in the clinical setting. Karunajeewa 13 applied linear predictive coding (LPC), zero passage rates, signal energy, and normalized correlation coefficient for segmenting and classifying sound signals to detect snoring and neglect silence and other types of signals. This computer algorithm attained 90.74% accuracy.
Cavusoglu's 11 algorithm applied 500 Hz sub-band energy distribution in segments (or samples) of the snoring sound signal and attained 97.3% accuracy in primary snorers and 86.8% in OSAHS patients. Duckitt 12 applied Hidden Markov Models (HMM) and attained 89% accuracy.
These abovementioned techniques require a high sampling rate (>7500 Hz) to process snoring sounds. The algorithm presented here consists of a time analysis (T dura-tion ) used the snoring electric signal (in 31 patients) at a low sampling rate (200 Hz) to attain 96% accuracy compared to the gold standard (trained observer). This is evidence that electric signal processing -even at a low sampling rate -may be used in detecting snores automatically.
An issue when validating snores manually is that its definition varies among observers. Hoffstein 17 showed that it was difficult to objectively define and quantify snores because of the subjective perception of listeners. These authors reviewed 25 polysomnographies (all lasting the entire night and recording snores). Snoring sounds were simultaneously recorded on a cassette tape and paper. An experienced polysomnography technician objectively counted the number of snores during 20 minutes of examination time. Two other polysomnography technicians listened to the snores and counted their perception of snores. The results revealed that in 7 of 25 patients, the difference between the first technician (objective counting of snores) and the other two technicians (subjective counting of snores) was over 25%. In another group, the difference among technicians in 7 of 25 patients was over 25%. The kappa agreement among listeners was 0.49 (moderate). Hoffstein concluded that judging snoring events is highly subjective.  Subjective perception -snorer  In our study, the agreement between trained observers and the computer system was 0.96 (kappa), a significant agreement. This finding suggests that automatic snore detection techniques may be adopted in clinical practice, even if the sampling rate of the electric signal of snoring is low.
A 0.96 kappa value is evidence that a computer system may perform the role of human observers (the polysomnography technician) for classifying snoring episodes. Agreement among humans -which is the gold standard -reaches a kappa agreement level of only 0.49 (moderate).
We found that the mean duration of snoring events in OSAHS patients was shorter compared to plain snorers, as shown in Student's t test (p<0.0001). This finding suggests that shorter snoring events in OSAHS patients should be carefully investigated.

CONCLUSION
The algorithm presented above may be applied in the following clinical tasks: 1) Automatically identifying, using a low sampling rate, electric signals that are equivalent to the snoring sound signals.
2) Monitoring the progression of therapy for respiratory sleep disorders, in particular snoring, using statistical comparisons before and after treatment.
As is often the case in polysomnography clinics, the reports describe only subjective impressions made by technicians during the exam (intense snoring, moderate snoring, and mild snoring). This algorithm facilitates generating quantitative reports based on electric recordings of snoring; it is reproducible, reliable, potentially useful, and reduces manual labor and costs. OSAHS with AHI >=5 (information extracted from the official report) Primary snorers with AHI < 5.