I decided to start this little blog about my current endeavors into audio programming because since I started, I’ve already learned a great deal of fascinating and wonderful things relating to audio in the analog and, especially, the digital domain. Some of these things I already knew but my understanding of them have deepened, and other concepts are completely new. Sharing this knowledge, the discoveries and the challenges I encounter along the way, seemed like a good idea.
Sound is such an amazing thing! I’ve always known (and been told as I’m sure we all have) that math is a huge part of it — inseperable. But precisely how much, and to what complexity, I didn’t fully know until I dove into audio programming. Advanced trigonometry, integrals, and even complex numbers are all there in the theory behind waveforms and signal processing. Fortunately, math was consistently my best subject in school and trigonometry was one of my favorite areas of it.
What further steered me in this direction was my growing fascination with audio implementation in video games. As I taught myself the various middleware tools used in the industry (FMOD, Wwise and UDK) it really became clear how much I loved it and how interested I was in how the process of implementation and integration of audio in video games could add to the gameplay, immersion and the overall experience.
With that little introduction out of the way, I’ll end this first post with a little example of what I’ve picked up so far. I’m reading through the book “Audio Programming” (Boulanger and Lazzarini), and early on it walks through the process of writing a real-time ring modulator. Building on this I adapted it to accept stereo input/output as it was originally mono. You then input two frequencies (one for the left channel and one for the right channel) that are then modulated with the carrier frequencies of the stereo input signal, and this results in a ring-modulated stereo output signal (ring modulation is a fairly simple DSP effect that just multiplies two signals together producing strong inharmonic partials in the resulting sound, which is usually very bell-like). Here is a snippet of my modified code in which I had to create my own stereo oscillator structure and send it to the callback function that modulates both channels:
And here is a recording of my digital piano being played into the real-time ring modulator (which I did with a single microphone, so the recording is in mono unfortunately):
This is a fairly simple and straightforward example to get things going. Many more awesome discoveries to share in the future!