Audio Delay for Auditorium Speakers
Introduction: Audio Delay for Auditorium Speakers
Many auditoriums/churches have speaker arrays with speakers at different distances from the stage to reinforce audio throughout the venue. However, the sound reaching a listener from these speakers will come at different times and this can cause a reduction in intelligibility. (Sound travels approximately one foot per millisecond.) The right solution is to delay the sound from speakers further than the stage so that sound reaches a listener at the same time from the multiple speakers.
A neighbourhood church had three sets of speakers in their sanctuary, the main speakers, and two sets of speakers further back (26 feet and 37 feet respectively). Their audio delay hardware was broken and I volunteered to build a replacement (primarily to learn more about audio electronics and microcontrollers, I normally write software).
A quick investigation revealed that PJRC had an Audio Adaptor board for their Teensy microcontrollers that I thought would be appropriate. Furthermore, their Teensy Audio Library would make it easy to develop the software that would be needed.
Supplies
* Teensy 4.0 microcontroller
* Audio Adaptor board
* 0.91" I2C 128x32 OLED module
* rotary encoder with built-in switch x2
* female XLR panel mount connector
* male XLR panel mount connector x2
* M3-10mm screws to mount the XLR connectors x12
* 1/2 sized PCB breadboard
* female headers (14 pin) x2
* header pins
* jumper wires
* metal case (10 cm x 5 cm x 10 cm, 4" x 2" x 4")
* micro USB cable, 3 feet
Step 1: Prototype
The prototype was relatively simple to build. Unsure of my soldering abilities I soldered female headers on the Teensy board (I couldn't find 14-pin headers so the ones I purchased extended beyond the Teensy PCB) and pins on the audio adaptor board. This would allow me to replace one or the other board if my soldering was really bad. (I shouldn't have worried; it was easier than I thought.)
The female headers had extra long pins that allowed me to insert them into the breadboard. I used jumper wires to connect to the rotary encoders on another breadboard. (The encoders themselves didn't sit well in the breadboard resulting in issues when I tried to debug the software.)
I connected a signal generator to the input pins on the audio adaptor board and an oscilloscope probe to the output pins to test the prototype. I measured a latency of about 6 ms.
Step 2: Software
PJRC, which makes the Teensy and the Audio Adaptor board, has a software add-on for the standard Arduino development platform. 1003
For the Mac (which I used to develop this project), it is a single download that combines the PJRC's software along with the Arduino development software.
The combined download should have included the PJRC's Audio library but I didn't see it so I downloaded it directly from Github.
I also needed a driver for the OLED display so I used Adafruit's 1306 and GFX libraries.
Writing the software to produce audio delay was surprisingly easy. PJRC has a graphical Audio System Design Tool that runs in the browser (see image). The various components are on the left-hand side of the web page. When you select a component the right hand side of the page tells you more about it. You drag and drop components into the middle section and draw wires from the inputs and outputs of these components to configure the audio software. Once you are happy with your design you export the design and it creates Arduino code that talks to the audio library that you insert into your project. You then only have to initialize these components to make it work.
In its standard configuration the software has approximately 6 ms delay from input to output. This primarily due to the size of the buffers (128 samples) that the Audio library uses. One can modify Audio library constants to reduce the size of these buffers and consequently reduce this latency however this amount of latency was fine for my project; no one would put a set of auxiliary speakers that close to the main speakers.
I decided to create my own code to interface with the rotary encoders and learn more about Arduino interrupts.
The OLED displays how much delay there is at each of the two outputs. There was more than enough room on the display so I also created a peak meter bar graph for the input signal. Both the Audio Adaptor board and the OLED talk to the Teensy via I2C. The Teensy has multiple I2C buses so I placed the OLED on the second bus so as not to impact the Audio Adaptor board. 1003