Acoustic Respiratory Phase Detection on Mobile Devices

Julian Szymanski, Tomasz Sankowski, Piotr Sulewski, Iwo Czartowski, Javier Medina QueroarXiv 2026 · arXiv

TL;DR

This paper introduces a non-invasive framework for tracking breathing phases in real-time using nothing more than a standard smartphone microphone. By combining a CNN for local feature extraction with a Transformer for long-range temporal modeling, the authors achieved 99.2% cycle-level detection efficiency on unseen subjects with a privacy-preserving, on-device inference latency of under 20 ms.

What Problem Does This Paper Address?

Monitoring respiratory rate (RR) is a cornerstone of health tracking, stress management, and guided meditation. However, most reliable methods today are "contact-based," requiring specialized hardware like spirometers or chest straps. While acoustic monitoring via smartphones is a promising alternative, it has historically struggled with two major hurdles:

  1. Environmental Noise: Background sounds and irregular breathing patterns often trip up traditional signal-processing methods.
  2. Generalization: Models trained on one person often fail on another due to high inter-patient variability in acoustic signatures.

The authors aim to bridge this gap by creating a robust, deep-learning-based system that works in uncontrolled domestic environments without needing subject-specific calibration.

Methods

The researchers developed a hybrid CNN–Transformer architecture designed to process 44.1 kHz monophonic audio. The pipeline consists of several sophisticated stages:

  • Feature Extraction: Raw audio is converted into Mel-spectrograms. A key engineering choice here was the use of asymmetric pooling (kernel size 2x1). Unlike standard symmetric pooling, this reduces dimensionality along the frequency axis while strictly preserving temporal resolution—crucial for pinpointing the exact boundaries of a breath.
  • The Hybrid Model: A CNN acts as a "local" feature extractor, which is then fed into a 6-layer Transformer Encoder. The Transformer uses self-attention to capture the cyclic, rhythmic nature of breathing over a 3.5-second sliding window.
  • Classification Strategy: The team compared a binary model (Exhale vs. Background) against a ternary model (Inhale, Exhale, Silence).
  • Deployment: To ensure privacy and real-time performance, the model was exported via ONNX, allowing for fully offline inference on mobile devices with a latency of less than 20ms.
Fig. 1. The proposed hybrid architecture. Data flows through the CNN feature extrac- tor, is augmented with positional encoding, and processed by the Transformer Encoder.

Datasets

The study utilized two distinct datasets to test generalization:

  1. Foundation Dataset: Recordings from three male researchers (822 breathing cycles). This was used for Leave-One-Subject-Out (LOSO) cross-validation.
  2. Independent Unseen Dataset: A more diverse set featuring 13 participants (ages 14–52) and over 1300 breathing cycles recorded in uncontrolled domestic settings. This dataset is particularly valuable as it tests the model's ability to handle different ages, genders, and recording distances.

Key Insights and Ideas

  • The "Frame vs. Cycle Paradox": One of the most interesting findings was that higher frame-level accuracy doesn't always mean better breathing rate estimation. While the 2-class model had higher raw accuracy, it frequently "fragmented" phases (splitting one breath into several).
  • Ternary Modeling as a Regularizer: Explicitly modeling the entire sequence (Silence → Inhale → Exhale → Silence) acted as a structural regularizer. Even if an inhalation was faint, the Transformer used the surrounding context to "anchor" the exhalation detection, leading to much more stable cycle counting.
  • Temporal Context is King: Context-free models (like standard CNNs or Feed-Forward networks) saw their performance plummet to ~60% on unseen subjects. The Transformer’s ability to "wait" for a rhythmic pattern to confirm a state transition was the key to its robustness.

Key Results

The 3-class Transformer model emerged as the clear winner for practical use:

  • Cycle Detection: It achieved a 99.2% exhalation detection efficiency on the independent unseen test set.
  • Accuracy: On the unseen dataset, it reached 76.94% frame-level accuracy with a Cohen’s Kappa of 0.651, significantly outperforming context-free baselines.
  • Respiratory Rate Precision: The model achieved a Mean Absolute Error (MAE) of just 0.93 BPM, with 90% of predictions falling within a ±2 BPM margin.
Table 1. LOSO cross-validation results comparing frame-level accuracy and cycle-level exhalation detection efficiency.
Table 2. Frame-level performance on the Independent Unseen Dataset (13 subjects, 2 hours). Accuracy is given as mean ± standard deviation over N = 1000 bootstrap samples, together with the 95% confidence interval.

Limitations and Future Work

Despite the strong results, the authors note several areas for improvement:

  • Demographic Bias: The initial training (Foundation) dataset was limited to three young males. While it generalized well to the 13-person test set, larger and more diverse training cohorts are needed.
  • Nose-Only Breathing: The current dataset focuses exclusively on nasal breathing; mouth breathing or speech interference remains a challenge for future iterations.
  • Ground Truth: The "gold standard" used was manual annotation of audio. Future studies should validate against clinical-grade reference sensors (like chest straps) to quantify annotation uncertainty at phase boundaries.
  • Expanded Scope: The authors suggest this architecture could be extended to detect other acoustic events like coughing or snoring, or even combined with smartphone IMU (motion) data for even higher accuracy in noisy environments.

Summary updated

Abstract

Breathing monitoring is important for well-being, stress regulation, and guided breathing exercises, yet existing approaches often rely on contact-based sensors or controlled environments. This paper presents a non-invasive framework for respiratory phase detection using acoustic signals recorded on commodity smartphones. The proposed hybrid CNN-Transformer architecture combines local spectral feature extraction with long-range temporal modeling to capture the cyclic structure of breathing. The model is evaluated using a Leave-One-Subject-Out (LOSO) protocol on the Foundation Dataset and on an independent unseen test set comprising over 1300 breathing cycles and 2 hours of continuous recordings. The proposed 3-class formulation achieves 72.85% frame-level accuracy and 96.6% cycle-level exhalation detection efficiency in the LOSO evaluation, while achieving 76.94% frame-level accuracy, a Cohen's Kappa score of 0.65, and 99.2% cycle-level exhalation detection efficiency on the unseen test set. Results suggest that accurate respiratory monitoring may be achievable under data-constrained conditions, indicating that appropriate temporal modeling can learn transferable respiratory representations and generalize to previously unseen participants. An end-to-end ONNX deployment pipeline enables privacy-preserving on-device inference with latency below 20 ms, supporting real-time monitoring on mobile and wearable devices.
BibTeX
@misc{szymanski2026acoustic,
  author = {Julian Szymanski and Tomasz Sankowski and Piotr Sulewski and Iwo Czartowski and Javier Medina Quero},
  title = {{Acoustic Respiratory Phase Detection on Mobile Devices}},
  year = {2026},
  eprint = {2611.16710},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.16710},
}
Figure