SIGN IN YOUR ACCOUNT TO HAVE ACCESS TO DIFFERENT FEATURES

FORGOT YOUR PASSWORD?

FORGOT YOUR DETAILS?

AAH, WAIT, I REMEMBER NOW!
  • LOGIN

ProtoSupplies

  • HOME
  • SHOP
    • Arduino, Teensy & IOT
    • Audio & Video
    • Breadboards & Supplies
    • Breakout Modules
    • Cables and Wires
    • Communications & Interfacing
    • Connectors & Headers
    • Displays, LEDs & Panel Meters
    • Fans & Hardware
    • ICs & Semiconductors
    • Passive Components
    • PCBs – Prototype & Adapter
    • Power Supplies & Converters
    • Proximity, Distance and Collision
    • Relays, MOSFETs & Power Ctrl
    • Robotics, Motors & Motion
    • Sensors
    • Supplies & Consumables
    • Switches & User Input
    • Temperature & Humidity
    • Test, Tools & Test Accessories
  • LEARN
  • TECH
    • Guide To Solderless Breadboards
    • Determining Unknown I2C Addresses
    • Determining LED Resistor Values
    • DC-DC Step-Down Converter Overview
    • s
  • BLOG
  • INFO
    • About Us
    • FAQ
    • My Account
    • Contact Us
  • MY CART
    No products in cart.

Home » Tutorials » Audio Tutorials and Workshop » Audio Workshop 10

May 17, 2025

Audio Workshop 10

Audio Workshop 10

< Audio Workshop 9 – Simple Delay
Audio Workshop 11 – Filters >

Feedback (Echo) Delay

Most audio systems connect all their wires in forward (left to right) direction. However, backward feedback (right to left) wires are possible, especially to turn a delay into a repeating echo.

Design the Audio System

In this example, we’ll use a mixer to provide a feedback path for the delay. The mixer passes the audio to the delay which delays it by 400ms. The audio is then sent to the headphones and is also passed back to the mixer where it is then fed back into the delay again. The gain on the mixer will determine how quickly the audio fades with each echo.

Draw the system below.

Turn the Design into Code and Use it in a Program

Copy and paste the code below into an IDE window. There are only minor pin number changes from the Part_2_06_Feedback_Delay example in the IDE.

// Advanced Microcontroller-based Audio Workshop
//
// http://www.pjrc.com/store/audio_tutorial_kit.html
// https://hackaday.io/project/8292-microcontroller-audio-workshop-had-supercon-2015
// 
// Part 2-6: Feedback (Echo) Delay
// ProtoSupplies.com Changes and Additions
//    Change pin #'s to match tutorial adapter


///////////////////////////////////
// copy the Design Tool code here
///////////////////////////////////


#include <Bounce.h>

Bounce button0 = Bounce(3, 5);
//===============================================================================
//  Initialization
//===============================================================================
void setup() {
  Serial.begin(9600);
  pinMode(3, INPUT_PULLUP);
  AudioMemory(160);
  sgtl5000_1.enable();
  sgtl5000_1.volume(0.55);
  sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);
  sgtl5000_1.micGain(36);
  mixer1.gain(0, 0.5);
  mixer1.gain(3, 0.7);
  delay1.delay(0, 400);
  delay(1000);
}
//===============================================================================
//  Main
//===============================================================================
void loop() {
  // uncomment for VR2/A3 knob to control the feedback level
  /*
  int knob = analogRead(A3);
  float feedback = (float)knob / 1050.0;
  mixer1.gain(3, feedback);
  */

  // uncomment for button0 to double the feedback (allowing unstable)
  /*
  button0.update();
  if (button0.read() == LOW) {
    mixer1.gain(3, feedback * 2.0);
  }
  */
}

Now Export and copy and paste the Design Tool code into the program to complete it and verify and upload the program to the Teensy.

Now when you run the example, you’ll clearly hear a repeating echo that gradually diminishes. The amount of feedback at channel 3 on mixer1 controls how much weaker the signal becomes each time it echoes, which in turn affects the number of echoes heard.

  mixer1.gain(3, 0.7);

Experiment with Different Feedback Gain

Uncomment the two blocks of code in loop(). The first part allows the VR2/A3 knob to adjust the feedback level. If you turn the knob all the way up (clockwise), the feedback will be very close to 1.0. Each time the sound circulates back through the loop, it is reduced only slightly, so it keeps echoing for a very long time. If it is rotated all the way down, the echo goes away completely.

  // uncomment for VR2/A3 knob to control the feedback level
 
  int knob = analogRead(A3);
  float feedback = (float)knob / 1050.0;
  mixer1.gain(3, feedback);

Unstable Feedback Loops

Feedback signals are risky if the total signal gain around the loop is ever more than 1.0. If the signal becomes stronger each time it travels around the loop, it will grow without bound, until clipping. This is called an unstable feedback loop.

To experiment with an unstable loop, press and hold the left button (BTN0) to double the feedback. If the knob is turned up past halfway, the result is an unstable loop.

  // uncomment for button0 to double the feedback (allowing unstable)

  button0.update();
  if (button0.read() == LOW) {
    mixer1.gain(3, feedback * 2.0);
  }

In natural echo, the sound decreases but also changes as it echoes. You can create a similar effect by adding a filter object in the feedback path. Each pass around the loop will decrease the signal and also decreases its high frequencies even more, to achieve a very natural echo effect. Combinations of looped delay (a loop within the loop) can create rich reverb effects.

In the next tutorial we’ll take a look at basic filters for attenuating a portion of the audio spectrum.

< Audio Workshop 9 – Simple Delay
Audio Workshop 11 – Filters >

PRODUCT SEARCH

PRODUCT CATEGORIES

  • Arduino, Teensy & IOT
  • Audio & Video
  • Breadboards & Supplies
  • Breakout Modules
  • Cables & Wires
  • Communications & Interfacing
  • Connectors & Headers
  • Displays, LEDs & Panel Meters
  • Fans & Hardware
  • ICs & Semiconductors
  • Passive Components
  • PCBs - Prototype & Adapter
  • Power Supplies & Converters
  • Proximity, Distance & Collision
  • Relays, MOSFETs & Power Ctrl
  • Robotics, Motors & Motion
  • Sensors
  • Supplies & Consumables
  • Switches & User Input
  • Temperature & Humidity
  • Test, Tools & Test Accessories

Pay Additional Charges

Dollar SignClick to add additional charges to your order

Recent Blog Entries

  • Teensy 4.1 Low Profile Headers with Sockets

    Teensy 4.1 and Teensy 4.0 Low Profile Options: New Lows in Custom PCB Design

    We often get customer requests for providing lo...
  • Project System with Acrylic

    Project System for Teensy 4.1 Now Available

    We have just introduced our new Project System ...

Fine Print

  • Terms of Service
  • Shipping & Returns
credit-card-paypal-logos
RapidSSL_SEAL-90x50

GET IN TOUCH

Email: support@protosupplies.com

ProtoSupplies.com / ReefCorner Inc
Veteran Owned and Operated
Lake Stevens WA 98258, USA

  • Terms of Service
  • Shipping & Returns

© 2025 All rights reserved.

TOP