So i'm aware that programming languages like C, C++, Java, C#, etc. can handle graphics jobs (GUIs, drawing a rotating object or moving rainbow sine waves on the screen the way the Demoscene guys do it). However, I've never seen those languages do any audio related stuff (not even have the However, I've never seen any sound stuff :( not even having the sound chip beep "HELLOWORLD" in morse code. What C library should I use if I want to do something like that?
printf("\a\n"); also works but that's the only audio-related thing I can do in C
an alert :D , fun , i googled for it and found thats working based on c++ and debian linux distribution , googling returns great answers :D
http://www.youtube.com/watch?v=XtCW-axRJV8 to think that works such as this is possible in assembly language.
that demo was done in 1993... on either a DOS or Amiga system I believe.
http://en.wikipedia.org/wiki/Second_Reality#Running_the_demo the original seems to still be around, and it's probably playable on an emulator like DOSbox.
. really wonderful effort on operating systems like IBM DOS .. thanks for link :) .
link of techno music for The 2nd Reality , made by Purple Motion : http://www.futurecrew.org/skaven/song_files/2ndr-sk.s3m . wonderful , imagine playing this on your DOS , and a 3d animation playing like that
requires brilliant coding ability, in addition to artistic ability, to pull off those kinds of things back then.
for those who interested in 2nd Reality Demo 1.download demo from : ftp://145.24.145.100/pub/mirrors/hornet/demos/1993/0-9/2ndreal.zip and DosBox from : http://www.dosbox.com/download.php?main=1 note that an win32 installer is located at : http://space.dl.sourceforge.net/project/dosbox/dosbox/0.74/DOSBox0.74-win32-installer.exe after downloading : first unpack demo compressed file into a path you can remember later for example c:\users\yourname\desktop "a path to user desktop for win7 users" second : install DosBox , run it from start menu or related on your os programs path then mount path to demo using this command mount "drive" "path to demo" for example i used this style : mount c: c:\ and then type commands : cd c:\user\yourname\desktop\ and then type second.exe to run demo file then do instructions and press enter and wait , enjoy demo :D a picture of demo i ran : http://s2.picofile.com/file/7241197090/desktop.png
So maybe you are asking the wrong question - is it the Language's job to make the computer beep? Is VLC written in C? Is an OS written in C? How do THEY make the computer make a sound?
@Patrick right; how do they do it? Might ask on http://stackoverflow.com about the demos, you should see the more modern ones: http://www.youtube.com/watch?v=8MMwO8Mvqfs&feature=related
Actually I got really deep into OS stuff one day and put quite a bit of thought into the separation of functions between a program and an operating system. Of course, wikipedia has a pretty good article on an OS in general and then the development of windows NT. Libraries within C/C++ have to hook into the hardware that controls output to hardware. Think of it this way - how does what we type show up on the screen? There are libraries/routines that say if I strike a key labeled with a "w" then take that input and echo it to the screen - and there are more routines that then say to activate pixels on the screen in the shape of a "w" in the proper location on the screen. Same thing for audio.
Actually, the core languages can't do video or audio, beyond printing characters( the bell is a character ASCII 0x07, I think). The rest of the video and audio is supplied by libraries.
So its all done with APIs at the highest level like OpenGL and DirectX, who tell the graphics/sound drivers what to do?
API's yes. Direct access varies.
oh and at the lowest level is the graphics card itself, executing the shaders and writing the framebuffer and whatnot.
On modern desktop computing platforms such as Mac OS, Windows or Linux you need to call OS APIs from any of the languages mentioned to play audio and sound effects. The APIs are different on each platform. One of the many reasons for this is that the OS protects the hardware from direct manipulation by programs in order to protect the system from wayward software and also to provide a better user experience (system wide volume controls, mixing and EQ to name just a few) If you program "to the metal" on a device without an operating system, then you can put digital waveform data in memory locations that will be sent directly to the audio hardware. The exact techniques and memory layout details vary based on the type of hardware you are programming. On older (or very low-cost) hardware you might need to manipulate the audio levels of a DAC (digital to analog converter) in "real-time" to play sounds. This sort of programming is almost always done in a high-performance low-level language like C or C++ (or even assembly) --BQ
the answer I needed :-D thanks
Join our real-time social learning platform and learn together with your friends!