Here's some code to make the empeg beep. I've had to butcher it a little
but it should still compile... :-)
Pitch is in MIDI notes (thanks to John) - he informs me that 60 is probably middle A - he may have the scale wrong.
Duration is in milliseconds. It is asynchronous but closing the device kills off any pending notes (I think).
beep.c
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <math.h>
#define EMPEG_DSP_MAGIC 'a'
#define EMPEG_DSP_BEEP _IOW(EMPEG_DSP_MAGIC, 0, int)
int main(int ac, char *av[])
{
int fd;
int pitch = 60;
int duration = 500;
int args[2];
fd = open("/dev/dsp", O_RDONLY);
if (ac == 3)
{
pitch = atoi(av[1]);
duration = atoi(av[2]);
}
if (fd < 0)
{
perror("Couldn't open dsp.\n");
return 1;
}
args[0] = pitch;
args[1] = duration;
if (ioctl(fd, EMPEG_DSP_BEEP, args) < 0)
perror("ioctl.\n");
usleep(duration * 1000 + 125000);
close(fd);
return 0;
}