Audio Programming and Syntheis Examples in C/C++:
Feel free to use the following projects as introductory tutorials for audio programming in C++. I created many of these for labs as a TA for MAT 240D. I have tried to include decent commenting in the code, but please see each API's documentation for API specific questions. The following API's are used: JUCE, PortAudio, RTAudio, OpenGL, and STK. Please email me with questions or comments: ryan at mat dot ucsb dot edu.

AM/FM/MIDI:
This is a simple program to demonstrate AM and FM synthesis in a PortAudio callback using JUCE for the GUI. Additionally, I have implemented simple MIDI device control using JUCE's MIDI functions. MIDI notes will change the frequency of the sound playing and MIDI controller knobs/sliders can change the modulation index and modulation frequency.

source
Wavetable Interpolation:
This program demonstrates the audible and visual differences between linear and truncatiing interpoltion in wavetable synthesis. The user can select the table size and interpolation method and then hear and view the resulting wave. Basically, this example illustrates the value and necessity of interpolation with smaller table sizes. It uses JUCE for the GUI, PortAudio for sound, and OpenGL to render the current audio buffer.

source
Playback and Resampling with JUCE:
This program uses the JUCE API for file playback and resampling. I also added control for randomly skipping through the file at a certain rate and transposing the playback by a sinusoidal rate. Also, I added a master "speed" dial that resamples the resulting output.

source
Karplus-Strong (Physical Modeling Synthesis):
This project explores the Karplus-Strong plucked string algorithm. The noise type and g (filer coefficient) can be modified to create different timbres. Additionally, I have implemented a blend factor, b, that creates a very tom drum timbre when close to 0 and a snare-like timbre when close to 0.5. Uses JUCE for the GUI, PortAudio for sound, and OpenGL to view the audio buffer.

source
STK Granulator:
This project creates a JUCE GUI for the STK library's granulator. This uses JUCE's audio callback function rather than PortAudio.

source
Intro to Scanning Synthesis:
This project is a very simple test implementation of scanning synthesis. A sine table is played and visualized while the user can modify the values by pressing the 'M' key to apply a wave-shaping function or draw the waveform by clicking and dragging the mouse. RT Audio and OpenGL are used.

source