audio in C (12)

1 Name: #!/usr/bin/anonymous : 2008-07-23 09:40 ID:Heaven

Hello, where can I find general information about how audio works in computers?
Also, what's a good audio library to use in C? I don't like bloated stuff.
I have a very good knowledge of C, but I lack the necessary (apparently) knowledge to understand what audio libraries require.
So first I must learn about how audio works with computers (ie that frequency stuff or channels or whatever), then get a good audio library.

Thanks.

2 Name: #!/usr/bin/anonymous : 2008-07-23 14:15 ID:Heaven

"Audio" means a lot of different things. Digital output of signed linear data? Mixing? Data coding? Analog synthesis of waveforms?

Nobody wants to hear it, but a solid math background and knowledge of digital signal processing makes it a lot easier to have a meaningful conversation on this subject...

3 Name: #!/usr/bin/anonymous : 2008-07-23 14:56 ID:Heaven

>>2
What it boils down to is playing different music file formats.
What kind of maths? Just give me some good books to read or good references etc and I'll read them.

4 Name: #!/usr/bin/anonymous : 2008-07-23 16:00 ID:Heaven

5 Name: #!/usr/bin/anonymous : 2008-07-24 07:02 ID:Heaven

Learn about /dev/audio.

6 Name: #!/usr/bin/anonymous : 2008-07-24 08:26 ID:Heaven

pc speaker ftw

7 Name: #!/usr/bin/anonymous : 2008-07-24 17:23 ID:f82JGiYT

OpenAL.

8 Name: OP here : 2008-07-25 12:35 ID:Heaven

Okay I think I will use OpenAL.
Btw, here's a good link I found which explains many things
http://www.opensound.com/pguide/audio.html

9 Name: #!/usr/bin/anonymous : 2008-07-25 15:53 ID:W1Hbq1ZX

I've heard good things about PortAudio:
http://www.portaudio.com/

I sorta-know a couple of guys who use libao, don't know much about it:
http://xiph.org/ao/

Maybe libsndfile for file reading/writing?
http://www.mega-nerd.com/libsndfile/

Lurking on the music-dsp list might also be interesting. The discussion there is usually way too advanced for ...everyone sane... but it can be fun. There's also code snippets at:

http://www.musicdsp.org/

I'd recommend flipping through various DSP books, and reading at least the chapters dealing with the basics of sampling, sample rate conversion, etc. Check the local libraries.

10 Name: #!/usr/bin/anonymous : 2008-07-25 19:46 ID:hZUnqkPH

>>9

libao and portaudio are (unfortunately) very out of date. I like the portaudio API (and the related portmidi), but there's no pulse-support, and the fact that the GCC+MINGW builds are crippled is annoying.

However, if you're using VCC, or don't care about windows, portaudio is still an excellent choice.

11 Name: #!/usr/bin/anonymous : 2008-07-25 20:22 ID:naa2gira

>>3
Audio multiplexing is explained fairly well in Rodger Ziemer's "Communication Systems" book, but Comm involves math far beyond derivative equations and such. SMPTE standards define how embedded audio works in uncompressed video streams, but the best language to handle that stuff is Verilog.

Become an engineer, then we'll talk I guess, it'd be a bit too hard to explain what I know of audio....

12 Name: #!/usr/bin/anonymous : 2008-07-26 01:47 ID:NbDLqk+V

OpenAL's pretty good. The way it handles streamed audio may be a bit odd if you're used to buffer filling callbacks, etc. but it works.

Basically you create a few OpenAL sample objects (or whatever they were called) and put them in a sound source object's queue for playback. They'll play seamlessly, and you can query about samples that already got played. Fill those with more audio and add them back to the queue. Maybe it uses a few more kilobytes of RAM than manually filling a buffer, maybe not, but at least it won't start looping a short piece of sound if something delays your program from handling the audio.

Note that some old nForce boards with Realtek audio and Nvidia's audio drivers will BSOD if you init and use OpenAL in hardware mode too many times without rebooting. Nvidia never gave a shit, but you can work around it by forcing OpenAL to init in software more; I doubt the integrated shit's drivers do anything relevant in hardware anyway.

This thread has been closed. You cannot post in this thread any longer.