Research ArticleOPIOID OVERDOSE

# Opioid overdose detection using smartphones

See allHide authors and affiliations

Science Translational Medicine  09 Jan 2019:
Vol. 11, Issue 474, eaau8914
DOI: 10.1126/scitranslmed.aau8914

## Preventing overdose

Opioid addiction and overdose remain serious health concerns in the United States. Naloxone can reverse opioid overdose but requires timely intervention. Toward this goal, Nandakumar et al. converted a smartphone to detect changes in respiration that precede opioid overdose. Using sonar, the smartphone detected respiratory depression and apnea (temporary lack of breathing) in humans after self-injected drug use in a supervised injection facility. Respiratory changes during general anesthesia, which simulates opioid-induced overdose, were also detected in a clinical setting. This proof-of-concept overdose detection device is encouraging; further optimization, including integrating an alert system to notify local emergency medical services of detected overdoses, would be necessary.

## Abstract

Early detection and rapid intervention can prevent death from opioid overdose. At high doses, opioids (particularly fentanyl) can cause rapid cessation of breathing (apnea), hypoxemic/hypercarbic respiratory failure, and death, the physiologic sequence by which people commonly succumb from unintentional opioid overdose. We present algorithms that run on smartphones and unobtrusively detect opioid overdose events and their precursors. Our proof-of- concept contactless system converts the phone into a short-range active sonar using frequency shifts to identify respiratory depression, apnea, and gross motor movements associated with acute opioid toxicity. We develop algorithms and perform testing in two environments: (i) an approved supervised injection facility (SIF), where people self-inject illicit opioids, and (ii) the operating room (OR), where we simulate rapid, opioid-induced overdose events using routine induction of general anesthesia. In the SIF (n = 209), our system identified postinjection, opioid-induced central apnea with 96% sensitivity and 98% specificity and identified respiratory depression with 87% sensitivity and 89% specificity. These two key events commonly precede fatal opioid overdose. In the OR, our algorithm identified 19 of 20 simulated overdose events. Given the reliable reversibility of acute opioid toxicity, smartphone-enabled overdose detection coupled with the ability to alert naloxone-equipped friends and family or emergency medical services (EMS) could hold potential as a low-barrier, harm reduction intervention.

## INTRODUCTION

Fatal opioid overdose remains a public health epidemic in the United States (16). Each day, 115 Americans die from opioid overdose, and data from the U.S. Centers for Disease Control and Prevention indicate that the epidemic is worsening (79). Unlike many life-threatening medical emergencies, opioid toxicity is readily reversed with rapid identification and administration of the overdose antidote naloxone or supportive respiratory care (1013). Thus, a fundamental challenge of fatal opioid overdose events is that victims die alone or among untrained or impaired bystanders, with insufficient timely diagnosis and treatment (14). To help connect potential overdose victims with widely available life-saving interventions, we developed algorithms for commodity smartphones that unobtrusively recognize opioid overdose by its physiologic precursors. Our software system, which runs as an application on smartphones, converts the phone into a short-range active sonar system using frequency shifts to identify respiratory depression, apnea, and gross motor movements associated with acute opioid toxicity. By creating overdose detection algorithms that can be used on devices that most high-risk individuals already own (15, 16), we hope to provide a harm reduction system that can automatically connect with naloxone-equipped friends and family or emergency medical services (EMS) to help prevent fatal overdose events (17, 18).

A mobile system that can detect opioid overdose precursors and events in real time does not currently exist because of both design and validation challenges. Existing, human-based approaches to diagnose overdose rely on medical-grade equipment or trained recognition of diagnostic signs of opioid toxicity (1923). Achieving similar sensing capabilities on smartphones, without the need for medical-grade equipment, is challenging because it requires tracking physiological parameters unobtrusively and without violating participant privacy (24, 25). In addition, validating the efficacy of any opioid toxicity system requires access to patients and data while high-risk opioid use occurs, which is difficult because this can represent a medically life-threatening situation. We overcome these challenges with an active sonar-based monitoring solution, leveraging access to two unique environments where people routinely experience overdose-related respiratory physiology without harm: (i) a legally sanctioned supervised injection facility (SIF), where people self-inject previously obtained illicit opioids under medical supervision, and (ii) the operating room (OR), during routine induction of general anesthesia.

Here, we describe a contactless smartphone-based system that matches the performance of an invasive respiratory impedance monitor in identifying three critical overdose precursors: opioid-induced respiratory depression, central apnea, and simulated overdose events (19, 26, 27). We show that a smartphone running our application placed within 1 m of a subject can monitor the subject during the postinjection period. This is the highest risk time for a fatal overdose event and the period during which a potential overdose victim would most benefit from rapid diagnosis and resuscitation.

## RESULTS

### Concept and algorithms

Our system uses frequency-modulated continuous waveform (FMCW) and converts the smartphone’s native speaker and microphone into a short-range active sonar system (2834) that allows for portable measurement of chest motion and respiration using inaudible acoustic signals. The phone continuously transmits a custom, inaudible, FMCW where the transmitted frequency increases linearly with time between 18 and 22 kHz within a duration of 10 ms (Fig. 1, A and B). These custom acoustic signals reflect off a surface (in this case, a moving chest during respiration), and the echo arrives back to the smartphone’s microphones after a time delay, ∆t, corresponding to the distance of the reflector from the smartphone. The time delay (∆t) is given by 2dvs, where d is the distance of the human body from the smartphone and vs is the speed of sound in air. When the subject’s chest moves because of breathing, the distance (d) to the smartphone and the corresponding time delay of its echo (∆t) at the microphone change. Because the frequency of the FMCW signals increases linearly over time, each of their time delays (∆t) translates to a unique frequency shift (∆f) in the reflected signals. Hence, we can measure the changing distances due to breathing motion by observing the frequency shift caused by the echo over time. The periodicity of the changes generates sinusoidal waves, the peaks of which correspond to a complete breathing cycle (Fig. 1C). A peak detection algorithm then identifies the maximum amplitude of the wave, which enables determination of a subject’s respiratory rate and the presence of apnea.

Our system builds from previous work using active sonar to detect sleep apnea (28); however, the opioid use case differs from the sleep environment in several fundamental ways. First, breathing motion is diminished during opioid use, which can complicate respiratory peak detection. In addition, subjects may be under the influence of opioids when they initiate a subsequent use event and thus may have a diminished breathing signal at that time. Unlike the sleep laboratory used in previous work, which is a controlled environment with a lone subject who is primarily stationary, subjects using opioids may have increased motion that can affect the time delay of the echo, may engage in high-risk opioid use behaviors in the presence of others, and are generally in a much less-controlled environment, which introduces other sources of potential interference (35, 36). The SIF where our experiments were performed is a highly dynamic and stimulating environment; recording devices are prohibited within the SIF, but the environment can be observed in a public domain report (37). For example, there are routinely several people around; there is talking among clients; staff and clients walk around; overhead music plays; and occasionally, personal dogs are within the environment. In addition, there is climate control equipment and a special indoor ventilation system (to remove the smoke from heroin preparation), all of which produce ambient noise. In short, there are several environmental elements in the high-risk opioid use domain that differ from the controlled setting of a sleep laboratory.

We developed algorithms that address these challenges. Our algorithm uses FMCW to disambiguate the reflections at different distances from the smartphone, the resolution of which is about 0.7 cm with a typical microphone sampling rate of 48 kHz. Thus, the algorithm can separate the subject’s breathing signal from other movements in the environment that occur at a different distance (for example, those of an opioid-using companion). In addition, by tracking the distance corresponding to the subject’s breathing signal, the algorithm automatically recalibrates when a posture change occurs or when the subject or phone changes position. Figure 2 demonstrates benchmark performance across phone models (Galaxy S4, S5, S6, iPhone 5S, Google Pixel, and Nexus), phone orientations, subject distance and posture, and various environmental noise and motion conditions.

### Real-world illicit opioid use (SIF)

We deployed our system in Vancouver, BC, within an approved SIF. Although our primary targeted algorithm user is a person who uses opioids when alone (the demographic at highest risk for fatal overdose), we chose the SIF environment because it facilitates safe, real-world testing and algorithm development based on actual opioid self-injection events. Acute, life-threatening overdose events requiring medical intervention remain relatively uncommon in this environment, occurring in less than 1% of opioid use events (about 500 supervised injections occur per day in the facility) (38). Therefore, our primary outcomes of interest were postinjection central apnea (cessation of breathing for 10 s or longer) (27) and opioid-induced respiratory depression (respiratory rate ≤7 breaths per minute) (39, 40), both of which are necessary precursors to lethal opioid intoxication events.

We recruited participants over 209 self-injection instances (194 unique participants): 115 injection events were used as a development set, and 94 were used as an evaluation set to measure algorithm performance (Table 1). Sixty-four participants (68%) reported using heroin, 19% reported using fentanyl, and 13% reported using morphine or hydromorphone. After injection, 83 participants (88.3%) experienced a decrease in respiratory rate during the monitored postinjection period (fig. S2); 47 participants (50%) experienced clinically important respiratory depression; 49 participants (52%) experienced at least one postinjection central apnea event; and 8 participants (8.5%) had a manual intervention by clinical staff, of which 2 participants (2.3%) experienced an overdose event requiring clinical resuscitation (oxygen, bag-mask ventilation, and/or naloxone therapy). Both overdosed participants were successfully resuscitated by the clinical staff without issue.

Table 1 Demographic summary of participants in algorithm evaluation (SIF and OR).

SIF, supervised injection facility; OR, operating room.

View this table:

The smartphone-based system identified postinjection central apnea events (cessation of breathing for 10 s or longer) with 95.9% sensitivity [95% confidence interval (CI), 86.0 to 99.5%] and 97.7% specificity (95% CI, 88.2 to 99.9%). The system had 87.2% sensitivity (95% CI, 74.2 to 95.1%) for identifying postinjection respiratory depression (respiratory rate 7 breaths per minute) and 89.3% specificity (95% CI, 76.9 to 96.4%; Fig. 3, B to E).

Figure 4A shows the distribution of the number of central apnea events per participant, as identified by our system. Forty-five of the 94 participants (48%) had no central apnea events, all of whom had no interventions by staff. Among those who experienced a postinjection central apnea event, 71% had one to two central apnea events during the 5-min postinjection monitoring period. Figure 4B is a histogram of the durations of these central apnea events. The plot shows that 66% of central apnea events were ≤20 s in duration. We also note that both overdosed participants had a central apnea event of at least 30 s before clinical intervention.

### Simulated overdose detection (OR)

A key limitation of the SIF environment is the limited occurrences of overdose events requiring clinical resuscitation. To address this, we deployed our system in the OR. This controlled environment allowed us to safely simulate the worst-case scenario of acute opioid toxicity: immediate loss of consciousness coupled with respiratory depression that would be fatal or critically morbid without intervention. Such conditions are safely reproduced during routine induction of general anesthesia (Fig. 5A) when patients receive fentanyl and other anesthetic drugs.

We recruited for 35 instances of simulated overdose (34 unique participants): Data from 15 patients were used as a development set to generate the algorithm, and 20 were used as an evaluation set to validate algorithm performance. Results from the evaluation cohort are presented (Table 1 and Fig. 5B). In the evaluation set, as expected, all 20 patients experienced true overdose physiology, characterized by postinjection loss of consciousness and diminished or absent breathing. Our algorithm identified 19 of the 20 simulated overdoses as having disordered breathing. Of the 19 correctly identified patients, 18 patients experienced sustained apnea (terminated per protocol after 30 s), and 1 patient had severely diminished breathing that the algorithm identified as an overdose. The one patient who was incorrectly classified had a breathing signal just above the algorithm’s threshold. In each case where the algorithm correctly identified the overdose event, it detected the onset of respiratory failure similarly to the real-time reference standard (Fig. 5B). We note that specificity is not meaningful in this environment because all participants experience the simulated overdose event (all patients undergoing induction of general anesthesia lose consciousness and experience depressed breathing) (41).

## DISCUSSION

Here, we used a commodity smartphone to run an algorithm to identify opioid overdose precursors. Overdose events are readily reversible with early detection. In the setting of real-world, high-risk opioid use, our results highlight the need for a multitiered interactive phone-based alarm system that escalates or de-escalates based on user feedback. We do not envision the phone-based system alerting a third party or disturbing the user based on an isolated central apnea or respiratory depression event; rather, an alert should be sent only after a subject is unable to respond to a stimulus from the phone after a sustained central apnea or respiratory depression event, representing a potentially life-threatening overdose. Evaluating such a multitiered system would be the next step in enabling an end-to-end overdose detection system using commodity smartphones.

Our study has several limitations. Healthy participants recruited for the OR experiments are likely different from the eventual intended user population. We chose this healthy population in the OR setting for reasons of safety and algorithm development for the worst-case scenario of acute opioid overdose (which is safely reproduced in an OR environment). External validity was addressed by testing in the SIF with participants who are more likely to use the application as it is eventually intended. It is beyond the scope of this study to seek and recruit subjects who use high-risk opioids alone or to conduct our study procedures in a participant’s personal environment outside of the InSite facility. In addition, development of a harm reduction intervention does not ensure adoption and use. For harm reduction interventions to be efficacious, further studies with participant feedback and human factor testing are needed to ensure that the system meets the needs, values, and preferences of people who use opioids, in addition to establishing the system’s safety vis-à-vis its potential to encourage moral hazard. Other harm reduction interventions such as take-home naloxone programs have been found not to increase risky behavior or lead to adverse health consequences (4244). Previous data on harm reduction interventions show that people are willing to engage in behaviors to help keep themselves safe, such as using needle exchanges, take-home naloxone, face shields for mouth-to-mouth respiratory support, and SIFs (4547).

Our benchmark tests highlight that accuracy is best achieved using the phone within 1 m, with the phone oriented at 90° from the subject and away from a separate loud speaker. Formal evaluation of a subject’s ability to comply with these recommendations is an important area of further inquiry.

Another potential concern is whether the system could reliably alert prehospital EMS providers in a time frame that enables successful resuscitation with naloxone or supportive respiratory care. On the basis of historical data from Seattle, King County, involving fatal overdose events and average EMS response times, we believe that a meaningful EMS integration is possible (fig. S1). Such a program would need to incorporate the detection algorithm’s performance characteristics to leverage the operations and resources of a given EMS system. Any integrated program must also acknowledge that, even with rapid connection to EMS, victims could still experience morbidity and mortality after opioid overdose (48).

In summary, we developed a proof-of-concept system that can be implemented on commodity smartphones and can identify simulated and real-world opioid overdose events and their precursors. As a harm reduction intervention, such a system could connect people experiencing potentially fatal overdose events with known life-saving interventions (naloxone-equipped friends, family, shelter personnel, or EMS) in real time. As the number of deaths attributable to opioid overdose continues to rise, new strategies are needed to help mitigate the risk of death and disability from this public health epidemic. One key tool to reverse these events is naloxone, which is increasingly available to first responders (including police) and to people through take-home naloxone programs and is now endorsed by the U.S. government (49). In addition to its use by EMS providers, the administration of naloxone by trained friends and family has been shown to be a safe and effective means of reversing overdose (13, 50). However, neither EMS, friends, nor family can intervene with naloxone or supportive respiratory care in an emergency if they are not immediately aware that an overdose is taking place. Noninvasive self-monitoring via smartphone, as we have described, could address this critical shortcoming and may represent an easily accessible strategy to help keep people safe until they are able to access long-term treatment.

## MATERIALS AND METHODS

### Study design

We investigated the accuracy of a smartphone-based software system for identifying opioid-induced respiratory depression, central apnea, and simulated overdose events. Ground truth (gold standard) measurements were taken with a respiratory impedance monitor. In both the SIF and the OR, a development set was used to develop the algorithm and an evaluation set was used to prospectively evaluate algorithm performance. To demonstrate feasibility, we chose to stop recruitment after >200 instances of illicit opioid self-injection. In the OR, because the algorithm was highly sensitive in detecting sustained apnea after induction of general anesthesia, we did not pursue beyond 35 participants. Randomization was not applicable, and investigators were not blinded. All participants provided informed consent, and the studies were approved by the University of Washington Institutional Review Board (IRB), the University of British Columbia Office of Research Ethics, and the Vancouver Coastal Health (VCH) Ethics Services (VCH operates the SIF, InSite).

### Active sonar detection of breathing signals

Our system transmits FMCW signals and analyzes the frequency shifts resulting from human motion. The frequency shift, from which the respiratory rate is derived, was determined by performing a fast Fourier transform (FFT). We chose an FMCW chirp period of 10 ms, which gives a frequency resolution of 100 Hz. The unique challenge with opioids acting on the central nervous system is that breathing motion can be severely depressed. For our FMCW signal with a 4-kHz bandwidth, this minute motion can translate to a frequency shift less than 8.33 Hz. To extract this, we perform an FFT over 15 consecutive chirps, which linearly increases the frequency resolution to 6.66 Hz and thus captures even severely depressed breathing motion, down to a chest movement of 0.7 cm. By taking an FFT over 15 chirps, any high-frequency motion within this duration is averaged and hence lost. However, because the average breathing rate of human subjects is less than 20 breaths per minute, which is a relatively low-frequency motion, no breathing motion is lost within the 150-ms FFT duration.

To extract the breathing signal, the algorithm first estimates the distance of the person’s chest from the smartphone over time. The breathing signal is present in a unique frequency bin corresponding to this distance. To identify this bin, the algorithm starts by looking from the 18-kHz bin (corresponding to distance zero, directly in front of the phone) and proceeds to 18.320 kHz (corresponding to a distance of 1 m away from the phone). For each bin, it examines changes in the power value over a duration of 30 s by performing a second FFT over it. If a peak between 0.5 and 0.7 Hz (the typical breathing frequency of a human) is observed, then that bin corresponds to the breathing signal. Therefore, the second FFT occurs until the bin that corresponds to the breathing signal is found. In the worst-case scenario, the system may iterate through 48 bins before isolating the breathing signal. Once found, the signal recurs within the same bin as long as the subject remains in place. However, when a subject moves, the bin corresponding to the distance has a motion signal instead of breathing. In this scenario, the system reinitiates the search for the new bin containing the breathing signal. In particular, if the distance of the subject from the smartphone changes, then we estimate the new distance by computing the bin corresponding to the breathing after the motion.

### Detecting opioid-induced depressed breathing

Breathing motion is diminished when people use opioids. To overcome this, we make two changes to the peak detection algorithm. First, to remove any small motion noise, we run the data through a bandpass decimating Cascaded integrated comb filter. The filter removes any motion noise higher than a frequency of 1 Hz and also decimates the signal by a factor of 2. Second, we collect a baseline breathing signal for a duration of 1 min before the self-injection event. From the baseline collection period, the algorithm calculates the subject’s average peak amplitude, peak prominence, and average peak distance. These parameters are used to identify the peaks during postinjection monitoring. For the baseline signal, the algorithm leverages the periodicity of the breathing signal and the frequency limits of the breathing signal (less than 20 breaths per minute) to estimate breathing peak parameters. Specifically, only peaks that are separated by a minimum of 20 samples (corresponding to a maximum breathing rate of 20 breaths per minute) are considered. During postinjection monitoring, we combine this condition along with the average peak parameters that we estimated in the first step. Peaks separated by a minimum of 20 samples that have an amplitude of at least 50% of the baseline and 30% of the peak prominence are classified as breathing peaks. If the number of peaks is less than or equal to seven, then the epoch is marked as a respiratory depression event. If the distance between the peaks is greater than 10 s, then we mark a central apnea event. If the number of breaths in the epoch is at least greater than three, then we update peak amplitude, peak prominence, and distance values with the combined average of new peak values. If a specific peak is twice as great as the average peak values, then the system does not use that peak in average peak parameter computations.

### Differentiating breathing from motion

Because subjects’ faces and hands are close to their chests and are about at the same distance from the smartphone, the change caused by motions of these body parts can be added to the breathing signal in its frequency bin during the primary algorithm’s FFT operation. Moreover, this motion has higher amplitude compared to the more subdued breathing motion and can overpower the breathing signal, making it difficult to extract the breathing motion. Although such motion noise would typically be problematic, the presence of motion provides additional information about the subject. Specifically, sustained motion indicates that the subject is active and not overdosed. Similarly, motion that is followed by breathing indicates that the subject is active and thus not overdosed. On the other hand, motion within the operational range that is followed by an absence of breathing likely indicates an overdose scenario. Hence, we modify the algorithm to differentiate between a signal corresponding to periodic, low-frequency breathing motion and one that belongs to high-frequency body motion, which is aperiodic and high amplitude. We identify this by looking at the peaks in the second FFT operation of the 30-s signal corresponding to each bin. If the peaks have higher frequencies and an amplitude at least twice that of the breathing frequency peaks, then the instance is classified as a motion epoch. If the motion is absent or present only for a few seconds, then the algorithm considers it to be a breathing signal and processes it to identify the respiration rate.

### Distance recalibration

When we encounter a motion epoch, the distance of the subject with respect to the smartphone can change. Hence, after every motion epoch, we need to run the recalibration step to detect the frequency bin that corresponds to the new distance of the subject from the smartphone. When we encounter the first motion epoch, we set the motion bit to 1 and examine the next epochs. For subsequent epochs, we search all the nearby FFT bins until we detect the bin that has the breathing signal. We then use this new bin for the next set of epochs until we see the next motion epoch. For the first breathing epoch after the motion epoch, we update the peak parameter values to the average values of the new epoch corresponding to the new distance of the subject.

To review, we first filter the recorded signal using a high-pass filter to remove audible environmental noise. We then split the data into 30-s epochs and run the distance estimation step described above on the first epoch to identify the bin that contains the breathing signal. We estimate average breathing peak amplitude, peak distance, and average peak prominence for this epoch. For subsequent epochs, we check the same frequency bin in the distance estimation algorithm. If it contains the breathing signal, then we use the previously estimated amplitude and prominence values to determine the breathing peaks in this epoch and subsequently update them with the new peaks of the current epoch. This continues until the bin contains a motion signal instead of breathing signal. If the subsequent epoch does not contain the breathing signal and instead contains the motion signal (high amplitudes, more peaks), then we mark it as a motion epoch and run the recalibration step for the subsequent epochs until we find the new breathing signal.

### Suppressing environmental motion

High-risk opioid use commonly occurs as a group activity, which introduces another source of potential interference (35, 36). In this case, the interfering subject’s breathing or motion may change the received echoes at the smartphone. However, because the interfering subjects will mostly be located at different distances with respect to the smartphone, their breathing motions (as determined by the primary FFT operation) would occur at different frequency bins than that of the subject of interest. Assuming that the smartphone is closest to the intended subject, namely, within 1 m, the first frequency bin containing the breathing signal likely corresponds to the breathing motion of the intended subject. The algorithm therefore filters out any breathing detected at farther distances.

### Computational complexity

In the worst case, our algorithm performs 54 FFT computations per second and one linear peak estimation algorithm. Such operations can each be computed within tens of milliseconds on an off-the-shelf smartphone (51, 52). This delay is within the expected human response time (for visual overdose identification) of a few seconds. Last, on the basis of the duration of high-risk opioid self-injection events, we expect the application to run for less than 45 min per day and not more than 15 min per event. The algorithm’s computations along with the sensor data collection consume 6 to 18% of a phone’s battery power for this duration. In addition, most fatal overdose events occur within a private residence, hotel, or motel (53), which should have an available power source.

### Statistical analysis

We used standard analyses to assess the respiration rate measurements of the smartphone-based system against the reference measurements from the impedance monitor. In particular, we assessed the accuracy using scatter and bubble plots equipped with trend lines. To determine the accuracy of the opioid overdose precursor detection algorithm, we used standard techniques to calculate sensitivity (true positive rate) and specificity (true negative rate) and we report Clopper-Pearson CIs around these estimates. For all the benchmark experiments, we compute the bias error (μ, mean of the errors) and precision error (σ, SD of the errors) to compare the respiration rate measurements of our system against the standard impedance monitor.

## SUPPLEMENTARY MATERIALS

www.sciencetranslationalmedicine.org/cgi/content/full/11/474/eaau8914/DC1

Materials and Methods

Fig. S1. Connecting overdose victims with EMS.

Fig. S2. Postinjection respiratory rate decrement.

Table S1. InSite institutional overdose indicators.

Table S2. Benchmark testing and individual data for Fig. 2.

Reference (57)

## REFERENCES AND NOTES

Acknowledgments: We thank our participants and the clients of InSite. We acknowledge J. Buxton, R. Joe, and C. Banta-Green for facilitating access to InSite in Vancouver, BC. We also thank A. Gee, S. Blawatt, and K. Scott for assistance with participant recruitment. We thank S. Kaplan, S. Sharar, M. Crowder, P. Morgan, S.-I. Lee, and L. Ceze for critical feedback on the manuscript. We also thank M. Sayre, J. Hood, T. Rea, and C. Clasen for providing data and insight on fig. S1. Last, we thank V. Iyer for assistance with conducting experiments in Vancouver, BC, and J. Chan for help with formatting the figures. Funding: This work was supported by the Foundation for Anesthesia Education and Research (FAER), the National Science Foundation (1812559), and the UW Alcohol and Drug Abuse Institute (ADAI). Author contributions: All authors designed the experiments, interpreted the results, and wrote the manuscript. R.N. conducted the experiments and performed the analysis with technical supervision by S.G. R.N. and S.G. designed the algorithms. J.E.S. conceptualized the study. Competing interests: All authors are inventors on U.S. provisional patent application no. 62/675560 (submitted by the University of Washington), which is related to this work. All authors have equity stakes in Sound Life Sciences, Inc., which is related to the technology presented in this manuscript. S.G. is a paid consultant to Jeeva Wireless Inc. and Edus Health, Inc. Data and material availability: All data necessary for interpreting the manuscript have been included. Code is available with a noncommercial license; contact license{at}uw.edu.