It’s helpful to have a white (or brown) noise machine outside our director’s office, since his office is next to the lunch room and it helps to make his conversations more private.Â But all of the machines that I saw on the market are sleep-oriented, and expect that you want them to turn off after a certain amount of time.
We started with a laptop, powered speakers, and the SimplyNoise.com web site (we like the “Brown Noise” sound there).Â We could use the mute button on the laptop or the power button on the speakers to turn the sound on and off.Â But that’s a waste of a laptop if the machine is good for anything else, and problem-prone if the laptop isn’t good for anything else.
So I decided that this would be a good first project for the Raspberry Pi. I found that mplayer will loop an audio file forever if you use the “-loop 0” switch. It does go silent for a split second when it’s looping, so you’ll want an audio file at least 15 or 20 minutes long to minimize the number of times it sounds like it’s stuttering.
There are plenty of tutorials out there about getting started with the Pi.Â After that, it’s as simple as:
Load up an mp3 or wav file with 15 or 20 minutes (or more) of noise.
sudo apt-get install mplayer
create /etc/init.d/whitenoise.sh (included below)
add it to system startup with “sudo update-rc.d whitenoise.sh defaults”
This could also be used as a Music on Hold player for older phone systems.
### BEGIN INIT INFO
# Provides: whitenoise
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: whitenoise
# Description: plays whitenoise file.
### END INIT INFO
/usr/bin/mplayer -quiet -loop 0 /home/pi/whitenoise.mp3 < /dev/null &