# Block-based Processing

## Segmenting audio into chunks

This lecture is on block-based processing, where audio is segmented into windows rather than processed one sample at a time. The most common use of block-based processing involves taking the Fast Fourier Transform (FFT) of windows of signal. This forms the basis of phase vocoder audio effects, which will be further discussed in the next lecture.

This lecture also covers the use of Bela’s browser-based GUI to make responsive visualisations. The lecture shows how to send data from a Bela program to the GUI.

## Table of contents

- What you’ll learn in this lecture
- What you’ll make in this lecture
- Code examples
- Recommended parts
- Additional references

# Lecture 17: Block-based Processing

## What you’ll learn in this lecture

- Generating and processing windows of a signal
- The Fast Fourier Transform (FFT)
- Sending data to the Bela GUI

## What you’ll make in this lecture

- Two simple spectrum analysers with LEDs and GUI

## Code examples

**fft-led**: Simple project using the FFT to calculate high and low frequency content and blink LEDs. Also shows sending data to the Bela GUI.

**fft-circular-buffer**: Plot a real-time spectrum of the signal using the FFT. Your task is to implement the circular buffer code.

## Recommended parts

Running the examples in this course assumes that you have a Bela Starter Kit or Bela Mini Starter Kit.

This lecture also uses several electronic components:

- Solderless breadboard (Rapid, Adafruit)
- 2x LEDs (any colour) (Rapid, Adafruit)
- 2x 220 ohm resistors (Rapid, Adafruit)
- Jumper wires (Rapid, Adafruit)

## Additional references

Here are some textbooks and other resources related to the Fast Fourier Transform and spectral audio processing:

- Alan V. Oppenheim and Ronald W. Shafer,
*Discrete-Time Signal Processing*, 3rd edition. Publisher link. See also the same class on MIT OpenCourseware. - Julius O. Smith, Mathematics of the Discrete Fourier Transform (DFT) (free online textbook).
- Julius O. Smith, Spectral Audio Signal Processing (free online textbook).
- Joshua D. Reiss and Andrew McPherson,
*Audio Effects: Theory, Implementation and Application*. Publisher link. - Richard Boulanger and Victor Lazzarini, editors,
*The Audio Programming Book*. Publisher link - A visual introduction to the Fourier transform on YouTube from 3Blue1Brown
- Divide and Conquer: the FFT algorithm on YouTube from MIT OpenCourseWare (a mathematical explainer)