Turn your Raspberry Pi into a white noise machine

What you need for this guide

  • A Raspberry Pi with debian* installed
  • The Internet
  • A 3.5mm male-to-male ("headphones"-style) audio cable
  • An old stereo with auxiliary input
**This guide is based on debian/raspian however it may work in another distro.

How to set up the Pi

With your Pi connected to the internet, at the command line type in


sudo apt-get update
sudo apt-get install sox
export AUDIODEV=hw:0,0
export AUDIODRIVER=alsa


This installs sox and set the environment variables needed for the Pi to find your audio device.

Now open the startup jobs list,


sudo nano /etc/crontab


and insert the following text into a new line at the end of the file.


@reboot pi play -b 16 -n synth 0 brownnoise


Close the file and save.  This will create brown noise, which I find more soothing than white but you can also use white noise or pink noise by replacing "brownnoise" with "whitenoise" or "pinknoise".  Note that we are specifying 16bit output because 32 is not supported.

The final steps


The sound we selected will now automatically start playing on boot. Plug your 3.5mm cable from the Pi into your stereo and plug in the power cable.  Note that it will take a minute for your Pi to boot up before you get any audio.  Turn on the stereo and adjust your bass and treble levels to your preference so that the noise generated is exactly how you want it.

Some Considerations


While you may need a keyboard, ethernet, and monitor to set up the script, presumably, you're going to want to plug in only the audio and power cables when you actually set it up to your stereo.  This means you will not have a way to properly shut down the Pi when you want to turn it off.  Turning off the Pi without shutting down has a small chance of damaging data on the memory card and making the Pi unable to boot.  For this reason, you should try to avoid turning off the Pi unnecessarily.  You might also consider backing up your memory card.

Enjoy!

No talloc stackframe at ../source3/param/loadparm.c:4864, leaking memory

After install samba on a new Ubuntu build, I noticed I kept getting this error when I ran any command with sudo


no talloc stackframe at ../source3/param/loadparm.c:4864, leaking memory
WARNING: Ignoring invalid value 'share' for parameter 'security'


The culprit seems to be libpam-smbpass.  According to launchpad, libpam-smbpass is a
pluggable authentication module for Samba

 This is a module for PAM that enables a system administrator to migrate
 user passwords from the Unix password database to the SMB password
 database as used by Samba, and to subsequently keep the two databases in
 sync. Unlike other solutions, it does this without needing users to log
 in to Samba using cleartext passwords, or requiring them to change their
 existing passwords.
If you have no intention of using it, an easy way to get rid of the error is to remove it,


sudo apt-get remove libpam-smbpass