Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   How do you access the PC speaker on Unix/Linux? (http://www.go4expert.com/forums/access-pc-speaker-unix-linux-t3640/)

ahayes 27Mar2007 11:18

How do you access the PC speaker on Unix/Linux?
 
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 27Mar2007 15:49

Re: How do you access the PC speaker on Unix/Linux?
 
Look here: http://www.johnath.com/beep/

Also, you could compile this C program:

#include <stdio.h>

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

Should work on linux.

Good luck!

ahayes 16Apr2007 12:09

Re: How do you access the PC speaker on Unix/Linux?
 
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.


All times are GMT +5.5. The time now is 16:07.