Making noise

This is a discussion on Making noise within the C++ Programming forums, part of the General Programming Boards category; Hi pplzzz, how do I use the internal PC speaker to make noises of different frequencies? Like using \a but ...

  1. #1
    Unregiste-6
    Guest

    Making noise

    Hi pplzzz, how do I use the internal PC speaker to make noises of different frequencies? Like using \a but being able to change the pitch of the noise. I'm using MSVC++. Thanks

  2. #2
    Registered User GreenCherry's Avatar
    Join Date
    Mar 2002
    Posts
    65
    Well, input 07 into a char, and when i prints a bell weil sound... That all I have to offer.
    I have a rabbit in my pants! Please be happy for me.

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    32
    How about you do the next best thing...play any wav you want.

    include the header file "mmsystem.h" and include the static library "winmm.lib" to your project.

    Here's an example of using the function
    PlaySound ("C:\\applications\\aim\\sounds\\moo.wav", NULL, NULL);

    For simplicity sake, just keep the second and third variables in the parameter NULL. Don't worry about them. Only parameter you want to worry about is the first one, it's the location of the wav file you are going to play.
    Last edited by Divx; 10-08-2002 at 12:18 PM.

  4. #4
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    I can do it in BASIC... It must be possible!

    I don't know how, but it's got to be possible... With BASIC I can tell it to play a frequency and duration, but I can't set the volume. There must be some compilers with a sound.h file(?) Non-ANSA, of course.

    I think you have to have a sound card and external speakers to use PlaySound().

  5. #5
    Registered User
    Join Date
    Oct 2002
    Posts
    32

    Re: I can do it in BASIC... It must be possible!

    Originally posted by DougDbug
    I don't know how, but it's got to be possible... With BASIC I can tell it to play a frequency and duration, but I can't set the volume. There must be some compilers with a sound.h file(?) Non-ANSA, of course.

    I think you have to have a sound card and external speakers to use PlaySound().
    You are correct sir!

  6. #6
    Registered User Azuth's Avatar
    Join Date
    Feb 2002
    Posts
    236
    http://www.programmersheaven.com/zone1/cat88/297.htm

    The above may well be just what you're looking for.
    Demonographic rhinology is not the only possible outcome, but why take the chance

  7. #7
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    I noticed that the link you just posted is to a VBX file. How would you incorporate that into a MSVC++ 6.0 app?
    Please direct all complaints regarding this post to the nearest brick wall Have a nice day.

  8. #8
    Registered User Azuth's Avatar
    Join Date
    Feb 2002
    Posts
    236
    Don't bother me with the details, I'm an idea's man

    Seriously though, I read the description and assumed that it was correct; "... Is a custom control suitable for use with such programming languages as Visual Basic, Visual C++ and Delphi."

    I had figured that the file included libraries & hopefully exapmles suitable for the languages mentioned. Being at work I didn't take the time to download the file & have look.

    To be honest I have no idea how to implement a VBX control into Visual C++, though I'd say google would likely provide some help.
    Last edited by Azuth; 10-09-2002 at 12:15 AM.
    Demonographic rhinology is not the only possible outcome, but why take the chance

  9. #9
    Registered User Azuth's Avatar
    Join Date
    Feb 2002
    Posts
    236
    http://skirball.med.nyu.edu/~hewz/ht.../ch09/ch09.htm

    The above link 'looks' like a good place to start on how you use VBX controls in MSVC++6 (And other ActiveX controls). It does point out that VBX controls can only be used by the 16bit Visual C++ compiler. So I'm not sure about suitability for the original poster.
    Demonographic rhinology is not the only possible outcome, but why take the chance

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. K8N NEO4 fan making noise... what does that chip do?
    By edomingox in forum Tech Board
    Replies: 3
    Last Post: 09-30-2008, 06:01 AM
  2. Procedural Noise and OpenGL Help!
    By Freestyler in forum C Programming
    Replies: 8
    Last Post: 04-18-2008, 08:06 AM
  3. Making great graphics
    By MadCow257 in forum Game Programming
    Replies: 1
    Last Post: 02-20-2006, 10:59 PM
  4. Replies: 2
    Last Post: 01-13-2003, 12:28 PM
  5. About Unix Programming - Making a career desision
    By null in forum C Programming
    Replies: 0
    Last Post: 10-14-2001, 07:37 AM

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