How do you access the PC speaker on Unix/Linux?

ahayes's Avatar, Join Date: Mar 2007
Light Poster
I'm trying to write a program that plays tones through the PC Speaker on OSX and Linux but I can't find any way to either directly access the PC speaker port or an API to go through.

I know on Windows there is a function in windows.h, Beep(frequency, duration) which works well, how can I find something like that for Unix based platforms?
boldyman's Avatar, Join Date: Mar 2007
Newbie Member
Look here:

Also, you could compile this C program:

#include <stdio.h>

int main() { printf("\a"); return 0; }

Should work on linux.

Good luck!

Last edited by shabbir; 27Mar2007 at 16:39.. Reason: Confine links to signatures only.
ahayes's Avatar, Join Date: Mar 2007
Light Poster
I have recently completed a Windows program that uses Beep(frequency, duration) from windows.h to play primitive music through the PC speaker. I've looked into SDL to play it but it seems it's mostly just for playing pre-built wavs and midis. I looked at FMOD too, but I can't figure it out and the binaries won't run outside the debugger.