Audio Delay for Auditorium Speakers

by amanatides in Circuits > Audio

1696 Views, 8 Favorites, 0 Comments

Audio Delay for Auditorium Speakers

IMG_4800.JPG
IMG_4796.JPG

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

Prototype

AudioDelayTeensy4.0_bb.png
audioAdaptorWiring.jpg
IMG_4703.JPG

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.

Software

DesignTool.png

PJRC, which makes the Teensy and the Audio Adaptor board, has a software add-on for the standard Arduino development platform. 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.

Downloads

Building the Device

IMG_4707.JPG
IMG_4704.JPG

The metal case I had chosen had two plates on the front and back where I would mount the hardware. I would need to drill accurate holes but I didn't have a drill press to accomplish this. Fortunately, I work at a university and they have a machine shop, so, this was easier than I expected. (Thank you Tom.)

To mount the OLED onto the front plate I 3-D printed a holder for it and hot-glued it into place.

The metal case had a set of groves near the bottom. This would allow one to slip an appropriate PCB board into these groves for mounting. Unfortunately, the half-size PCB breadboard that I had chosen was marginally too think and wouldn't go into the grove. A few seconds on a bench grinder took care of this problem :-) and the PCB board slid in nice and tight.

I soldered the Teensy 4.0 into the half-size PCB breadboard to assemble the circuit. The Audio adaptor board was inserted into the female headers of the Teensy.

Unsure of my skills I used jumper wires to connect the XLR connectors, rotary knobs, and OLED display to the breadboard and Audio Adaptor board. (This gave me flexibility and allowed me to more easily insert the circuit into the case but it can also be a source of trouble down the road.)

After the back panel was cut I realized that I should have also added a small barrel jack on the back for power but it was too late and I didn't want anything sticking out of the side or front. What I did instead was cut a small grove on the edge of the back panel and slid a USB cable into it and then hot-glued the cable to the panel. Not an elegant solution but it did allow me to further program the circuit after assembly. Next time: USB panel mount connector on back.

User Interface

Screen Shot 2021-11-05 at 12.58.29 PM.png

The user interface is very simple. There are two knobs that determine the audio delay at each of the two outputs. The amount of delay at each of the outputs is shown on the OLED display. Note: the units are in feet (distance from main speakers) rather than milliseconds, as that is more useful for users. Also, when these knobs are pressed in, the current delay values are stored in EEPROM so that they can be retained between power cycles.

The OLED display also shows, at the top, a bar graph indicating the peak audio input. This allows for troubleshooting by reassuring users that audio is coming in and is not clipping (the single vertical line about 2/3 along the bar graph indicates 0 dBu).

Conclusions

I found I learned a lot about creating professional-looking hardware for audio processing. The Audio System Design Tool is fun to play with and makes it easy to try out different ideas.

I made a mistake in choosing such a small metal case; it should have been at least 5 cm (2") wider. This would have allowed for a USB panel mount in the back.

For the future: with minimal changes I believe I can implement balanced input which would allow for better rejection of common-mode noise. If the positive and negative signals from the input XLR connector are sent to the left and right inputs of the Audio Adaptor board I believe I can subtract one from the other in software (using the mixer component).