Classes and objects
The principles of C++
This lecture explains how to work with C++ classes and objects, while introducing the principles of additive synthesis. The lecture explains why simple digital square and sawtooth oscillators often sound so bad, and how additive synthesis can produce a better sounding oscillator.
Table of contents
- What you’ll learn in this lecture
- What you’ll make in this lecture
- Code examples
- Recommended parts
- Additional references
Lecture 5: Classes and objects
What you’ll learn in this lecture
- Basics of C++ classes
- Working with arrays of objects
- Principles of additive synthesis
What you’ll make in this lecture
- An additive synthesis waveform generator
wavetable-class: implements a wavetable oscillator using a C++ class. Includes linear interpolation and GUI controls for frequency and amplitude.
additive-synth: a partially-complete example creating an additive synthesiser with controllable amplitudes for each harmonic. In the lecture you will fill in the code to process each oscillator.
This lecture does not require any other electronic hardware. However, other lectures will make use of sensors and other components. See Lecture 0 for a list of recommended parts.
Classes in C++
- Online tutorial: C++ Classes at cplusplus.com
- YouTube video: C++ Tutorial for Beginners by freeCodeCamp.org
Band-limited waveform synthesis
- Paper: T. Stilson and J. O. Smith, Alias-Free Digital Synthesis of Classic Analog Waveforms, International Computer Music Conference, 1996.
- Video: The amazing usefulness of band limited impulse trains, shown for oscillator banks, Stefan Stenzel, Audio Developer Conference 2017.
- Blog post: Band-limiting techniques for digital oscillators (metafunction.co.uk)
- Book: Beat Frei, Digital Sound Generation, Institute for Computer Music and Sound Technology (ICST), Zurich University of the Arts, 2019