|  | Sound programming |  | |
| | | kid joe |  |
| Posted: Mon Jul 07, 2008 7:55 pm Post subject: Sound programming |  |
Hello
I've got interested in learning some basic sound programming bits in C... mainly I want to know how to go about accessing the sound devices - reading from them mainly - in windows and linux... I'd kind of like to be able to do it without a whole bunch of extra garbage added in there - by this I mean that I know in windows there are a million sound programming packages that make the whole process "easier" - there are also a few in linux but I think the raw stuff I'm interested in understanding is a bit more simple in linux b/c of the way devices work in it.
So if anyone can point me at a place to start - maybe some really raw source code for linux and windows - I would really appreciate it.
Thanks! |
| |
| | | Dann Corbit |  |
| Posted: Mon Jul 07, 2008 8:06 pm Post subject: Re: Sound programming |  |
"kid joe" <spamtrap@spamtrap.invalid> wrote in message news:pan.2008.07.07.21.55.40.672249@spamtrap.invalid...
| Quote: | Hello
I've got interested in learning some basic sound programming bits in C... mainly I want to know how to go about accessing the sound devices - reading from them mainly - in windows and linux... I'd kind of like to be able to do it without a whole bunch of extra garbage added in there - by this I mean that I know in windows there are a million sound programming packages that make the whole process "easier" - there are also a few in linux but I think the raw stuff I'm interested in understanding is a bit more simple in linux b/c of the way devices work in it.
So if anyone can point me at a place to start - maybe some really raw source code for linux and windows - I would really appreciate it.
|
LINK
** Posted from LINK ** |
| |
| | | Dann Corbit |  |
| Posted: Mon Jul 07, 2008 8:26 pm Post subject: Re: Sound programming |  |
| |  | |
"Walter Roberson" <roberson@ibd.nrc-cnrc.gc.ca> wrote in message news:g4u42a$q2u$1@canopus.cc.umanitoba.ca...
| Quote: | In article <pan.2008.07.07.21.55.40.672249@spamtrap.invalid>, kid joe <spamtrap@spamtrap.invalid> wrote:
I've got interested in learning some basic sound programming bits in C... mainly I want to know how to go about accessing the sound devices - reading from them mainly - in windows and linux...
There is no mechanism provided by the standard C language to handle sound devices (or graphics, or mice, or printers, or any other kind of device.) All sound handling is system and operating-system dependant.
So if anyone can point me at a place to start - maybe some really raw source code for linux and windows - I would really appreciate it.
You should check with newsgroups that are specific to your operating systems, and also with information sources specific to the brand and model of sound hardware. "raw" sound processing might require that you program at the device driver level in order to have the privilege to access the necessary hardware registers.
|
I guess that he should program to the midi standard and then it won't matter what the OS is. LINK LINK perhaps news:comp.music.midi would prove helpful.
Probably some web seaches will show the OP all he needs to know.
But it is important to recognize that MIDI is a standard independent of programming language (lots of MIDI stuff is in C but also plenty in Java and Lisp and other languages).
** Posted from LINK ** |
| |
| | | Malcolm McLean |  |
| Posted: Mon Jul 07, 2008 8:31 pm Post subject: Re: Sound programming |  |
| |  | |
"kid joe" <spamtrap@spamtrap.invalid> wrote in message
| Quote: | I've got interested in learning some basic sound programming bits in C... mainly I want to know how to go about accessing the sound devices - reading from them mainly - in windows and linux... I'd kind of like to be able to do it without a whole bunch of extra garbage added in there - by this I mean that I know in windows there are a million sound programming packages that make the whole process "easier" - there are also a few in linux but I think the raw stuff I'm interested in understanding is a bit more simple in linux b/c of the way devices work in it.
So if anyone can point me at a place to start - maybe some really raw source code for linux and windows - I would really appreciate it.
It is rather more involved than you think. |
The problem is that audio devices need to be fed a continuous stream of raw bits, whilst generally you want the processor to spend most of its time dealing with the rest of the program, like moving space invaders about the screen.
So unless you want to do difficult multi-tasking programming at the device level, you need a certain layer of abstraction. the question then becomes "which one?". For space invaders you can probably get away with an interface that says "play sound". It puts a bleep or an explosion into the audio queue, return scontro, to you almost immediately, and a millesecond or so later you'll hear the sound on the speakers. For a more advanced use of audio, this isn't sufficient. You'll want to be able to cancel jobs, to submit long sequences instead of tiny clips, to change the volume, to stream sound in from a backing store, maybe to synthesise samples on the fly.
So it becomes difficult to know what level of abstration to use. Too low and you're doing messy parallel programming, too high and you're calling Midi instruments and the like when you just want to say "play this".
-- Free games and programming goodies. LINK |
| |
| | | Walter Roberson |  |
| Posted: Mon Jul 07, 2008 10:07 pm Post subject: Re: Sound programming |  |
| |  | |
In article <pan.2008.07.07.21.55.40.672249@spamtrap.invalid>, kid joe <spamtrap@spamtrap.invalid> wrote:
| Quote: | I've got interested in learning some basic sound programming bits in C... mainly I want to know how to go about accessing the sound devices - reading from them mainly - in windows and linux...
|
There is no mechanism provided by the standard C language to handle sound devices (or graphics, or mice, or printers, or any other kind of device.) All sound handling is system and operating-system dependant.
| Quote: | So if anyone can point me at a place to start - maybe some really raw source code for linux and windows - I would really appreciate it.
|
You should check with newsgroups that are specific to your operating systems, and also with information sources specific to the brand and model of sound hardware. "raw" sound processing might require that you program at the device driver level in order to have the privilege to access the necessary hardware registers.
-- So you found your solution What will be your last contribution? -- Supertramp (Fool's Overture) |
| |
| | | Sigmund LappegÄrd Lahn |  |
| Posted: Tue Jul 08, 2008 6:59 am Post subject: Re: Sound programming |  |
| |  | |
kid joe wrote:
| Quote: | Hello
I've got interested in learning some basic sound programming bits in C... mainly I want to know how to go about accessing the sound devices - reading from them mainly - in windows and linux... I'd kind of like to be able to do it without a whole bunch of extra garbage added in there - by this I mean that I know in windows there are a million sound programming packages that make the whole process "easier" - there are also a few in linux but I think the raw stuff I'm interested in understanding is a bit more simple in linux b/c of the way devices work in it.
So if anyone can point me at a place to start - maybe some really raw source code for linux and windows - I would really appreciate it.
Thanks!
|
Sound programming in C is involved and highly system dependent. A cross platform helper library would _be_ "a bunch of garbage added in there", and would not (nessescarily) reflect the way the sound hardware works in practice.
The least crufty library I know of only does sound output -- LINK
If you are interested in sound synthesis or analysis I would recommend Chuck instead -- LINK
Of course, there is always Pure Data (http://puredata.info/) or its commercial sibling, Max/MSP (http://www.cycling74.com/)
-Sigmund |
| |
|
|