int fd; int tone; double freq; fd = open("/dev/tty1", O_RDONLY | O_NOCTTY); tone = 60; freq = 13.75f * pow(2, tone / 12.0f); ioctl(fd, KIOCSOUND, (int) (1190000 / freq));