FrankenTheatre – Digital Signal Processor

frankenTheatre is my attempt to build a, hopefully, great-sounding audio system. I made a set of three-way speakers with each driver powered by its own amplifier and DAC. The subwoofer is a 2X12″ isobaric pair fed by its own amplifier and DAC. At the centre is a commercial DSP, ensuring each driver gets only the frequencies it needs. The Raspberry Pi streamer can play Spotify, network sources, internet radio or your phone and laptop through Bluetooth. I make no claims of being an expert; I’m just sharing my learning experience with FrankenTheatre.

FrankenTheatre Overview

In total, my FrankenTheatre has eight speaker drivers.

Two of those drivers are 12″ Kickers in a cabinet and will run together in series from a 400Watt bass guitar amplifier. They form an isobaric pair in a cabinet designed to hit 20Hz.

The other six drivers are in a pair of three-way cabinets, each with a woofer, midrange and tweeter.

I used six amplifier channels for the three-way cabinets and one for the subwoofers.

Each of the seven amplifier channels receives its analog input from a DAC. In my project, I used four PCM5102A DAC boards with two channels each. 4 X 2 = 8 DAC channels. One DAC channel will be unused.

Each of the four DACs receives its digital I2S signal from the DSP, an ADAU1466 Core Board.

On the other side of the signal chain is a Raspberry Pi set up as a network streamer. In my case, I used a MoodeAudio image for the RPI. By using MoodeAudio, we can play internet radio stations and music from our network. We can also play music from Spotify or our phones and laptops using Bluetooth.

The RPI supplies a 2-channel digital I2S signal into the DSP. You can use ANY source of I2S audio apart from the RPI, but the RPI is accessible, available and relatively inexpensive. You can use sample rates from 8KHz to 192KHz with bit-depths of 16, 24 or 32 bits.

The DSP’s Role

Once the I2S signal reaches the DSP, it undergoes a resampling to 96KHz. I’ve set the DSP to operate at this sampling rate, but you can run the DSP from 8KHz to 192KHz. Maximum audio quality, in my case, will be from a 48KHz or 96KHz source. Choose a multiple of 44.1KHz if your primary sources are CDs.

The DSP I used has built-in hardware for Automatic Sample Rate Conversion, ASRC. Not all DSPs do. An ASRC upsamples the digital I2S input stream to the DSP’s internal sampling rate.

In the DSP, I pass the audio signal through a crossover network to produce the appropriate signal for our tweeters, midrange and woofers. The crossover splits the audio stream into separate feeds for each driver and removes unwanted frequencies.

I build the subwoofer feed by splitting a feed from the input, summing it to mono, passing it through a low-pass filter and using compression.

The 2X12″ kicker subwoofers are run in mono, so they only require a single audio channel.

To sum up the role of the DSP in FrankenTheatre:

  • Allow multiple audio source sample rates and bit-depths (ASRC)
  • Two/Three/Four-way Cross-over network
  • Parametric Equalization
  • Splitting a 2-channel I2S input stream into four 2-channel I2S output streams.
  • Construct a Subwoofer output
  • Delay, reverb and compression

Analog Devices DSP

The DSP I chose for my project is the ADAU1466 by Analog Devices. I chose the “Core Board” because it comes as a PCB with the ADAU1466 IC already mounted and several other features such as an EEPROM and Self-Boot switch. As you’ll see later, these features are important to his project. In addition, it’s readily available on AliExpress for $50 or $60.

The ADAU1466 is a powerful DSP that easily handles our crossover needs, plus all the extras such as compression and delay. Furthermore, it is a well-known IC with a large community, so getting support is easy.

Side note: The ADAU1466 has several ADCs and Multi-Purpose (IO) pins built-in, allowing us to add physical POTs, pushbuttons, etc.

To program this board and any of the other DSPs from Analog Devices, you can use their free SigmaStudio.

Sigma Studio Screenshot

SigmaStudio is a well-known software that lets you visually construct your audio flow, including EQ, Compression, Delay, filtering, etc. You can drag and drop any effect you need onto the workspace and hook it up virtually.

Once your design is complete, you can upload it to your DSP with a single button press. SigmaStudio will take care of compiling your visual design into an actual program that will run on the chip.

Further, once the upload is complete, you can control your EQs and everything else in real-time from SigmaStudio or your own software.

SigmaStudio can even make graphs and show signal levels in real-time.

You can control the ADAU1466 in real-time through the I2C or SPI interface found on the programming port. For those into microprocessors,  nothing stops you from designing a browser-based interface on an ESP32 with real-time control of EQ, filtering, delay, etc.

Wiring Up the Hardware

The Raspberry PI sends its stereo I2S audio signal to the DSP through its male header pins, as shown in the image from Stack Exchange.

To connect the RPI to the DSP, you’ll need four wires with female header ends. You will be connecting the RPI’s BCK, LRCK, DOUT and GND to the DSP’s JL-5, JL-7, JL-9 and JL-1, respectively.

You have the option of using pre-made header connectors or making your own. Making your connectors takes a little practice but allows you to control the wire’s metal quality and length.

To the left is a shot of the ADAU1466 Core Board connected to my RPI and four DACs. Each DAC has BCLK, LRCLK, DATA, and GND pins fed from the DSP via 26-AWG copper repurposed from old CAT-5E-networking wire. I ran them in order of colour, BLUE/WHITE-BLUE = DAC 0, ORANGE/WHITE-ORANGE = DAC 1, GREEN/WHITE-GREEN = DAC 2 AND BROWN/WHITE-BROWN = DAC 3. These are standard colour codes in telecommunications, with Gray being the 5th colour.

Raspberry Pi 4 GPIO
Raspberry Pi Header. Image Credit: Stack Exchange
ADAU1466 Core Board Left Connector Schematic

Powering the DSP

The ADAU1466 Core Board runs from a 5VDC power source. In addition, it has a 3.3V regulator on board to supply the ADAU1466 and other 3.3V devices.

A 5VDC power supply is applied to JR-13 and JR-15. (JR is the right-hand connector in the Core Board image) with GND applied to JR-1 or any of the other GND pins.

JST-XH 5V Connectors

In my project, I made a 5VDC supply board that adds filtering and capacitance to supply sudden power requirements and remove some AC ripple. The board takes a 5VDC Switched-Mode Power Supply, SMPS, filters it and splits it into four feeds, each with an on/off switch and indicator LED. One feed is for the DSP, while a second one powers the DACs. The remaining two feeds are there for future expansion.

ADAU1466 Core Board J2 Header Schematic
ADAU1466 Core Board Left Connector Schematic

PCB, Pin Headers and Screw Terminals

I used a 2.54mm pitch protoboard with copper encircled pre-drilled holes to mount my DSP Core Board. These boards are cheap and easy to come by. They’re not much to look at, but they work. I posted some shots of the DSP board below.

As for creating pin headers on my DSP’s protoboard, I used kits from Amazon with 2.54mm JST-XH and 2.54mm Pin Headers. The screw terminals are also from Amazon.

I use a PA-09 hand-held crimper, but there are alternatives, as you’ll see in these videos below. I suggest watching a few videos about crimpers to understand what’s out there and what works best for you.

Here are two informative videos on using premade “Dupont” wires and making custom wires.

Communicating With the DSP

Before SigmaStudio can see our DSP, we need to connect a “programmer” between the computer and the DSP. I am using an “ICP1” programmer from Dayton Audio. The programmer only needs to be connected to the DSP during DSP programming or to adjust DSP settings in real-time. The Dayton Audio programmer connects to our computer by USB and the DSP via its 6-pin header.

There are many versions of programmers, including ones based on microprocessors such as an ESP32 or ESP8266 and some costly ones—the ICP1 costs between $30 and $40.

The bottom of the programmer features a well-marked diagram of the header. You will need to use the following pins: SCL, SDA and GND. You likely won’t need VIN since your ADAU1466 won’t get its power supply from the programmer interface.

The ADAU1466 Core Board’s USBi interface (pin header) is matched to the programmer’s SCL, SDA and GND.

Note: I converted my ADAU1466 Core Board’s programming header from an SPI interface to an I2C interface. The DSP Core Board came with a schematic diagram and some notes about the conversion. In my case, I removed R7 and R8 and shorted R5 and R6. Without this conversion, I could not get the ICP1 programmer to work. I’m sure there is another way; if so, comment below.

Once the I2C conversion is done, our ADAU1466 board speaks to the programmer using I2C with an address of 0X76. More on this later.

Here is an important note to save hours of headaches

When you power on your ICP1 (by plugging it into your computer’s USB port), it’s essential that the ICP1 NOT be connected to the ADAU1466 DSP board. The ICP1 will not enter programming mode if it “sees” anything on its programming port as it boots up.

In addition, make sure the ICP1’s programming switch is in position 1 – Program.

Because I usually leave the ICP1 connected to my DSP, I added a switch to the SDA and SCL lines. I can switch OFF the lines until the ICP1 is booted up. Using a DPDT type switch is ideal. The maximum voltage on SDA and SCL lines is only 5V, so there’s no need for an expensive high-current switch.

Once the ICP1 has been disconnected from the ADAU1466 Core Board, the ICP1 AND the DSP can be powered on. After a second or two, it’s safe to connect your ADAU1466 Core Board to your ICP1. 

SigmaStudio Basics

Analog Devices has done a remarkable job of hiding the nitty-gritty details about DSP programming from us. So, for example, we don’t program the DSP directly; instead, we draw lines between virtual effects, inputs and outputs.

In addition, AD has a whole section of their website devoted to learning SigmaStudio and their line of DSPs.

https://wiki.analog.com/resources/tools-software/sigmastudio/tutorials

Here’s a short video from YouTube that explains the basics of SigmaStudio.

The video does a great job introducing us to SigmaStudio and its basic use and introduces us to the concept of Inputs, Effects and Outputs.

I set up my hardware like the picture shown. Since I converted my DSP from SPI to I2C, I need to set my USB hardware to use I2C with the DSP’s address of 0X76.

A Word About I2S, Serial Ports, Channels and Sample Rate Conversion

I am using the well-known, ubiquitous I2S protocol throughout the digital signal chain. It’s used worldwide in electronics you likely own right now. For an introduction to I2S, check out GreatScott!’s video on the subject.

The I2S protocol transfers its digital signal one bit at a time, so we call it a serial stream. In SigmaStudio, Serial Ports are responsible for bringing an I2S stream IN or sending one OUT. Each serial port has three physical pins, BCLK, LRCLK and SData.

The ADAU1466 has four serial inputs and four serial outputs. The first two input serial ports can handle up to 16 channels, while the last two can handle up to eight channels each. There are a total of 48 input channels.

The story is similar for output serial ports. The first two output serial ports can handle 2, 4, 8 or 16 channels, while the last two can take up to 8 channels each. This gives us a maximum of 48 channels of digital output.

Pins connected to input serial ports are labelled in sequence; Serial Port 0 has physical pins labelled BCLK_IN0, LRCLK_IN0 and SDATA_IN0.

Similarly, Serial Port 1 uses physical pins labelled BCLK_IN1, LRCLK_IN1 and SDATA_IN1.

Each serial port has several channels associated with it. You can see which channels belong to which serial port by visiting SigmaStudio’s “SERIAL_PORTS” configuration tab.

As you can see from the serial port configuration block screenshot, the channels assigned to Serial Port 0 are 0 to 15. So if you’re using a stereo I2S signal, on serial port 0, you’re working with a 2-channel stream, using channels 0 and 1.

Shown above is the Input Serial Port configuration I used. Your I2S source (Moode Audio on the RPI) needs to match the MSB position and Channels/Frame. I set my ports to 32 bits.

Since I want serial port 0 to accept multiple sample rates, I set the input serial port’s BCLK and LRCLK source to “Slave from CLK domain 0.” This effectively sets the serial port in sync with the incoming audio, regardless of its sample rate. As a result, the input serial port can accept sample rates from 8KHz to 192KHz.

As I said before, It’s the ASRC’s job to take an audio stream from a serial input port (or other sources) of any sample rate and produce an audio stream of one preset sample rate; in my case, 96KHz.

Shown here is the ASRC IN block, which gives us access to the converted 96KHz stream. Each ASRC channel can convert one input channel, so, in my case, I used ASRC 0 and 1 (default values). You may wonder why it’s labelled as “ASRC IN” – that’s because the label is from the perspective of SigmaStudio’s workspace. From that perspective, the serial I2S stream is coming IN from the ASRC hardware. You can change the ASRC channel assignment in the “Routing_Matrix” tab of SigmaStudio.

The output ports are labelled in sequence, i.e., BCLK_OUT0, LRCLK_OUT0, SDATA_OUT0, BCLK_OUT1 etc.

Shown to the left is the output configuration I used. Your DAC or downstream device needs to match your MSB position and Channels/Frame settings. The PCM5102A that I use in this project can handle a maximum of 384KHz and 32 bits. I set the output ports as the master BCLK and LRCLK clock providers to the DACs.

To send an audio stream out of the DSP, we use the “out” block with your desired channel number. I labelled my “out” blocks as “Left” and “Right.”

To send an audio signal to serial output port 0, send the audio on any channel from 0 to 15. For example, if we’re using a stereo signal, use channels 0 and 1. For serial output port 1, the channels are 16 to 31. Serial output port 2 uses channels 32 to 39, and serial output port 3 uses channels 40 to 47.

Use the correct channel number if you want your audio sent to the correct serial port.

Write a Program to the DSP and make it Semi-Permanent

When SigmaStudio uploads a program to the ADAU1466, that program is running in volatile memory. As soon as the DSP is powered down, the program disappears.

The ADAU1466 Core Board has a switch called “Self Boot.” Usually, this switch should be in the “ON” position so that the ADAU1466 will boot up and load its program from the Core Board’s built-in EEPROM.

To make the ADAU1466 program permanent, we write it to the EEPROM so that the DSP loads our program each time it boots up. Flip the “self boot” switch to “OFF” to ‘unlock‘ the EEPROM. (it also prevents the ADAU1466 from loading our program from the EEPROM during boot, so flip it back to “ON” when you’re done writing to the EEPROM).

With the ADAU1466 powered ON and connected to the programmer, move to SigmaStudio’s Hardware Configuration tab. Next, right-click the ADAU1466 box and choose “Self-boot Memory | Write Latest Compilation through DSP.”

The ADAU1466 will write to the Core Board’s EEPROM through an SPI port, so choose SPI. Don’t confuse this interface with the ICP1—>ADAU1466 interface. They are physically different interfaces and need to be configured independently.

Once the write is complete, you can verify the EEPROM was programmed successfully by choosing the “Self-boot Memory | Check Last Compilation through DSP” option.

Finally, turn the Self-boot switch to “ON.” I like to reboot my DSP to ensure it comes up as expected.

A Working DSP Project

Here are screenshots from the DSP flow I developed for my FrankenTheatre. I am not an expert at SigmaStudio, but here is the solution I came up with for a cross-over network with some EQ, subwoofer compression and various mutes and level controls. This should be enough information to set up your hardware if you build one of these systems.

Below, you can download the SigmaStudio project file I created.

DSP_Programming_ADAU1466.dspproj

Further Exploring

Andreas Spiess has a great YouTube channel with more information about connectors, microcontrollers, Bluetooth, LoraWan and much more.

I also enjoy learning from GreatScott!’s YouTube channel, and I think you will. So be sure to check out his work.

Summary

As always, the first build is the hardest. This part of my FrankenTheatre required many hours of research into areas in which I had little or no knowledge. Now that I’ve done it, the next one will take ten minutes.

Once past the learning curve, we gain an enormous amount of audio processing power with relatively little effort. For about $70, you can add commercial-grade EQ, compression, delay, filtering and more to your audio stream. And you can adjust them in real-time, in SigmaStudio or your custom software.

If you come from a recording background like me, you’ll have no trouble with SigmaStudio’s audio tools and controls. They can be adjusted with your mouse or changed precisely by the keyboard.

SigmaStudio has a learning curve, but it’s gentle. You don’t need to do much to create a working project. And when you’re ready to build a 16-channel monster project, all the tools are there.

And hey, if it ever gets hotter than 100°C outside or you accidentally freeze your house, your automotive grade ADAU1466 will be perfectly fine!

Leave a Comment