a digital signal processor with integrated quad-channel amplifier for high-fidelity speakers.
This project was created on 08/11/2014 and last updated 2 months ago.
i appear to have a DSP. time to set it up!
first, the basics:
here's the architecture again:
(DSP architecture, version 2 - final)
as you can see, both ADCs and four DACs are built into the ADAU1701 itself. they communicate directly with the DSP core using internal Analog Devices magic. setting them up is easy!
I2S seems to need these signals:
the AK4430 also wants the 24.576MHz master clock so it can jostle its switch-cap filter, as mentioned in part 2. the master clock can be wired right in. but how do we generate the other signals?
the ADAU1701 datasheet has the answer on page 46:
(at 48kHz sample rate, the ADAU1701 can be the I2S master.)
(the general-purpose IO pins, MP6, MP10 and MP11 can be our I2S bus)
so let's set up the I2S bus!
(that 'Serial Output 1' box contains everything we need to know)
why is the left-right clock (aka 'Frame Sync' clock, aka 'LRCLK') set to 'internal clock/512' = 48kHz? well, 48kHz is our sample rate. at every sample, we have to first send some right-channel data (with LRclock low) and then some left-channel data (with LRCLK high). that means, repeating at 48kHz, LRclock must spend some time low and some time high. so that is a 48kHz square wave!
and why the bit clock (aka 'BCLK') set to 'internal clock/8' = 3.072MHz? well, it's transmitting stereo 24-bit audio. that means it has to transfer two 24-bit integers (at least 48 BCLK cycles!) for every audio sample. let's allocate 64 BCLK cycles per audio sample. if a clock is 64 times faster than our sample rate (48kHz), that's 3.072MHz.
as for the LRCLK and BCLK polarity, that's taken straight from the AK4430 datasheet.
now let's look at the GPIO (general purpose IO) configuration:
for I2S communication with the AK4430, general purpose IO pins MP6, MP10 and MP11 are set to SDATA_OUT0, LRCLK_OUT and BCLK_OUT respectively.
to read the position of the two control knobs (Volume & Balance), pins MP8 and MP9 are set to the inputs of the 8-bit auxiliary ADC: ADC3 and ADC0.
to control the clip-indicator LED, pin MP4 is set to Output GPIO.
next, how do we set up the EEPROM?
the DSP uses a 24FC64FT EEPROM from Microchip. it has a capacity of 64kb, which is 8kB, so that is how i set up my Mem Size. the datasheet lists a '32-Byte Page Write Buffer', so i have set Page Size to 32 Byte.
now that this thing is set up, i can finally doing something with it.
these are the first speakers i ever built. on the left is a 12-inch subwoofer using a Dayton Reference driver and an M&K plate amplifier. on the right is one of the two biamplified main speakers, using Dayton tweeters and woofers. i will program DSP 01 to be an equalizer & crossover for the entire system, with the internal 4x100W amplifier driving two tweeters and two woofers, and the two line-level outputs controlling the subwoofer through the M&K plate amplifier.
but that is too much for all at once! first of all, let's get it working with just one main speaker.
here is the signal flow for controlling one main speaker.
the lower branch (starting with PeakEnv2 and PeakEnv2_2) checks if the DSP's inputs are clipping. if the input signal amplitude exceeds 90% of maximum, the clip-indicator LED turns on for 500ms.
the upper branch is the audio signal processing, and contains the following blocks:
(analog signal processor, front panel, circa 2013)
the single biggest difference between 'hacky' and 'solid' audio gear is the box it comes in.
this isn't just vanity. well-constructed equipment lasts, which justifies its cost in cash and time. you won't worry when you move it. you won't worry when you touch it. the interconnects won't wiggle out of place, the volume control won't crackle or free-spin. the bloody thing won't catch fire.
if it's performing for you, or you're performing with it, it won't give up, turncoat and die.
it is a real pity that most hackers half-ass their boxes. above is my own attempt, in 2013, to turn a cigar box into an electronics chassis. there's no symphony to the position of anything. it's hacked together in all senses of the word.
the inside is worse.
(analog signal processor, inside view, circa 2013)
are the circuit boards anchored by the tension of the wires? yes.
are the jacks Loctite-ed with hot glue? yes.
is the volume pot protoboarded and bolted to scrap plastic? yes.
is every input and output tight-roped on unshielded wires? yes.
this isn't even all. there were two stereo amplifiers and three separate power supplies, all with their own hacked-up boxes, and cables strung in between.
it even took ages to hand-cobble this disaster. i'd completely overlooked mechanicals during the design phase. here was the result. never again.
DSP 01 would be a singular, hyper-integrated thing. i would nestle the user interface, DSP core and quad-channel amplifier board into a single box. one 24V power supply would power the amplifiers as well as the DSP, through a 5V buck regulator.
(UI board, version 1)
the UI board plugs directly into the main DSP board, giving it RCA inputs, RCA/3.5mm outputs, two adjustment pots and indicator lights. i added a tiny knob to dim the power light. i lasercut holes in the front panel with my mechanical Eagle CAD technique, to exactly fit the pots and RCA jacks. the amplifier's heat sink would orient vertically to maximize passive cooling.
(the entire lasercut assembly)
then i went to lasers.
(those screws are too high. i'll have to cut holes around them.)
(all precision projects must ebb to barbarism.)
(banana jacks fit with a 4.8mm shoulder.)
(the contact bulge meets the via.)
(amplifier, DSP and buck converter.)
(DSP in detail.)
(ready for testing.)
next update, i will describe my acoustic measurements and DSP programming.
(image: DSP architecture, version 1)
here are the goals i set for the DSP:
the heart of my DSP is Analog Device's ADAU1701. it is an amazing piece of work. two 24-bit ADCs and four 24-bit DACs. integrated 50MHz DSP core. self-boot capability. auxiliary 8-bit ADC to read potentiometers.
coming from a place of analog skepticism, i expected it to sound awful. i planned to use digipots on the outputs to do volume control in analog, and avoid digital attenuation. i threw in a microcontroller (ATtiny) for clip-detect and to adjust the digipots. i added output amplifiers.
then i actually listened to the evaluation board and it sounded fine. the digipots and output amplifiers were completely extraneous. clip-detect could be built into the DSP itself - i could leave out the microcontroller too. this led to a much simplified version 2:
(image: DSP architecture, version 2)
after more listening, i decided the SPDIF input was also extraneous. i would include the hooks to add it later. it could live on the modular user interface, and connect through a header.
these changes led to version 3:
(image: DSP architecture, version 3)
why a 24.576MHz clock? the AK4430 delivers maximum THD+N if your master clock is at least 512*(sample rate). at a 48kHz sample rate, that's a minimum clock of 24.576MHz. this relationship exists because the AK4430 uses a switch-cap output filter. like all switch-cap filters, its corner frequency is affected by the clock frequency.
why the AK4430 at all? it's good enough, and quite cheap, and runs at 3.3V.
now let's calculate our power requirements:
looks like our worst-case current draw is about 200mA. what about power supply noise?
ADAU1701 power supply noise requirements:
AK4430 power supply noise requirements:
the ADP3335 LDO has excellent load regulation, 500mA maximum output current and a peak voltage noise of under 0.3 mVpp. it will do fine.
i'll also throw on a 30-pin header to connect the Main Board and the UI Board.
time to bang it out!
(a picture is worth a hundred hours)
(two pictures is worth 200 hours)
(did it work? yes.)
next update, i will describe the user interface and lasercut chassis.
unfortunately i am not selling these, because the price of assembly would be too high in low quantities. i may change my mind after learning more about the logistics.
you also need an $80 programmer from Analog Devices, which only sounds cheap if you're going to build a lot of these :-/
Lovely work and post. Makes me what to revisit speaker systems. Got very interseted in powered speaker systems 20 years ago but the electronics (at affordable prices) was not available. The DSP programming was definitly not that user friendly, What Aplifcation system are you using for the sub? When I was looking TriPath had just come on the scene; I did not care for the THD figures at the time but could see these type of amps had many advantages would become common.
i'm using a quad-channel Tripath amplifier board, it is here:
imho, THD is not everything. dynamic range, off-axis response and noise floor (especially ground noise!) are much bigger problems, especially in professional audio systems - and there are often quite cheap ways to improve along those lines, whereas super-low THD can be incredibly expensive. what i am trying to say is, try the tripath amplifiers, i think you will be pleasantly surprised :)
hi! you totally can, and the central/common-control interface is analog audio :)
this thing was designed to be modular. i can swap out the UI board (the PCB with dials and lights on it) for another which adds more inputs, and then the DSP will be able to receive 6 inputs for a 5.1 system. the whole signal chain would then look like this:
(5.1 soundcard) -> (6-input DSP) -> (3 more DSP's, each connected to two speakers)
the 6-input DSP would implement all central control features and multi-channel theater effects (compression, digital delay, room-specific equalization, speaker-subwoofer crossover). the three other DSP's would each perform all speaker-specific features (individual-speaker crossover and EQ).
it can be done! i may, in fact, already be planning some interesting related projects..