Learning to work with audio in C++


Question

My degree was in audio engineering, but I'm fairly new to programming. I'd like to learn how to work with audio in a programming environment, partly so I can learn C++ better through interesting projects.

First off, is C++ the right language for this? Is there any reason I shouldn't be using it? I've heard of Soundfile and some other libraries - what would you recommend?

Finally, does anyone know of any good tutorials in this subject? I've learnt the basics of DSP - I just want to program it!

EDIT: I use Windows. I'd like to play about with real-time stuff, a bit like Max/MSP but with more control.

1
32
4/3/2009 12:28:15 PM

Accepted Answer

It really depends on what kind of audio work you want to do, If you want to implement audio for a game, C++ is sure the right language. There are many libraries around, OpenAL is great, free and multiplatform. I also used DirectSound and Fmod with great sucess. Check them out, it all depends on your needs.

14
4/2/2009 8:06:55 PM

If you do decide to use C++, then The Synthesis Toolkit is worth noting. I use it for a schoolproject and it is very usable, developed at stanford university, crossplatform (win, mac and linux), free and opensource. An extract from the wikipedia page on it:

Versions of the STK instrument classes have been integrated into ChucK, Csound, Real-Time Cmix, Max/MSP (as part of PeRColate) and SuperCollider

They have a lot of testcode included + on the site are some tutorials to get started with their library. (But you do have to know some C++ of course)

STK has some classed to read/write audio files (and matlab files), realtime audio/midi io, some basic algorithms (usage based on similar functions out of matlab), ...


Another obvious option and probably THE most used environment to learn/test dsp stuff is Matlab (or free octave, but i havent used it before). I sometimes test stuff out in Matlab before implementing it in C++.


EDIT: In the past year I've been using JUCE which is a pretty cool C++ library centered around C++ audio programming, though its more leaning towards something like QT. One of their developers (Timur Doumler) has a nice talk about real time audio with C++ and JUCE on CppCon 2015, definitely worth checking out, even if you don't end up using JUCE: https://youtu.be/boPEO2auJj4


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon