#15352 - ramirez - Wed Jan 21, 2004 8:50 am
Well, I am becoming more interested about audio programmg, and I thought about buying a book about it, and what I want is a recommendation for a good book.
I'd like to have a book that covers the information needed for writing your own mixers (the sample handling etc.)
I'd also like to notice that I am a beginner when it comes to audio programming, so I don't want a book that is meant for hardcore audio programmers, if you get my point. :)
If the book covers theory and the things needed for programming the stuff, that'd be great.
Thanks.
#15397 - animension - Thu Jan 22, 2004 12:15 am
Ramirez:
Mixing multiple channels of audio as an abstract concept involves 4 steps:
1) Read sample from each channel compensating for differences in the the audio sample's frequency to the mixing frequency (eg, if you are mixing at 16KHz and sampling a 22KHz audio file, you need to skip a few samples of the wave data otherwise the sample will playback at a slower rate than originally digitized. Mixing at a higher frequency than the audio was originally digitized requires some sort of interpolation -- creating new samples where they didn't exist in the original file).
2) Add the values of these samples together
3) Decide what to do if the total value of all samples from each channel goes above the maximum value; viz, if you add the values of the samples from several channels and their totals go above +127 (max signed 8-bit value), you want to do something so it doesn't go above 127, either by clipping the total down to 127 or scaling it by taking the total and averaging based on the number of samples mixed.
4) Add the mixed sample to the inactive buffer and repeat from step 1 for as many samples as you want to mix at once.
That's all there is to it, really. Other things like volume adjusting and panning entail scaling the audio's sample to a ratio prior to that channel's sample being added to the total of all channels' samples.
Most audio processing theory can be learned from general digital signal processing books. However, a lot of these books contain a heavy amount of mathematics, so if you are new to DSP and want to avoid being innundated by lengthy mathematical proofs, etc, I suggest a book that doesn't delve so deep in math but focuses on explaining the how's and why's of DSP. I recall seeing several books on Amazon's website that are along these lines, but as I don't have time to find them and link to them, you'll have to search there.
Hope this helps.
_________________
"Beer is proof that God loves us and wants us to be happy."
-- Benjamin Franklin
#15410 - ramirez - Thu Jan 22, 2004 6:56 am
Ok, thanks.
I downloaded the game with source, didn't take a look at the source yet, but I must admit that game truly is amazing.
Thanks a lot.
EDIT. In what mode that was coded in?