Projects / Mobile signal processing
Case study · Mobile DSP · Biofeedback · Android

GreenNoise / SleepWave

A suite of three Android apps for relaxation and sleep. They synthesize green noise from first principles, rise and fall in volume with the user's breathing, and show biofeedback that helps the user settle into slow, calming breaths.

The problem

Noise apps play static recordings that ignore the listener. Slow paced breathing (about 0.1 Hz) is known to calm the nervous system, but it takes conscious effort, which defeats the purpose when you're trying to fall asleep.

What I built

Noise synthesized with a custom FFT that loops seamlessly, a smooth breathing-matched volume envelope, accelerometer breathing detection, and a two-circle synchrony display that guides breathing without effort.

The result

Three successive apps installed and validated on a phone in real conditions: an all-night transatlantic flight with noise-cancelling headphones, and overnight sleep.

3successive Android apps
218point FFT noise synthesis
15spectral control points
30 fpsreal-time biofeedback graphics
13 huninterrupted playback for long flights
Evolution

Each version built on the last

VERSION 1

GreenNoiseApp

Spectrally shaped green noise peaking at 600–800 Hz, synthesized in the frequency domain with random phase. Loops seamlessly and works with Bluetooth and noise-cancelling headphones.

Validated on a transatlantic flight
VERSION 2

green_enhanced

Adds a breathing-matched volume envelope with adjustable breath period (3–10 s), adjustable envelope shape, manual phase sync and automatic breathing-rate detection from the accelerometer.

Animated breathing guide
VERSION 3

SleepWave

Two-circle biofeedback (noise rhythm vs. detected breathing, with a glow when they line up), a live breathing-signal trace, redesigned filters, signal strength and an "IN SYNC" indicator.

Validated for overnight sleep
SleepWave app on a phone: noise circle, breathing circle, breath period and curve sliders, tap-to-sync button and stop button
SleepWave running on a phone: 7 s breath period (9 breaths/min), noise circle on the left, detected-breathing circle on the right.
Signal chain

Physics from end to end

Spectral design15 control points, green-noise envelope
→
FFT synthesisConjugate symmetry → real, perfectly periodic signal
→
Breathing envelopeKaiser-Bessel (β = 10) amplitude modulation
→
Audio streaming2,048-sample chunks at 44.1 kHz
→
Breath detection0.015–0.5 Hz band-pass, zero-crossings
→
BiofeedbackSync quality & visual target
Technical depth

For the engineers in the room

Signal processing decisions
  • Chose a Kaiser-Bessel window as the volume envelope for its smoothness and its single shape parameter. At β = 10 the exhale is nearly silent (about 0.035% of peak), normalized to exactly [0, 1]
  • Used smooth transitions to avoid the "orienting response" that sudden volume changes trigger in the brain
  • Lined up the envelope phase with the detected breathing cycle so the display shows true synchrony
  • Timed everything from the phone's monotonic clock, so clock corrections or time-zone changes during a flight can't cause drift
Where engineering judgment mattered
  • Saw that the AI's first breathing filter had its cutoff at 0.08 Hz, below the whole breathing band. I redesigned it with time-adaptive coefficients, α = 1 − exp(−2π·fc·Δt)
  • Diagnosed build-tool version mismatches, USB driver confusion (file-transfer vs. debugging driver) and three successive build errors through to a deployed app
Scientific basis
  • A brainwave front end to close this feedback loop is in build: see Analog Front Ends & Signal Conditioning
  • Slow breathing near 0.1 Hz maximizes heart-rate variability and calms the nervous system (research on respiratory sinus arrhythmia and HRV biofeedback)
  • Rhythmic volume changes at breathing frequency encourage the breath to follow along; a visible synchrony target makes it effortless
Applying it to your product

Sensor-driven mobile apps

This project shows the full mobile path: DSP from first principles, phone sensors, real-time graphics, and deployment and field validation on a real device. It applies to:

  • Wellness, sleep and biofeedback products
  • Phone-based sensor telemetry and diagnostics
  • Audio synthesis and real-time signal processing apps
Technology

Stack

KotlinAndroid AudioTrackSensorManagerCustom FFTKaiser-Bessel windowIIR filtersCanvas animationGradleAnthropic Claude

Need signal processing on a phone?

From the math to an app running on the device.

Start a conversation

← Back to all projects