Monday, March 20, 2017

Teensy 3.6 Basics: Audio Delay

Overview
The Teensy 3.x is able to use an extensive Audio library. This includes using an analog input as an audio ADC, an analog output as an audio DAC, and then having delay line or multiple delay lines between.

The infrastructure of using the delay object of the Audio library as part of Arduino code can be created, edited and viewed visually using the Audio System Design Tool.

The maximum delay time for one delay object is 425ms. Note that delay requires a substantial amount of memory, however the delay line object will dynamically adjust memory allocation depending on use.




Hardware Setup
The audio signal can be captured by the Teensy using the A2 input and then output by DAC0, as labelled here.

The tip of an audio plug is connected to A2, with the sleeve going to ground. This is the input signal, and can be connected to the output of an electric guitar, a computer, a phone, a synth or a drum machine etc.

The tip of another audio plug is connected to DAC0, with the sleeve going to ground. This audio plug is the output signal, and should be connected to a mixer, sound card or powered speakers.



In this photo, the green alligator lead is connected to the tip of the audio input source. The white alligator lead is connected to the sleeve of the audio input source. The yellow alligator lead is connected to the tip of the audio output destination. The blue alligator lead is connected to the sleeve of the audio output destination. A mono 6.5mm jack (or suitable size) is sufficient for making audio connections.




Software Setup
The effects patch can be visually created using the Audio System Design Tool. In general, the output of the ADC object is connected to the input of one or more audio delay lines, which may also, in turn, be connected to other audio effects or mixer objects.





Example 1 - Dry Signal and Single Delay Line
In this example, a dry signal is mixed with a delayed signal using a mixer object.




Download here: http://milkcrate.com.au/_other/downloads/arduino/teensy_3_6_basics/Audio_Delay_Example_1/







Example 2 - Eight Delay Lines
In this example, one delay object with eight delay lines has each delay line set to successive values 50ms time and -12.5% gain apart. Note the use of the "for" loop.






Download here: http://milkcrate.com.au/_other/downloads/arduino/teensy_3_6_basics/Audio_Delay_Example_2/








Example 3 - Single Delay Line with Feedback
In this example, a single delay line is routing back into itself with a mixer object, resulting in delayed feedback.



Download here: http://milkcrate.com.au/_other/downloads/arduino/teensy_3_6_basics/Audio_Delay_Example_3/







Summary
The Teensy supports audio delay effects by using the Delay object. Each Delay object can support up to eight delay lines. The maximum delay length for a given Delay object is 425 milliseconds.

0 comments: