hi!
How to output sound using C++ program?
is there any function to output sound in C++ program??
can anyone help me to solve my problem???
hi!
How to output sound using C++ program?
is there any function to output sound in C++ program??
can anyone help me to solve my problem???
Code:#include<unknownos.h> #include<whatcompiler.h> int main() { unknownos::Sound thebeeper; thebeeper.IdioticFreqSet(10000); thebeeper.StupidAmplitudeSet(10000); thebeeper.MakeSarcasticSound(); whatcompiler::End(); return PSCYCHICRETVAL; }
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi
um can that post be deleted its complete spam al you SHOULD have said is,
what os,
what compiler,
we really can only give you some helpfull sites to certain codes that may or maynot even help you.
ok well anyway as i recall there should be one in the faq
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1043876931&id=1031248558
I'm going to assume you're using C++, of course, compiler, for the MOST part, it doesnt matter.....
Lets see, I suggest you take a look into openGL or directX, either one is used very widely, and it would be suggested you learn both in the long run :d
DirectX or OpenGL just for a sound? I don't think so. I agree it would be good to learn in the long run but that library would not be a good choice if you're JUST going to use sound. Try this:
You also need to link the library by typing -lwinmm in the commands when calling compiler. winmm stands for Windows Multi-Media(winmm). So only if you're doing Windows programming should you use this.Code:#include <windows.h> #include <mmsystem.h> int main() { PlaySound("sound.wav",NULL,SND_ASYNC|SND_FILENAME); return 0; }
Trinity: "Neo... nobody has ever done this before."
Neo: "That's why it's going to work."
c9915ec6c1f3b876ddf38514adbb94f0
Would that work in a console app? It doesn't seem to work for me. I made sure to include theOriginally Posted by jmd15
#pragma comment(lib,"winmm.lib"); and also tried it with "lwinmm.lib".
I've also tried sndPlaySound() and all sorts of crap like that before...but never had any luck with it.
If you just want to play a sound, try this:
Code:cout << "\a";
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
That plays a beep, or whatever the Windows DEFAULT-SOUND is. Try
. . . And that should beep at 100 Hertz untill you reboot, or recompile with nosound() instead of sound(100)Code:#include <pc.h> int main() { sound(100); return 0; }
With what compiler? DJGPP, and ...?
Windows functions (or ANSII ones) are your best bet (unless you're using Linux).
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
Code:#include <windows.h> int main() { Beep(1568, 200); Beep(1568, 200); Beep(1568, 200); Beep(1245, 1000); Beep(1397, 200); Beep(1397, 200); Beep(1397, 200); Beep(1175, 1000); return 0; }
The OP didn't even stick around to read the first reply -
Just a bunch of pointless speculation and noise.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.