blog dds

2006.11.15

White Noise Calms Babies

A week ago I told my colleague Damianos Chatziantoniou that drying the body of a newborn baby with a hair drier keeps it consistently dry avoiding rashes, and also calms the baby down. Today he told me the advice worked wonders. Many parents have discovered that sources of white noise, like the sound of a vacuum cleaner or a hair drier, seem to calm down a baby's crying spell.

The following program (tested on FreeBSD and Linux and a single baby) generates white noise, consuming considerably less power than a vacuum cleaner.

/*
 * (C) Copyright 2003 Diomidis Spinellis
 *
 * Permission to use, copy, and distribute this software and its
 * documentation for any purpose and without fee is hereby granted,
 * provided that the above copyright notice appear in all copies and that
 * both that copyright notice and this permission notice appear in
 * supporting documentation.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

#include <unistd.h>
#include <fcntl.h>

main(int argc, char *argv[])
{
        int fd;
        unsigned int buff[1024];
        unsigned int *p;

        if ((fd = open("/dev/dsp", O_WRONLY)) < 0) {
                perror("/dev/dsp");
                exit(1);
        }
        for (;;) {
                for (p = buff; p < buff + sizeof(buff) / sizeof(buff[0]); p ++)
                        *p = rand();
                write(fd, buff, sizeof(buff));
        }
        /* NOTREACHED */
        return 0;
}

Read and post comments    AddThis Social Bookmark Button


Creative Commons License Last modified: Wednesday, November 15, 2006 8:54 am
Unless otherwise expressly stated, all original material on this page created by Diomidis Spinellis is licensed under a Creative Commons Attribution-Share Alike 3.0 Greece License.