Computers are at the center of almost everything related to audio. Whether for synthesis in music production, recording in the studio, or mixing in live sound, the computer plays an essential part. Audio effects plug-ins and virtual instruments are implemented as software computer code. Music apps are computer programs run on a mobile device. All these tools are created by programming a computer.

Hack Audio: An Introduction to Computer Programming and Digital Signal Processing in MATLAB provides an introduction for musicians and audio engineers interested in computer programming. It is intended for a range of readers including those with years of programming experience and those ready to write their first line of code. In the book, computer programming is used to create audio effects using digital signal processing. By the end of the book, readers implement the following effects: signal gain change, digital summing, tremolo, auto-pan, mid/side processing, stereo widening, distortion, echo, filtering, equalization, multi-band processing, vibrato, chorus, flanger, phaser, pitch shifter, auto-wah, convolution and algorithmic reverb, vocoder, transient designer, compressor, expander, and de-esser.

Throughout the book, several types of test signals are synthesized, including: sine wave, square wave, sawtooth wave, triangle wave, impulse train, white noise, and pink noise. Common visualizations for signals and audio effects are created including: waveform, characteristic curve, goniometer, impulse response, step response, frequency spectrum, and spectrogram. In total, over 200 examples are provided with completed code demonstrations.

chapter 1|2 pages


chapter 2|18 pages

Basics of Programming in MATLAB®

chapter 3|10 pages

Basics of Audio in MATLAB®

Creating, Importing, and Indexing Arrays

chapter 4|9 pages

MATLAB® Programming Environment

Command Window, Editor, m-Files, and Documentation

chapter 5|16 pages

Logicals and Control Structures in Programming

Conditional Statements, Loops, and Functions

chapter 6|22 pages

Signal Gain and DC Offset

Element-Wise Processing: Scalar Operations with Arrays

chapter 7|23 pages

Introduction to Signal Synthesis

Element-Wise Processing: Built-In Functions with Arrays

chapter 8|27 pages

Digital Summing, Signal Fades, and Amplitude Modulation

Element-Wise Processing: Arrays Operations with Arrays

chapter 9|16 pages

Stereo Panning and Mid/Side Processing

Element-Wise Processing: Two-Channel Audio

chapter 10|35 pages

Distortion, Saturation, and Clipping

Element-Wise Processing: Nonlinear Effects

chapter 11|22 pages

Echo Effects

Systems with Memory: Audible Delay

chapter 12|30 pages

Finite Impulse Response Filters

Systems with Memory: Spectral Processors (Part 1)

chapter 13|38 pages

Infinite Impulse Response Filters

Systems with Memory: Spectral Processors (Part 2)

chapter 14|19 pages

Delay Buffers and Fractional Delay Interpolation

Linear and Circular Buffers, Linear and Cubic Interpolation

chapter 15|55 pages

Modulated Delay Effects

Vibrato, Chorus, Flanger, Pitch Shifter, and Phaser

chapter 16|31 pages

Algorithmic Reverb Effects

Schroeder, Moorer, and FDN

chapter 17|28 pages

Amplitude Envelope Effects

Envelope Follower, Vocoder, and Transient Designer

chapter 18|46 pages

Dynamic Range Processors

Compressors and Expanders