Thread: Sound Help

  1. #1
    Slave MadCow257's Avatar
    Join Date
    Jan 2005

    Sound Help

    I am needing something that will allow me to play pure tones. I need to have control of three things: frequency, duration, and volume. I would use Beep except for it doesn't let you control volume and it's not asynchronous. If someone could point to a function or library I would be most appreciative.
    Last edited by MadCow257; 06-07-2005 at 04:44 PM.

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Visalia, CA, USA
    You could try something like OpenAL.

  3. #3
    Wen Resu
    Join Date
    May 2003
    I would use the sdl
    "code snippette from their site, play a tone"
    #include "SDL.h"
    #include "SDL_audio.h"
        extern void mixaudio(void *unused, Uint8 *stream, int len);
        SDL_AudioSpec fmt;
        /* Set 16-bit stereo audio at 22Khz */
        fmt.freq = 22050;
        fmt.format = AUDIO_S16;
        fmt.channels = 2;
        fmt.samples = 512;        /* A good value for games */
        fmt.callback = mixaudio;
        fmt.userdata = NULL;
        /* Open the audio device and start playing sound! */
        if ( SDL_OpenAudio(&fmt, NULL) < 0 ) {
            fprintf(stderr, "Unable to open audio: %s\n", SDL_GetError());
    I'm using the SDL graphic libraries at the moment and they are very nice. i havnt had time to work with sound yet but i'm hoping this will help you.
    Google SDL for more info

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sound lags in multi-thread version
    By VirtualAce in forum Game Programming
    Replies: 23
    Last Post: 08-27-2008, 11:54 AM
  2. Low latency sound effects
    By VirtualAce in forum Game Programming
    Replies: 0
    Last Post: 12-21-2004, 01:58 AM
  3. Updated sound engine code
    By VirtualAce in forum Game Programming
    Replies: 8
    Last Post: 11-18-2004, 12:38 PM
  4. Help me modify my Sound Server
    By zdude in forum C Programming
    Replies: 1
    Last Post: 05-14-2003, 05:15 PM
  5. sounds?
    By BODYBUILDNERD in forum C++ Programming
    Replies: 6
    Last Post: 12-06-2002, 03:34 PM