Skip to content
Sounak GhoshXR Designer & Creative Technologist
All work

Wellness XR

Brain Candy: Breath Detection for VR Breathwork

A breath-detection system for Brain Candy's Breathwork DLC on Meta Quest — it reads inhale, exhale and hold from the headset's own motion, with no extra hardware.

Breath detection from headset motion alone — no extra sensors

Brain Candy: Breath Detection for VR Breathwork — hero
Role
Contributor — Breathwork DLC (breath detection)
Company
Brain Candy ↗
Timeline
2022
Team
Brain Candy is created by David Lobser; I contributed breath detection to the Breathwork DLC
Platform
Meta Quest
Tools
  • Unity
  • C#
  • Meta Quest
  • Signal Processing

What I did

  • Wrote the breath-detection system in C# for Unity, reading breathing from the headset's own forward tilt
  • Made it self-calibrating: a rolling ~5-second window of min and max head tilt adapts to each user's posture and breathing depth
  • Classified every moment as inhale, exhale or hold by comparing smoothed values across a ~1-second window
  • Drove real-time feedback from it: a breath orb that rises and falls, changes color, and cues in, out and hold
  • Open-sourced the algorithm on GitHub under the MIT license

The challenge

Breathwork guidance works best when the experience responds to how you're actually breathing. But consumer VR headsets have no breath sensor, and asking people to strap on extra hardware breaks the calm the experience is trying to create.

The impact

I built the breath detection for Breathwork, a DLC of over two dozen breathing experiences for Brain Candy, a flicker-light VR app by David Lobser on the Meta Quest store (4.5★ across 46 reviews). It reads breathing from headset motion alone after a ~5-second self-calibration, and the algorithm is open source.

  • 0

    extra sensors — headset motion only

  • ~5 s

    self-calibration when a session starts

    Rolling 300-frame window at 60 fps

  • 3

    breath states detected: inhale, exhale and hold

From a Controller on the Belly to the Headset Itself

In BreathSync (2021), my team detected breathing by strapping a VR controller to the user's stomach. It worked, but it asked people to wear extra hardware. For Brain Candy I wanted the same responsiveness with nothing added at all.

The insight: breathing moves the head too. As the chest and shoulders rise and fall, the headset's forward tilt shifts by a small, rhythmic amount — enough to track if you calibrate for it.

How the Algorithm Works

The detector runs every frame in Unity, in four stages:

  • Calibrate: it records the headset's forward tilt over a rolling ~5-second window and averages the window's minimum and maximum, giving a personal range for each user.
  • Normalize and smooth: the current tilt is mapped into that range, clamped, and smoothed so small jitters don't read as breaths.
  • Classify: comparing the smoothed value with its value about a second earlier tells rising (inhale) from falling (exhale); a change below a small threshold reads as a held breath.
  • Respond: the breath state drives a breath orb that rises and falls, changes color, and cues the user to breathe in, out or hold.

Design Decisions

  • Self-calibrating, not fixed thresholds: posture, headset fit and breathing depth differ for every person, so the range is learned live and keeps adapting.
  • A dead band for holds: breath holds are part of breathwork, so a small, deliberate threshold separates a still breath from noise.
  • Smoothing over speed: a calm, steady signal matters more in a meditative experience than reacting to every micro-movement.
  • Honest feedback during setup: a short calibration message tells the user to settle in while the detector learns their range.

About Brain Candy

Brain Candy, created by David Lobser, is a VR app for Meta Quest and Steam that uses flicker light stimulation, sound and visual patterns to support relaxation, focus and creative exploration. I contributed the breath detection for its Breathwork DLC, and published the algorithm as open source so others can build breath-aware VR without extra sensors.

Breathwork is an add-on to Brain Candy on the Meta Quest store: over two dozen breathing experiences that pair breathing pacers with pattern entrainment, including box breathing, holotropic breathing, mindful breathing, parasympathetic breathing and voice-guided sessions.