Breathe is an application that measures the flow of one’s exhalations using a microphone and provides visual and auditory feedback to the breather. This is a means of biofeedback. It’s purposes include relaxation and promoting awareness of breath.
Breathe works best with a head-set microphone—any cheap computer headset will do. Position the microphone so that it is about half an inch in front of the nose. It is best to feed the breath sounds back into the headseat earphones. It helps you to find the “sweet spot” where the mic picks up the breath best.
I recommend leaving the headphone volume on while using Breathe. The point is to visualize your breath. (or to have fun blowing the little blue triangle up in the air).
Download: breathe.zip for Win32.
The app simply runs a recording from the microphone and passes it through to the headphones. It displays a spectrograph and tracks the amplitude of the signal. The estimated breath velocity can also be accessed over the network (TCP/IP) using the vrpn protocol (name: “breath”, port: 3883). (i wrote it originally to control a toy sailboat in a virtual environment)
breathe.exe is the executable. It comes with source code. “breathe.cpp” is the main body of the app.
Biofeedback is growing more and more frequent in medical treatment and sports training. Similarly, Meditation, Yoga, Tai Chi, and other art forms that distinguish themselves by their emphasis on breath control are growing in popularity. Singers and persons with speech disabilities benefit from having their own voices fed back into their ears as they sing or speak. Breather acts as an aid to relaxation, meditation, and breath training.
Use a standard computer head-set microphone.
The microphone is positioned approx 1cm in front of nostril.
Audio is fed back into the headset in order to help position the microphone optimally. The user makes fine adjustments to find the “sweet-spot”: the place that gives the loudest signal upon exhalation without picking up any of the inhalation noise.
Generally, the inhalation is much quieter and can only be detected when the microphone is close enough to obstruct the nostril. The current implementation does not attempt to distinguish inhalation from exhalation, so it is best to position the mic where inhalations are not picked-up at all.
Audio samples are 48000 Hz, 16-bit, mono.
At each frame the short-time DFT is taken to yield 128 values in the frequency-domain.
At each frame, a “signal power” value is produced by taking a weighted sum of 128 frequency samples.
Finally, the instantaneous breath velocity is estimated from the signal power by a simple linear mapping.
The final product is an instantaneous rate-of-flow of the exhalation: air_volume/time.
We’re estimating the mapping from 128 frequency values (the short-time FFT of the signal) to a scalar (the estimated rate of air flow).
A simple approxmation is
Position the microphone on one user. Record a series of breaths, all of approximately equal air volume. In practice, the best approach seems to be to have the user breath through his/her maximum tidal volume after a period of several minutes acclimation time.
Have the user vary the rate of exhalation between long slow breaths and short fast breaths. Record a block of a dozen or so contiguous breaths.
Since recorded breaths have equal volume, the air-flow should integrate to the same total volume with each breath.
Find a set of weights (128 + 2 coefficients) that satisfies this constraint.
Re-position the microphone on the user and repeat the above. Even after a period of acclimation, a user’s maximum acheivable tidal volume will vary over time. So whether using the same or a different user, each new set of recorded breaths is assumed to have a different total volume.
Refine coefficients to satisfy all sets of recorded breaths.