Speaker output

This is a discussion on Speaker output within the C++ Programming forums, part of the General Programming Boards category; I want to output a defined frequency and volume to the speakers, how do I do this with out using ...

  1. #1
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342

    Question Speaker output

    I want to output a defined frequency and volume to the speakers, how do I do this with out using DirectSound?

  2. #2
    -JM
    -JM is offline
    Registered Usurer
    Join Date
    Apr 2005
    Location
    upstate NY
    Posts
    79
    You can use the BEEP command

    Code:
    #include <iostream>
    #include <windows.h>
    
    using namespace std;
    
    int A = 440;
    
    int main()
    { cout<<"This is a concert A: "<<A<<"Hz";
        Beep(A, 5000);
      cin.get();
      return 0;
    }
    Unfortunately this is really low tech and doesn't utilize the sound card, so use it as a last resort.

    -JM
    Huh?

  3. #3
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    I'm well aquaintied with the Beep() function. The problem is you don't have control of the volume of the output, only the frequency.

  4. #4
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    How do you feel about winmm? waveOut[*] Functions?

    ╔╗╔╦══╦╗╔╦══╦╗
    ║╚╝║╔╗║╚╝║╔╗║║
    ║╔╗║╠╣║╔╗║╠╣╠╣
    ╚╝╚╩╝╚╩╝╚╩╝╚╩╝

    codez http://code.google.com/p/zxcvbn/

  5. #5
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    Sure, but I don't know anything about them.

  6. #6
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    Why don't you read about them? Was that an off-hand comment suggesting that you would go read about it, or an invitation for some poor fool to explain how to use this library with plenty of existing documentation?

    ╔╗╔╦══╦╗╔╦══╦╗
    ║╚╝║╔╗║╚╝║╔╗║║
    ║╔╗║╠╣║╔╗║╠╣╠╣
    ╚╝╚╩╝╚╩╝╚╩╝╚╩╝

    codez http://code.google.com/p/zxcvbn/

  7. #7
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    There some MIDI functions in the Windows API. A few years ago, I was able to write a short MIDI program from the information on this web site.

    I'm sure there's some some help at MSDN... if you know what to look for... if you can find it... Try searching MSDN for this function:

    midiOutShortMsg()

    I assume that these "standard" MIDI functions are "obsolete" and replaced by their DirectX equivalents.

  8. #8
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    Thanks, that is a good link, but I guess DirectSound/DirectX is the way to go, there is really no reason not to go with it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help for my output array
    By qwertysingh in forum C Programming
    Replies: 1
    Last Post: 02-17-2009, 02:08 PM
  2. execl()/fork() output
    By tadams in forum C Programming
    Replies: 19
    Last Post: 02-04-2009, 02:29 PM
  3. Replies: 4
    Last Post: 11-30-2005, 03:44 PM
  4. Formatting output into even columns?
    By Uncle Rico in forum C Programming
    Replies: 2
    Last Post: 08-16-2005, 05:10 PM
  5. Output problems with structures
    By Gkitty in forum C Programming
    Replies: 1
    Last Post: 12-16-2002, 04:27 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21