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

Discussion in 'C' started by ahayes, Mar 27, 2007.

  1. ahayes

    ahayes New Member

    Joined:
    Mar 27, 2007
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    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?
     
  2. boldyman

    boldyman New Member

    Joined:
    Mar 27, 2007
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Home Page:
    http://www.nextdawn.nl
    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!
     
    Last edited by a moderator: Mar 27, 2007
  3. ahayes

    ahayes New Member

    Joined:
    Mar 27, 2007
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice