Closed-loop system to enhance slow-wave activity

Objective. Recent evidence reports cognitive, metabolic, and sleep restoration benefits resulting from the enhancement of sleep slow-waves using auditory stimulation. Our objective is to make this concept practical for consumer use by developing and validating an electroencephalogram (EEG) closed-loop system to deliver auditory stimulation during sleep to enhance slow-waves. Approach. The system automatically detects slow-wave sleep with 74% sensitivity and 97% specificity and optimally delivers stimulation in the form of 50 ms-long tones separated by a constant one-second inter-tone interval at a volume that is dynamically modulated such that louder tones are delivered when sleep is deeper. The system was tested in a study involving 28 participants (18F, 10M; 36.9  ±  7.3 years old; median age: 40 years old) who used the system for ten nights (five nights in a sham condition and five in a stimulation condition). Four nights in each condition were recorded at-home and the fifth one in-lab. Main results. The analysis in two age groups defined by the median age of participants in the study shows significant slow wave activity enhancement (+16.1%, p  <  0.01) for the younger group and absence of effect on the older group. However, the older group received only a fraction (57%) of the stimulation compared to the younger group. Changes in sleep architecture and EEG properties due to aging have influenced the amount of stimulation. The analysis of the stimulation timing suggests an entrainment-like phenomenon where slow-waves align to the stimulation periodicity. In addition, enhancement of spindle power in the stimulation condition was found. Significance. We show evidence of the viability of delivering auditory stimulation during sleep, at home, to enhance slow wave activity. The system ensures the stimulation delivery to be at the right time during sleep without causing disturbance.


Introduction
Although the precise function of sleep remains to be elucidated, it appears that sleep primarily benefits the brain [1]. Rapid eye movement sleep (REM) and non-rapid eye movement sleep (NREM) cyclically alternate with a periodicity of approximately 90 min. NREM sleep includes lighter stages N1 and N2 and deep sleep N3 (also known as slow wave sleep). During NREM cortical neurons are bistable alternating between 'up' and 'down' states with an approximate periodicity of one second. This bistable pattern results in large amplitude oscillations (slow-waves) which are particularly prominent during N3 sleep and can be observed in the electroencephalogram (EEG) (see figure 1).
According to a recently proposed hypothesis (synaptic homeostasis hypothesis SHY), plastic processes occurring during wakefulness result in a net increase in synaptic strength in many cortical circuits [2]. As a consequence, when cortical neurons begin oscillating at low frequencies during sleep, these oscillations become strongly synchronized leading to the occurrence of large slow-waves in the EEG. The hypothesis also states that slow-waves in sleep do not only reflect synaptic strength, but also play a functional role to 'renormalize' or downscale synaptic strength to a baseline level that is energetically sustainable and beneficial for cognitive performance.

Sleep-wake regulation and slow waves
Two processes play a dominant role in sleep regulation: a sleep independent circadian process (Process C) closely related to cyclic metabolic and endocrine processes and a sleep-dependent process (Process S). Process S characterizes sleep-need which builds up during wakefulness and dissipates during sleep [3].
The dynamics of sleep-need dissipation (process S) is linked to the temporal variation of the absolute sleep-EEG power, in the 0.5-4 Hz band which is referred to as slow-wave activity (SWA) [3]. SWA quantifies the number and amplitude of slow-waves [2] and has a typical behavior throughout the cyclic variations of a sleep night: SWA increases during NREM sleep, declines before the onset of REM sleep, and remains low during REM. The peak level of SWA in successive sleep cycles is progressively lower (see figure 1).
The rate of sleep-need dissipation (equation (1)) is proportional to SWA during NREM sleep [3][4][5]. The proportionality constant γ > 0 is the sleep-need decay rate which is personspecific and can be estimated by fitting a first-order polynomial through the local maxima of the SWA curve [6].
where S(t) and SWA(t) are respectively the sleep-need and slow wave activity at time t. Taking the integral of equation (1) from sleep onset (referred to as t 0 ) to an arbitrary time t results in: t t0 dS(t) = t t0 −γ · SWA(t)dt, where S 0 is the (initial) sleep-need at the beginning of the sleep session. The integral of the SWA from sleep onset t 0 until time t is referred to as cumulative SWA and noted as CSWA(t). Equation (2) shows that the decrease in sleep-need S 0 − S(t) is proportional to CSWA(t) which can be visualized as the area under the SWA curve (see figure 1 right).

Effect of slow wave sleep on cognitive performance and subjective sleep quality
Sleep plays an important role in memory consolidation [7][8][9] by promoting specific patterns of neuromodulatory and electric activities. Sleep slow-waves are more synchronized following intense declarative learning [10] and better retention of declarative memories occurs after slow wave sleep than after a wakefulness control interval [11]. Topographically localized increases of SWA can be observed in brain areas previously activated by a learning task during wakefulness. The increase in SWA after learning correlates with improved performance in the task after sleep [12]. Moreover, selective slow wave sleep deprivation applied without affecting sleep time or efficiency prevents improvement in performance after visuo-motor and visuo-perceptual tasks. These suggest a casual role for sleep slow-waves in the sleep-dependent improvement of cognitive performance.
Slow wave sleep also plays a positive role in subjective sleep quality [13][14][15][16][17] as it was found that subjective quality relates to continuity (sleep efficiency) and depth of sleep which is directly related to SWA.

Slow wave enhancement
Motivated by the essential role of slow-wave sleep on cognition and sleep restoration, multiple methods to enhance slowwave sleep have been proposed. Pharmacological agents can increase the time in slow wave sleep but fail to benefit memory consolidation [18] and may cause residual daytime effects. Thus, alternative strategies relying on peripheral (electric, magnetic, or sensory) stimulation have been developed [19].
Transcranial direct-current stimulation (tDCS) and transcranial magnetic stimulation (TMS) have been successfully applied during slow wave sleep to enhance SWA and memory consolidation [20][21][22]. TMS applied during NREM triggers slow-waves that are indistinguishable from naturally occurring ones [22]. However, the long-term effect of repeated exposure to either tDCS or TMS is unknown [23] making it preferable to enhance sleep slow-waves in a less invasive manner using sensory stimulation.
The effect of somatosensory and auditory stimulation on SWA was investigated in [24]. Auditory stimulation appeared to be most effective in enhancing slow-waves. High density EEG analysis of the effect of auditory stimulation showed that the morphology, topography, and propagation patterns of enhanced slow-waves were indistinguishable from those of spontaneous slow-waves observed during natural sleep [23].
Continuous auditory stimulation in the form of tones presented at a rate of 0.8 Hz starting during wakefulness just before sleep and continuing for about 90 min into sleep resulted in an EEG power increase in the 0.5-1 Hz band [25]. Related studies [26,27] report that auditory stimulation  delivered through tones in phase with the ongoing rhythmic occurrence of slow-wave up-states (see figure 2 inset) substantially enhances slow-waves, phase-coupled spindle activity, and, consequently, the consolidation of declarative memory. Stimulation out of phase with the ongoing slow waves appeared ineffective.
In-phase stimulation [28] was applied in an older population (60-84 age range) using a phase synchronized loop method [29]. Blocks of five tones (ON periods) were followed by equally long blocks without stimulation (OFF periods). SWA increased in ON periods compared to OFF periods and the increase correlated with overnight improvement in memory consolidation (word pair recall test). However, the effect of auditory stimulation on memory seems to be specific to verbal associative memory [30].
Research on slow wave enhancement based on auditory stimulation has been mainly performed in-lab except for the work reported in [31] which presents a consumer sleep device that can deliver stimulation in the home environment however the increase in SWA due to the stimulation has only been reported to occur transiently, i.e. during stimulation or few seconds after.
In this study we examine the effect of stimulation on SWA throughout NREM sleep and in particular the CSWA increase which according to equation (2), should result in a more efficient dissipation of sleep-need. The study was performed at home and in-lab in order to compare results and validate feasibility of consistent SWA enhancement outside the controlled laboratory condition.

Closed-loop system to deliver auditory stimulation during slow wave sleep
A sleep wearable system was developed for this study which monitors sleep by processing the EEG signal acquired from a frontal location in real-time (Fpz; as per the 10-20 standard [32]). The reference electrode is on the right mastoid (M2). The system also records two (right and left) electrooculogram signals (EOG) which, together with the EEG, are used for manual sleep staging. The right EOG electrode is positioned above the right eyebrow and the left EOG electrode is positioned on the left outer canthus.
An adjustable headband holds the Fpz electrode, the EOG electrodes and the speakers. Processing of the signals is performed in an integrated unit with an embedded micro-processor connected to the headband (see figure 2).
The EEG signals are acquired at 1000 Hz, high-pass filtered using a single pole filter (0.3 Hz cutoff frequency), notch filtered at 50 Hz and 60 Hz to remove power-line noise, and down-sampled to 100 Hz for real-time processing. Two notch filters are applied to ensure processing consistency across the different geographical locations were the device is being used. EEG and EOG signals are stored in the internal memory for subsequent (offline) analysis and SWA computations.
Detection of sleep micro-arousals (μ-arousal) and 'wake' state is accomplished by detecting periods for which alpha or beta RMS values exceed predefined thresholds. The thresholds have been selected following an exhaustive parameter optimization procedure (using previously recorded data [33] with manual μ-arousal annotation) that aimed at maximizing the μ-arousal detection accuracy. If the alpha or beta RMS values exceed the thresholds for a period lasting 10 s or longer, then the system detects 'wake'; otherwise a μ-arousal is detected. The presence of a μ-arousal delays the onset of the next auditory stimulation by 15 s or stops stimulation in the case of ongoing stimulation.
Slow-wave sleep (N3 sleep) is detected if delta RMS exceeds a predefined threshold and if the number of detected slow waves in a 20 s-long sliding window exceeds six. Periods not detected as wake or deep sleep, are flagged as light sleep. RMS and slow-wave thresholds in the system were set to ensure high deep sleep detection specificity (⩾95%) and moderately high sensitivity (⩾70%) so the stimulation could be delivered when sleep is sufficiently deep such that the likelihood of disturbing sleep is minimized. The results in table 1 confirm the appropriate choice of parameters.
Slow-waves (see figure 2 bottom-right) are detected in real-time by detecting negative-going zero-crossings and comparing the amplitude of the most prominent negative peak following the first zero-crossing to a detection threshold (−40 μV). If the amplitude of the negative peak is lower than the threshold, then the positive-going zero-crossing is detected. If the duration of the interval defined by both zero-crossings is in the 200-800 ms range, then the event is detected as slow-wave.
If deep sleep is continuously detected and sleep-depth (logratio between delta and beta powers) exceeds a predefined threshold, then auditory stimulation is delivered. The threshold was set considering the average sleep-depth dynamics reported in [33]. Auditory stimulation consists of 50 ms long tones separated from each other by a fixed one-second intertone interval. The volume of each tone was linearly modulated by sleep-depth (see figure 2 bottom-left) such that louder (or softer) tones were played during deeper (or shallower) sleep. The volume versus sleep-depth relationship was the same for all participants in the study. For the lower sleep-depth threshold (d m = 5) the volume was set to V m = 20 dB-SPL, and for the higher sleep-depth (d M = 9) threshold, the volume was set to V M = 65 dB-SPL. For convenience, in the rest of this article all references to dB-SPL are simply noted as dB. Stimulation ceases if the sleep stage transitions from N3 to another sleep stage or a μ-arousal is detected. When stimulation resumes (or starts for the first time), the timing of the first tone is adjusted such that it is delivered during the up-state of a detected slow-wave. This is accomplished by setting a 200 ms delay (corresponding to a fifth of a second-long slowwave) for delivery of the first tone following the detection of the positive going zero-crossing.

Study design
Thirty-seven healthy volunteers with a self-restricted sleep duration pattern characterized by average sleep duration between 5 and 6.5 h and average weekend sleep duration at least an hour longer than that of weekdays were recruited for this study. Regular bedtimes, i.e. deviating from the average bedtime by at most a ±1 h was required for the study. Out of the thirty-seven participants, 28 completed the study (18F, 10M; 36.9 ± 7.3 years old). The study was approved by the Western Institutional Review Board (WIRB).
The participants used the device for a period of two weeks with a week of washout in between. To verify their sleepwake schedule, starting a week before the beginning of and throughout the duration of the study, actigraphy was monitored. Participants used the device at home for four nights (Monday-Thursday) followed by a night (Friday) in the sleep lab.
Subjects were randomly assigned to either a Sham or Stimulation condition for week 1, followed by the other condition during the week after the washout week. The sham condition differed from the stimulation condition only in the fact that the volume of the stimulation in the former was set to 0 dB. Additional daytime outcomes were collected each day following study nights. The detailed analysis of these is the focus of a follow-up article. This paper focuses mainly on the analysis of the EEG data.

Analysis of EEG data to estimate SWA
The EEG stored in the device was analyzed (offline) using manual sleep staging as reference. Manual staging was performed by an expert sleep technician using both the EEG and EOG signals. Following standard rules, a sleep stage was assigned for each 30 s-long window [34]. For the analysis of SWA, six-second-long NREM epochs (including N2 and N3 sleep) were considered. Every 30 s-long window was subdivided into five epochs and the sleep stage of the window was assigned to every epoch.
The SWA of each epoch was estimated from the epoch's power spectrum density (PSD) by integrating over the frequency range spanning from 0.5 to 4 Hz. The PSD per epoch was estimated according to the Welch method [35] with a foursecond long Hanning window (ensuring 0.25 Hz frequency resolution), a two-second-long overlap, and 1024 points to calculate the Fourier transform.
Sleep μ-arousals were also annotated according to standard rules [34]. Since μ-arousal events have spike-like temporal characteristics that manifest as high values in the spectral domain, epochs containing annotated-arousals were discarded from SWA analysis. The average SWA was calculated by taking the average slow-wave activity over all considered NREM epochs while total SWA (CSWA) was calculated by adding SWA over all considered NREM epochs (see equation (2)).

Real-time automatic sleep staging
The normalized confusion matrix (i.e. its columns add up to 100 so they can be interpreted as percentages) associated with the real-time automatic sleep staging algorithm is shown in table 1 for all participants and for two participant subsets (groups): (a) younger than 40 years old, and (b) 40 years old or older. The groups were defined considering the median age of participants in the study.
The analysis was performed in two age groups given the significant effect of age as suggested by the results reported in tables 3 and 4. Furthermore, age is a known factor that influences sleep architecture, the EEG spectrum, and slow-wave properties [36][37][38].
Given the focus on detecting periods of sufficiently deep sleep to deliver stimulation, three sleep states have been considered for this analysis: wake, 'light' sleep (which aggregates REM, N1, and N2 sleep), and deep sleep (N3 sleep). The sensitivity and specificity of N3 sleep detection which were estimated from the confusion matrix are respectively 74% and 97% for all participants. The high N3 specificity value is particularly important to ensure that the stimulation is only delivered when sleep is deep enough.
The analysis of the tone timing distribution per manually scored sleep stage resulted in 95.99% of tones delivered in N3 sleep, 3.8% in N2, 0.02% in N1, 0.01% in REM, and 0.18% in wake.
The accuracy of the automatic μ-arousal detection was quantified with respect to the manual annotation performed by the sleep technician. Sensitivity and specificity for μ-arousal detection are 97% and 30% respectively. High sensitivity of μ-arousal detection even if this entails low specificity, is essential to minimize the likelihood of disturbing sleep with the stimulation.

Sleep architecture
Sleep architecture including total sleep time (TST), sleep latency (SL), duration of sleep stages (N1 to N3 and REM), and WASO (duration of wake after sleep onset) are reported in table 2 for both sham and stimulation conditions and for the two age groups described in the previous section.
In addition to sleep architecture, the following measures are also reported: the number of manually annotated μ-arousals, the average duration of N3 bouts (i.e. continuous segments of N3 sleep), and the number of delivered tones. In the sham condition, the tones have a volume of 0 dB such that they are effectively not delivered but their number is reported here to compare the stimulation opportunity between conditions. Non-parametric, paired Wilcoxon tests were used to analyze statistical significance. Given that comparisons were performed in two age groups, Bonferroni-based [39] corrections were applied and the corresponding adjusted p-values are reported in table 2. Table 2 does not report any significant but only trending differences between conditions for N1 sleep (longer in the stimulation condition for the younger group) and N3 sleep (shorter in the stimulation condition for the older group). Even if the latter may suggest a disturbing effect of the stimulation on N3 sleep duration, more direct correlates of sleep disturbance such as the number of annotated μ-arousals and the average N3-bout duration (which reflects the degree of N3 sleep fragmentation) are not different between sham and stimulation conditions.

Slow-wave activity
The effect of the stimulation on both the average SWA (see table 3) and CSWA (see table 4) was analyzed using mixed effects models with the participant identifier being the random effect, while condition (Sham or Stimulation), and age are the fixed effects. This type of analysis ensures the effect of the stimulation is first analyzed within each participant's sleep sessions and then across the results of all participants. Age was considered a factor here because of significant changes in sleep architecture [36], spectral properties of the EEG during sleep [37,40], and in particular slow-wave activity [38] and NREM sleep fragmentation [41] as a result of aging.
Both tables 3 and 4, show that the stimulation significantly increases SWA (p < 0.01) and CSWA (p < 0.001). However, the effect decreases with age as the interaction term between the stimulation condition and age is significant for both models.
The grand average temporal dynamics of SWA and CSWA along with the number of tones per minute and volume are shown in figure 3 for both conditions and age groups. The temporal axis represents the number of minutes from sleep onset (t = 0). Averages were first obtained at the subject level. The resulting mean subject-level dynamics were then averaged to obtain the grand averages shown in figure 3. The time of sleep onset was used as reference to align the curves of individual sleep sessions and to calculate the averages. The bottom panel represents the average volume for the stimulation condition only because the volume in sham is zero.  For the younger group, the increase in SWA that eventually leads to significant increase in CSWA is more prominent in the first sleep cycle, which corresponds to the period where most of the stimulation was delivered (25 tones min −1 ). Given that the volume of the stimulation is modulated according to sleep-depth (see section 2), the stimulation volume in the first cycle is the loudest. In subsequent sleep cycles the average  volume decreases as direct consequence of the volume modulation. The volume can fall below audible levels which limits the amount of stimulation without requiring extra timing parameters to limit the stimulation to the first few hours after sleep onset as proposed in [42]. The lower average volume values (<20 dB) and low number of tones per minute shown in figure 3 (particularly in late sleep cycles) result from averaging across a set of heterogeneous sleep architectures and inter-subject variability.
SWA and CSWA distributions across subjects are shown in the left and right boxplots of figure 4 respectively. The average increase in SWA (+16.1%, p < 0.01) and CSWA (+30.2%, p < 0.05) in the stimulation condition are significant for the younger group, whereas in the older group, there are no significant differences between conditions for either SWA or CSWA.

Timing of the stimulation
Adjusting the time of the stimulation to coincide with a slowwave up-state has been suggested as the most optimal strategy to maximize slow-wave enhancement [26,29]. In this study, only the timing of the first tone in a sequence was adjusted to match a slow-wave up-state (see section 2). However, given the regular inter-tone interval (1 s) associated with the stimulation, brain activity may be entrained by that oscillation [23].
The time-locked average, event-related potential (ERP) analysis, taking the timing of the tone as reference was performed for both sham and stimulation conditions as shown in the lower panel of figure 5. The ERP analysis shows a clear effect of the stimulation given the significantly higher amplitude of the stimulation ERP compared to that of the sham condition. The morphology of the ERP curve resembles that of a slow-wave with the up-state interval approximately spanning from −200 to +300 ms.
The distribution of the tone timing with respect to the positive going zero-crossing of slow-waves was estimated by matching each tone to the closest detected slow-wave. The upper panel of figure 5 shows the distribution of the tone distance to the closest slow-wave along 100 ms-long bins for both sham and stimulation conditions. The distribution shows that in the stimulation condition most of the tones occur during a slow-wave up-state. This suggests an entrainmentlike phenomenon where slow-waves align to the periodicity of the auditory stimulation and they do so by synchronizing their up-state to the tone.
It has been hypothesized that the positive effect of stimulation on memory consolidation [26,28] is mediated by enhancement of spindle activity (11)(12)(13)(14)(15). Indeed, according to the active system consolidation model [8], sleep spindle events reflect hippocampus-to-neocortex transfer of information.
To analyze the effect of the stimulation on the spindle frequency band, the time-frequency analysis of the EEG surrounding a tone (event related spectral perturbation [43] or ERSP) was performed. The resulting ERSPs are shown in figure 6 for sham (top panel) and stimulation conditions (middle panel). The difference-ERSP obtained by subtracting the sham ERSP from the simulation ERSP is shown in the lower panel of figure 6. The enhancement in the delta band is clearly visible in the stimulation ERSP. Enhancement of the spindle activity in the stimulation condition can also be observed.

In-lab versus at home
The effect of the recording place (in-lab versus home) was analyzed and as expected, the signal quality quantified by the signal-to-noise ratio and electrode impedance is significantly better for the in-lab sleep recordings compared to the homebased recordings. However, the signal to noise ratio in the home-based recordings was high enough to enable the analysis of SWA and CSWA. The latter did not show any significant difference between in-lab and home-based recordings, suggesting the viability of delivering auditory stimulation during sleep using an automated EEG based system intended for home use.

Discussion
Applying peripheral (sensory, magnetic, or electric) stimulation during sleep to enhance sleep has received substantial attention in the last few years. The validation of the concept and testing of benefits in multiple cognitive domains has primarily taken place in the sleep lab environment under controlled conditions. To make this concept practical for consumer use, we have developed an integrated closed-loop sleep-wearable system that monitors the sleep EEG, detects the periods when stimulation can be safely applied, and automatically modulates the properties of the stimulation to enhance slow wave activity. This article presents in detail the algorithms utilized in this system and reports the results of a cross-over randomized trial that was conducted at home and in-lab.
The process of adjusting the parameters of the algorithm used data from a few hundred overnight sleep recordings performed with the integrated system. Manual sleep staging of these recordings was performed by expert sleep technicians. A guiding principle throughout the system design has been to deliver stimulation without disturbing sleep. Since the stimulation is delivered in deep sleep,this requirement translated into high N3 sleep detection specificity (>95%) and high μ-arousal detection sensitivity (>95%). Both have been successfully achieved by the algorithm as the N3 detection specificity and μ-arousal detection sensitivity were both 97%. Furthermore, this resulted in 96% of the tones being delivered in N3 sleep.
Sleep dissipates sleepiness and according to the two process model of sleep/wake regulation, the rate (or speed) of sleep-need dissipation is proportional to SWA. This directly implies that the total amount of dissipated sleep-need associated with a sleep session corresponds to the mathematical integration (i.e. accumulation or summation) of SWA throughout the sleep session. Therefore, we have designed our algorithm and stimulation timing to enhance total accumulated SWA (CSWA) to maximize the restorative value of sleep.
Numerous studies have shown that auditory stimulation during sleep influences brain activity. In fact, local SWA increase in response to auditory stimulation has been observed for different stimulation types including: synchronizing the tone timing to coincide with a detected slow-wave up-state, and delivering the stimulation in blocks, i.e. tone sequences lasting for a few seconds followed by equally long breaks.
CSWA is however not increased unless the stimulation is continuously delivered. For instance, in the block stimulation modality, SWA increases during 'ON' blocks and decreases during 'OFF' blocks which results in a net CSWA value that is no different from that in sham nights [28]. In the in-phase stimulation modality, CSWA is not significantly higher in the stimulation condition compared to sham [26].
The results presented in this paper suggest that for the specific algorithm and parameters implemented in the device, continuous stimulation significantly increases CSWA but the extent of the increase is moderated by age. Segmenting the study participants into two equally sized groups according to the median age (40 years old) confirms the fact that age plays a significant role in the extent of CSWA enhancement due to stimulation (see figure 3). However, the amount of stimulation in the older group is half that in the younger group (third panel from the top in figure 3). In fact, the algorithm's N3 detection sensitivity in the older group is substantially lower (67%) compared to that in the younger group (79%) as shown in table 1. This suggests that the absence of effect reported here for the older group could be resolved by adapting the parameters of the algorithm such that the amount of stimulation matches that of the younger group.
Sleep architecture is not significantly affected by the stimulation (see table 2). For the older group the duration of N3 sleep is shorter (p = 0.08) in the stimulation condition. This could suggest a sleep-disturbing effect of the stimulation. However, the analysis of μ-arousals and N3 sleep continuity reveals no differences between both conditions. For the younger group, the duration of N3 sleep in the stimulation condition is 10 min longer but non-significant. Prolongation of N3 sleep resulting from enhancing slowwaves was reported in [44] suggesting a sleep stabilizing role of the stimulation To understand the effects on sleep architecture, further research with a higher number of sleep sessions per condition is required. The device presented in this paper which can be used at home for prolonged periods of time enables this type of research.
Rather than relying on a fixed volume level for the stimulation (30-35 dB in [28] and 40 dB in [31]), our algorithm automatically adjusts the volume depending on sleep-depth in the 20-65 dB range. This ensures the stimulation to be at a louder volume when sleep is deeper. In addition, this type of modulation effectively limits the stimulation to periods where sleep is sufficiently deep without requiring additional rules such as limiting the time interval where stimulation can be delivered as suggested in [42]. The analysis of stimulation timing with respect to detected slow-waves shows synchronization of the tones with the upstate of slow-waves suggesting an entrainment like phenomenon of cortical activity in response to the stimulation. Synchronizing the stimulation with the up-state of detected slow-waves is believed to be optimal for slow-wave enhancement. Our strategy of delivering tones with a one-second-long fixed inter-tone interval appears to favor synchronization of slow-waves which during NREM sleep have a natural periodicity of approximately 1 s. Validation of the entrainment hypothesis would, however, require applying various intertone intervals in a selected range and analyzing the timing of slow-waves and brain activity synchronization. This is planned as a focus of future research activities.
A limitation of this study is the use of generic algorithm parameters that were applied to all participants. Sleep architecture and EEG change according to demographic factors [36][37][38] (age and gender) and are even thought to reflect unique traits [45,46] at the individual level. This suggests that the parameters of the algorithm can be optimized depending on demographic and individual factors.
An additional limitation is the fact that the analysis of the effect was performed using the signals (EEG and EOG) recorded by the system which cannot be considered as standard sleep montage. Jointly recording standard polysomnography (PSG) data is not practical at home and can be better performed in-lab. We have addressed this limitation in a subsequent sleep study where the device and PSG data are simultaneously recorded and for which the public report is in preparation.

Conclusion
We have developed an integrated closed-loop sleep-wearable system that monitors the sleep EEG, detects the periods when auditory stimulation can be applied to enhance SWA, and automatically modulates the properties of the stimulation to optimize the effect without causing any sleep disturbance.
This system was tested in a cross-over (sham and stimulation conditions), double-blind study that was conducted at home and in-lab. We found a significant SWA enhancement effect in the stimulation condition that was moderated by age. Indeed, the younger group defined by the median age of study participants experienced a significant (+16.1%) SWA enhancement due to stimulation.