Designing Audio Effect Plug-Ins in C++

Book description

Not just another theory-heavy digital signal processing book, nor another dull build-a-generic-database programming book, Designing Audio Effect Plug-Ins in C++ gives you everything you everything you need to know to do just that, including fully worked, downloadable code for dozens of professional audio effect plug-ins and practically presented algorithms. With this book, you get access to a companion website where you can download the accompanying Rapid Plug-In Development software to compile and test the book examples, all the code examples, and view student plug-ins and tutorial videos on the development software. Start with an intuitive and practical introduction to the digital signal processing (DSP) theory behind audio plug-ins, and quickly move on to plug-in implementation, gain knowledge of algorithms on filtering, delay, reverb, modulated effects, dynamics processing, and more. You will then be ready to design and implement your own unique plug-ins on any platform and within most any host program.

Readers are expected to have some knowledge of C++, and high school math.

Table of contents

  1. Front Cover
  2. Half Title
  3. Title Page
  4. Copyright
  5. Dedication
  6. Contents
  7. Introduction
  8. Chapter 1: Digital Audio Signal Processing Principles
    1. 1.1 Acquisition of Samples
    2. 1.2 Reconstruction of the Signal
    3. 1.3 Signal Processing Systems
    4. 1.4 Synchronization and Interrupts
    5. 1.5 Signal Processing Flow
    6. 1.6 Numerical Representation of Audio Data
    7. 1.7 Using Floating-Point Data
    8. 1.8 Basic DSP Test Signals
      1. 1.8.1 DC and Step
      2. 1.8.2 Nyquist
      3. 1.8.3 ½ Nyquist
      4. 1.8.4 ¼ Nyquist
      5. 1.8.5 Impulse
    9. 1.9 Signal Processing Algorithms
    10. 1.10 Bookkeeping
    11. 1.11 The One-Sample Delay
    12. 1.12 Multiplication
    13. 1.13 Addition and Subtraction
    14. 1.14 Algorithm Examples and the Difference Equation
    15. 1.15 Gain, Attenuation, and Phase Inversion
    16. 1.16 Practical Mixing Algorithm
    17. Bibliography
  9. Chapter 2: Anatomy of a Plug-In
    1. 2.1 Static and Dynamic Linking
    2. 2.2 Virtual Address Space and DLL Access
    3. 2.3 C and C++ Style DLLs
    4. 2.4 Maintaining the User Interface
    5. 2.5 The Applications Programming Interface
    6. 2.6 Typical Required API Functions
    7. 2.7 The RackAFX Philosophy and API
      1. 2.7.1 __stdcall
    8. Bibliography
  10. Chapter 3: Writing Plug-Ins with RackAFX
    1. 3.1 Building the DLL
    2. 3.2 Creation
    3. 3.3 The GUI
    4. 3.4 Processing Audio
    5. 3.5 Destruction
    6. 3.6 Your First Plug-Ins
      1. 3.6.1 Project: Yourplugin
      2. 3.6.2 Yourplugin GUI
      3. 3.6.3 Yourplugin.h File
      4. 3.6.4 Yourplugin.cpp File
      5. 3.6.5 Building and Testing
      6. 3.6.6 Creating and Saving Presets
      7. 3.6.7 GUI Designer
    7. 3.7 Design a Volume Control Plug-In
    8. 3.8 Set Up RackAFX for Use
    9. 3.9 Setup Preferences
      1. 3.9.1 Project: Volume
      2. 3.9.2 Volume GUI
      3. 3.9.3 Configure a Slider Control
      4. 3.9.4 Volume.h File
      5. 3.9.5 Volume.cpp File
    10. 3.10 Design a Volume-in-dB Plug-In
      1. 3.10.1 Project: VolumedB
      2. 3.10.2 VolumedB GUI
      3. 3.10.3 VolumedB.h File
      4. 3.10.4 VolumedB.cpp File
    11. 3.11 Design a High-Frequency Tone Control Plug-In
      1. 3.11.1 Project: SimpleHPF
      2. 3.11.2 SimpleHPF GUI
      3. 3.11.3 SimpleHPF.h File
      4. 3.11.4 SimpleHPF.cpp File
    12. 3.12 Design a High-Frequency Tone Control with Volume Plug-In
      1. 3.12.1 Project: SimpleHPF
      2. 3.12.2 SimpleHPF GUI
      3. 3.12.3 SimpleHPF.h File
      4. 3.12.4 SimpleHPF.cpp File
    13. 3.13 The User Plug-In Menu in RackAFX
  11. Chapter 4: How DSP Filters Work
    1. 4.1 First-Order Feed-Forward Filter
    2. 4.2 Design a General First-Order Feed-Forward Filter
    3. 4.3 First-Order Feed-Back Filter
    4. 4.4 Design a General First-Order Feed-Back Filter
      1. 4.4.1 Project FeedBackFilter
      2. 4.4.2 FeedBackFilter GUI
      3. 4.4.3 FeedBackFilter.h File
      4. 4.4.4 FeedBackFilter.cpp File
    5. 4.5 Observations
      1. 4.5.1 General
      2. 4.5.2 Feed-Forward Filters
      3. 4.5.3 Feed-Back Filters
    6. Bibliography
  12. Chapter 5: Basic DSP Theory
    1. 5.1 The Complex Sinusoid
    2. 5.2 Complex Math Review
    3. 5.3 Time Delay as a Math Operator
    4. 5.4 First-Order Feed-Forward Filter Revisited
      1. 5.4.1 Negative Frequencies
      2. 5.4.2 Frequencies Above and Below ±Nyquist
    5. 5.5 Evaluating the Transfer Function H(ω)
      1. 5.5.1 DC (0 Hz)
      2. 5.5.2 Nyquist (π)
      3. 5.5.3 ½ Nyquist (π/2)
      4. 5.5.4 ¼ Nyquist (π/4)
    6. 5.6 Evaluating ejω
    7. 5.7 The z Substitution
    8. 5.8 The z Transform
    9. 5.9 The z Transform of Signals
    10. 5.10 The z Transform of Difference Equations
    11. 5.11 The z Transform of an Impulse Response
    12. 5.12 The Zeros of the Transfer Function
    13. 5.13 Estimating the Frequency Response: Zeros
    14. 5.14 Filter Gain Control
    15. 5.15 First-Order Feed-Back Filter Revisited
    16. 5.16 The Poles of the Transfer Function
      1. 5.16.1 DC (0 Hz)
      2. 5.16.2 Nyquist (π)
      3. 5.16.3 ½ Nyquist (π/2)
      4. 5.16.4 ¼ Nyquist (π/4)
    17. 5.17 Second-Order Feed-Forward Filter
      1. 5.17.1 DC (0 Hz)
      2. 5.17.2 Nyquist (π)
      3. 5.17.3 ½ Nyquist (π/2)
      4. 5.17.4 ¼ Nyquist (π/4)
    18. 5.18 Second-Order Feed-Back Filter
      1. 5.18.1 DC (0 Hz)
      2. 5.18.2 Challenge
    19. 5.19 First-Order Pole-Zero Filter: The Shelving Filter
      1. 5.19.1 DC (0 Hz)
      2. 5.19.2 Challenge
    20. 5.20 The Bi-Quadratic Filter
    21. Bibliography
  13. Chapter 6: Audio Filter Designs: IIR Filters
    1. 6.1 Direct z-Plane Design
    2. 6.2 Single Pole Filters
      1. 6.2.1 First-Order LPF and HPF
    3. 6.3 Resonators
      1. 6.3.1 Simple Resonator
      2. 6.3.2 Smith-Angell Improved Resonator
    4. 6.4 Analog Filter to Digital Filter Conversion
      1. 6.4.1 Challenge
    5. 6.5 Effect of Poles or Zeros at Infinity
    6. 6.6 Generic Bi-Quad Designs
      1. 6.6.1 First-Order LPF and HPF
      2. 6.6.2 Second-Order LPF and HPF
      3. 6.6.3 Second-Order BPF and BSF
      4. 6.6.4 Second-Order Butterworth LPF and HPF
      5. 6.6.5 Second-Order Butterworth BPF and BSF
      6. 6.6.6 Second-Order Linkwitz-Riley LPF and HPF
      7. 6.6.7 First- and Second-Order APF
    7. 6.7 Audio Specific Filters
      1. 6.7.1 Modified Bi-Quad
      2. 6.7.2 First-Order Shelving Filters
      3. 6.7.3 Second-Order Parametric/Peaking Filter: Non-Constant-Q
      4. 6.7.4 Second-Order Parametric/Peaking Filter: Constant-Q
      5. 6.7.5 Cascaded Graphic EQ: Non-Constant-Q
      6. 6.7.6 Cascaded Graphic EQ: Constant-Q
    8. 6.8 Design a Resonant LPF Plug-In
      1. 6.8.1 Project: ResonantLPF
      2. 6.8.2 ResonantLPF GUI
      3. 6.8.3 ResonantLPF.h File
      4. 6.8.4 ResonantLPF.cpp File
    9. 6.9 The Massberg Analog-Matched Low-Pass Filter
      1. 6.9.1 First-Order Massberg LPF
      2. 6.9.2 Second-Order Massberg LPF
    10. Bibliography
    11. References
  14. Chapter 7: Delay Effects and Circular Buffers
    1. 7.1 The Basic Digital Delay
    2. 7.2 Digital Delay with Wet/Dry Mix
      1. 7.2.1 Frequency and Impulse Responses
      2. 7.2.2 The Effect of Feedback
    3. 7.3 Design a DDL Module Plug-In
      1. 7.3.1 Project: DDLModule
      2. 7.3.2 DDLModule GUI
      3. 7.3.3 DDLModule.h File
      4. 7.3.4 DDLModule.cpp File
      5. 7.3.5 Declare and Initialize the Delay Line Components
      6. 7.3.6 DDLModule.h File
      7. 7.3.7 DDLModule.cpp File
    4. 7.4 Modifying the Module to Be Used by a Parent Plug-In
      1. 7.4.1 DDLModule.h File
      2. 7.4.2 DDLModule.cpp File
    5. 7.5 Modifying the Module to Implement Fractional Delay
      1. 7.5.1 DDLModule.cpp File
    6. 7.6 Design a Stereo Digital Delay Plug-In
      1. 7.6.1 Project: StereoDelay
      2. 7.6.2 StereoDelay GUI
      3. 7.6.3 StereoDelay.h File
      4. 7.6.4 StereoDelay.cpp File
    7. 7.7 Design a Stereo Crossed-Feedback Delay Plug-In
    8. 7.8 Enumerated Slider Variables
      1. 7.8.1 Constructor
      2. 7.8.2 PrepareForPlay()
      3. 7.8.3 UserInterfaceChange()
      4. 7.8.4 ProcessAudioFrame()
    9. 7.9 More Delay Algorithms
      1. 7.9.1 Advanced DDL Module
      2. 7.9.2 Delay with LPF in Feedback Loop
      3. 7.9.3 Multi-Tap Delay
      4. 7.9.4 Ping-Pong Delay
      5. 7.9.5 LCR Delay
    10. Bibliography
  15. Chapter 8: Audio Filter Designs: FIR Filters
    1. 8.1 The IR Revisited: Convolution
    2. 8.2 Using RackAFX’s Impulse Convolver
      1. 8.2.1 Loading IR Files
      2. 8.2.2 Creating IR Files
      3. 8.2.3 The IR File Format
    3. 8.3 Using RackAFX’s FIR Designer
    4. 8.4 The Frequency Sampling Method
      1. 8.4.1 Linear-Phase FIR Using the Frequency Sampling Method
    5. 8.5 Complementary Filter Design for Linear Phase FIR Filters
    6. 8.6 Using RackAFX’s Frequency Sampling Method Tool
    7. 8.7 Designing a Complementary Filter
    8. 8.8 The Optimal (Parks-McClellan) Method
    9. 8.9 Using RackAFX’s Optimal Method Tool
    10. 8.10 Design a Convolution Plug-In
      1. 8.10.1 Project: Convolver
      2. 8.10.2 Convolver.h File
      3. 8.10.3 Convolver.cpp File
    11. 8.11 Numerical Method FIR Filters
      1. 8.11.1 Moving Average Interpolator
      2. 8.11.2 Lagrange Interpolator
      3. 8.11.3 Median Filter
    12. Bibliography
  16. Chapter 9: Oscillators
    1. 9.1 Direct Form Oscillator
      1. 9.1.1 Initial Conditions
    2. 9.2 Design a Direct Form Oscillator Plug-In
      1. 9.2.1 Project: DirectOscillator
      2. 9.2.2 DirectOscillator GUI
      3. 9.2.3 DirectOscillator.h File
      4. 9.2.4 DirectOscillator.cpp File
      5. 9.2.5 Improving the Oscillator Design
    3. 9.3 The Gordon-Smith Oscillator
    4. 9.4 Wave Table Oscillators
    5. 9.5 Design a Wave Table Oscillator Plug-In
      1. 9.5.1 Project: WTOscillator
      2. 9.5.2 WTOscillator GUI
      3. 9.5.3 WTOscillator.h File
      4. 9.5.4 WTOscillator.cpp File
    6. 9.6 Adding More Wave Tables
      1. 9.6.1 WTOscillator.h File
      2. 9.6.2 WTOscillator.cpp File
      3. 9.6.3 WTOscillator GUI
      4. 9.6.4 WTOscillator.h File
      5. 9.6.5 WTOscillator.cpp File
    7. 9.7 Band-Limited Additive Wave Tables
      1. 9.7.1 WTOscillator GUI
      2. 9.7.2 WTOscillator.h File
      3. 9.7.3 WTOscillator.cpp File
      4. 9.7.4 Saw-Tooth
      5. 9.7.5 Square Wave
    8. 9.8 Additional Oscillator Features (LFO)
      1. 9.8.1 WTOscillator.h File
      2. 9.8.2 WTOscillator.cpp File
      3. 9.8.3 WTOscillator.h File
      4. 9.8.4 WTOscillator.cpp File
    9. 9.9 Bipolar/Unipolar Functionality
      1. 9.9.1 WTOscillator GUI
      2. 9.9.2 WTOscillator.cpp File
    10. Bibliography
  17. Chapter 10: Modulated Delay Effects
    1. 10.1 The Flanger/Vibrato Effect
    2. 10.2 The Chorus Effect
    3. 10.3 Design a Flanger/Vibrato/Chorus Plug-In
      1. 10.3.1 Project: ModDelayModule
      2. 10.3.2 ModDelayModule GUI
      3. 10.3.3 ModDelayModule.h File
      4. 10.3.4 ModDelayModule.cpp File
      5. 10.3.5 PrepareForPlay()
      6. 10.3.6 Challenge
    4. 10.4 Design a Stereo Quadrature Flanger Plug-In
      1. 10.4.1 Project: StereoQuadFlanger
      2. 10.4.2 StereoQuadFlanger GUI
      3. 10.4.3 StereoQuadFlanger.h File
      4. 10.4.4 StereoQuadFlanger.cpp File
      5. 10.4.5 Challenges
    5. 10.5 Design a Multi-Unit LCR Chorus Plug-In
      1. 10.5.1 Project: StereoLCRChorus
      2. 10.5.2 StereoLCRChorus GUI
      3. 10.5.3 StereoLCRChorus.h File
      4. 10.5.4 StereoLCRChorus.cpp File
    6. 10.6 More Modulated Delay Algorithms
      1. 10.6.1 Stereo Cross-Flanger/Chorus (Korg Triton®)
      2. 10.6.2 Multi-Flanger (Sony DPS-M7®)
      3. 10.6.3 Bass Chorus
      4. 10.6.4 Dimension-Style (Roland Dimension D®)
      5. 10.6.5 Deca-Chorus (Sony DPS-M7®)
    7. Bibliography
  18. Chapter 11: Reverb Algorithms
    1. 11.1 Anatomy of a Room Impulse Response
      1. 11.1.1 RT60: The Reverb Time
    2. 11.2 Echoes and Modes
    3. 11.3 The Comb Filter Reverberator
    4. 11.4 The Delaying All-Pass Filter Reverberator
    5. 11.5 More Delaying All-Pass Filter Reverberators
    6. 11.6 Schroeder’s Reverberator
    7. 11.7 The Low-Pass Filter–Comb Reverberator
    8. 11.8 Moorer’s Reverberator
    9. 11.9 Stereo Reverberation
    10. 11.10 Gardner’s Nested APF Reverberators
    11. 11.11 Modulated APF and Comb/APF Reverb
    12. 11.12 Dattorro’s Plate Reverb
    13. 11.13 Generalized Feedback Delay Network Reverbs
    14. 11.14 Other FDN Reverbs
    15. 11.15 An Example Room Reverb
    16. 11.16 RackAFX Stock Objects
      1. 11.16.1 COnePoleLPF
      2. 11.16.2 CDelay
      3. 11.16.3 CCombFilter
      4. 11.16.4 CLPFCombFilter
      5. 11.16.5 CDelayAPF
    17. 11.17 Design the Room Reverb
      1. 11.17.1 Project: Reverb
      2. 11.17.2 Reverb GUI
      3. 11.17.3 Reverb.h
      4. 11.17.4 Reverb.cpp
    18. 11.18 Challenge
    19. Bibliography
    20. References
  19. Chapter 12: Modulated Filter Effects
    1. 12.1 Design a Mod Filter Plug-In: Part I Modulated fc
      1. 12.1.1 Project: ModFilter
      2. 12.1.2 ModFilter GUI
      3. 12.1.3 ModFilter.h File
      4. 12.1.4 ModFilter.cpp File
    2. 12.2 Design a Mod Filter Plug-In: Part II, Modulated fc, Q
      1. 12.2.1 ModFilter GUI
      2. 12.2.2 ModFilter.h File
      3. 12.2.3 ModFilter.cpp File
    3. 12.3 Design a Mod Filter Plug-In: Part III, Quad-Phase LFOs
      1. 12.3.1 ModFilter GUI
      2. 12.3.2 ModFilter.cpp File
    4. 12.4 Design an Envelope Follower Plug-In
    5. 12.5 Envelope Detection
      1. 12.5.1 Project EnvelopeFollower
      2. 12.5.2 EnvelopeFollower GUI
      3. 12.5.3 EnvelopeFollower.h File
      4. 12.5.4 EnvelopeFollower.cpp File
    6. 12.6 Design a Phaser Plug-In
      1. 12.6.1 Project Phaser
      2. 12.6.2 Phaser GUI
      3. 12.6.3 Phaser.h File
      4. 12.6.4 Phaser.cpp File
    7. 12.7 Design a Stereo Phaser with Quad-Phase LFOs
      1. 12.7.1 Phaser GUI
      2. 12.7.2 Phaser.h File
      3. 12.7.3 Phaser.cpp File
    8. Bibliography
    9. References
  20. Chapter 13: Dynamics Processing
    1. 13.1 Design a Compressor/Limiter Plug-In
      1. 13.1.1 Project: DynamicsProcessor
      2. 13.1.2 DynamicsProcessor: GUI
      3. 13.1.3 DynamicsProcessor.h File
      4. 13.1.4 DynamicsProcessor.cpp File
      5. 13.1.5 DynamicsProcessor.cpp File
    2. 13.2 Design a Downward Expander/Gate Plug-In
      1. 13.2.1 DynamicsProcessor.h File
      2. 13.2.2 DynamicsProcessor.cpp File
    3. 13.3 Design a Look-Ahead Compressor Plug-In
      1. 13.3.1 DynamicsProcessor: GUI
      2. 13.3.2 DynamicsProcessor.h File
      3. 13.3.3 DynamicsProcessor.cpp File
    4. 13.4 Stereo-Linking the Dynamics Processor
      1. 13.4.1 DynamicsProcessor: GUI
      2. 13.4.2 DynamicsProcessor.cpp File
    5. 13.5 Design a Spectral Compressor/Expander Plug-In
      1. 13.5.1 Project: SpectralDynamics
      2. 13.5.2 SpectralDynamics: GUI
      3. 13.5.3 Additional Slider Controls
      4. 13.5.4 Spectral Dynamics Buttons
      5. 13.5.5 Spectral Dynamics Metering
      6. 13.5.6 SpectralDynamics.h File
      7. 13.5.7 SpectralDynamics.cpp File
    6. 13.6 Alternate Side-Chain Configurations
    7. Bibliography
    8. References
  21. Chapter 14: Miscellaneous Plug-Ins
    1. 14.1 Design a Tremolo/Panning Plug-In
      1. 14.1.1 Project: TremoloPanner
      2. 14.1.2 TremoloPanner: GUI
    2. 14.2 Design a Ring Modulator Plug-In
      1. 14.2.1 Project: RingModulator
      2. 14.2.2 RingModulator: GUI
      3. 14.2.3 RingModulator.h File
      4. 14.2.4 RingModulator.cpp File
    3. 14.3 Design a Wave Shaper Plug-In
      1. 14.3.1 Project: WaveShaper
      2. 14.3.2 WaveShaper: GUI
    4. Bibliography
  22. Appendix A: The VST® and AU® Plug-In APIs
    1. A.1 Compiling as a VST Plug-In in Windows
    2. A.2 Wrapping Your RackAFX Plug-In
    3. A.3 Comparison of Objects/Methods/GUIs
    4. A.4 VST Plug-In without Wrapping
      1. A.4.1 Default GUI
      2. A.4.2 Signal Processing
    5. A.5 VST Plug-In with RackAFX Wrapping
      1. A.5.1 Default GUI
    6. A.6 AU Overview
      1. A.6.1 Default GUI
      2. A.6.2 Signal Processing
  23. Appendix B: More RackAFX Controls and GUI Designer
    1. B.1 The Alpha Wheel and LCD Control
    2. B.2 The Vector Joystick Control
    3. B.3 Using the sendUpdateGUI() Method
    4. B.4 Using GUI Designer
  24. Index

Product information

  • Title: Designing Audio Effect Plug-Ins in C++
  • Author(s): Will Pirkle
  • Release date: November 2012
  • Publisher(s): Focal Press
  • ISBN: 9781136699764