Counting samples and measuring time

This lecture explains how to measure time when working with real-time audio signals, based on counting samples. The lecture includes some basic circuits to make an adjustable metronome with LED and a step sequencer with a clock.

Table of contents

  1. What you’ll learn in this lecture
  2. What you’ll make in this lecture
  3. Code examples
  4. Recommended parts

Lecture 9: Timing

What you’ll learn in this lecture

  • Counting time with sampled audio
  • Creating delays in real time
  • Events and intervals

What you’ll make in this lecture

  • A metronome and a step sequencer

Code examples

metronome: Code template for creating a metronome that plays an audio sample at regular intervals.

step-sequencer-metronome: An update to the example from Lecture 7, with hooks for you to incorporate a metronome to advance the step.

Running the examples in this course assumes that you have a Bela Starter Kit or Bela Mini Starter Kit. Note that the analog outputs are only available on the original Bela board, and not on Bela Mini.

This lecture also uses several electronic components: