Lecciones y el juego de aprendizaje

Construye un pedal de efectos digital

Un pedal de efectos para guitarra en un Uno, con un generador de funciones para la guitarra.

El pedal terminado

Construir un pedal de efectos digital usa en cada lección la misma placa:

  • The guitar: a generador de funciones, un seno de 220 Hz, 2 V de pico, centrado en 0 V como la señal de una pastilla.
  • The input: a 1 uF capacitor into A0, held at 2.5 V by two 10 k resistors: el sesgo.
  • The brain: an Arduino Uno, su ADC corriendo libre en A0 y el Timer 2 interrumpiendo 15,625 veces por segundo.
  • La salida: PWM de 8 bits a 62.5 kHz en el pin 9, suavizado con 1 k y 100 nF, luego 1 uF a un piezo que muestra el tono que escucha.
  • Controls: a potentiometer on A1, and two interruptores de pie: MUTE on pin 2 stops the strings, FX on pin 3 switches the effect.

Este es un pedal de guitarra digital. Es algo distinto de los pedales de sim racing en Construir pedales de celda de carga.

Cómo funciona

In and out. The capacitor blocks DC and the divider puts the swing in the middle of the ADC's 0 to 5 V; the code subtracts 128 to take the bias off. Each interrupt takes the latest sample, runs the effect and writes OCR1A. The knob is read eight times a second by borrowing the ADC for a sample.

Gain and clipping. Multiply, then limit: hard clipping cuts flat at the rails; soft clipping bends through y = 1.5t - 0.5t^3 first, from a 256-entry table.

Delay. A ring buffer of 1,280 bytes, all the Uno's 2 KB can spare beside the stack: 81 ms at most. Feedback writes some of the echo back for repeats, and MUTE measures the tail.

Tremolo. A slow phase accumulator, an LFO, scales every sample between 1 - depth and 1, as a triangle or a square.

Wah. Chamberlin's state-variable filter in fixed point, its band-pass output swept from 200 Hz to 2 kHz by the knob or by an LFO for auto-wah.

Latency. Sample by sample, the output follows the input within a tick. Working in blocks of 64 or 256 adds 4.1 or 16.4 ms, measured with MUTE.

El curso

  1. Audio de entrada y salida: el sesgo, la oscilación, el muestreo y Nyquist, y por qué una entrada real necesita un búfer.
  2. Gain and clipping: clean gain, hard and soft clipping, and harmonics.
  3. Delay: a ring buffer, feedback, the tail, and the 2 KB limit.
  4. Trémolo: velocidad, profundidad y forma de un LFO.
  5. Wah: un pasa banda barrido, auto-wah y Q.
  6. Latencia: muestra por muestra contra procesamiento por bloques.
  7. Proyecto: un pedal de dos efectos: drive y trémolo en cadena, bypass, y el orden intercambiado.

Cada paso verificado se evalúa contra el circuito en ejecución.