HOW IT WORKS
At the heart of this app are a random-number generator and a low-pass infinite-impulse-response filter algorithm, which allows continuous adjustment of the filter slope. Double buffering ensures smooth operation, and the signals are generated independently for each stereo channel, as the primary purpose of this app is to be used with earphones to block out distractions.
WHAT IS IT FOR?
Use Noise Machine with a pair of earphones to mask distracting and annoying sounds and become at peace with the world. Loud conversations at a coffee shop where you are trying to read, crying babies on planes, background music that doesn't agree with your taste and a many other noises get into your brain and have to be processed. All of these sounds have certain patterns and aren't random in the mathematical sense. When you are tired or irritable or are getting too distracted, you can let your brain rest by masking these sounds with noise that doesn't have a noticeable pattern. This works remarkably well even at moderate volumes, and you will be able to concentrate or relax much more easily in noisy environments. Even tinnitus can be masked this way. Noise Machine can also be used with a speaker to help put babies (and adults) to sleep. If you intend to stay awake, it's best to use it with headphones or earphones. That way, at least if you picked the right type of noise and the earphones are comfortable, you will quickly stop noticing it; with speakers, every time you move your head, your perception will change, and you will be reminded of the noise, which defeats the purpose. There are also some technical uses, such as testing speaker polarity.
The terms "white" and "pink" noise refer to random signals with different spectral distributions. In white noise, the noise energy density is constant throughout the frequency spectrum (at least in the range of interest). This is similar to white light, hence the term "white noise". In pink noise, the lower-frequency components are stronger, and the noise energy density is the same in every octave (or decade, or any logarithm of frequency). This is also known as 1/f noise. Similarly, in pink-colored light, the lower-frequency, longer-wavelength, redder components are stronger.
A more general case is 1/f^α. The value of α=0 corresponds to white noise, or flat frequency spectrum, as described above; α=1 corresponds to pink noise, or -3dB/octave frequency dependence, also as described above (in different words); α=2 to "red" or "brown" noise (which refers to Brownian motion rather than the color brown), or -6dB/octave frequency dependence. In this app, the alpha value may be adjusted from 0 to 2 in small increments.
Optionally, the sound may be played in a loop, which reduces the already modest CPU and battery usage by only generating the noise clip that's long enough to fill a loop (at the expense of using more RAM to store it, which normally is not a problem). The playback is gapless. If the loop is too short, the pattern becomes noticeable, which creates a distraction, but even the shortest loop setting (1 minute) should be long enough. The longest setting is determined by the amount of memory available to the app (typically 5 minutes). If you think you can still hear a pattern, or need continuous random signal generation for some other purpose, or want the app to use as little RAM as possible, you can turn the loop off.
USE OF THIRD-PARTY WORK
- A modified version of the pink noise generator class, originally written by Sampo Niskanen, distributed under the BSD license
- Modified Android robot image and images from http://www.iconarchive.com/, used according to the Creative Commons Attribution License 3.0
READ_PHONE_STATE -- used to pause the noise sound during phone calls.