Digital audio mixer pt.2

Since writing my previous post concerning the digital audio mixing I’ve made some important progress. Initially my code was working on an off-the-shelf Teensy 4.1 and utilizing solely the digital enter and output I might use instantly with an exterior ADC/DAC. Shortly after writing that put up I obtained the Teensy Audio Protect which makes the check setup a bit simpler to cope with.

It is a easy board that connects an NXP SGTL5000 codec chip to the Teensy. It supplies a stereo in and output on the header on the high on this image. It additionally has a reasonably respectable built-in headphone amplifier which is uncovered with the three.5mm jack on the backside of the image.

With this board I changed the S/PDIF enter and output within the code with an i2s interface which accomplished this right into a self-contained 2-input and 2-output audio mixer. However how one can develop from right here? That is extra within the realm of customized {hardware} for the reason that Teensy Audio Protect is virtually the one board you’ll be able to order for Teensy Audio.
So a customized board… There’s just a few different supported codecs by the audio library. The problem is that a lot of the codecs within the record are EOL or not beneficial for brand new designs. They’re additionally principally out of inventory so I postponed this concept for a bit.
FOSDEM 2024
So roughly at this level within the course of FOSDEM occurred. Not solely is that this a really attention-grabbing open supply software program occasion but it surely additionally manages to run ~30 concurrent dwell streams and in-room audio mixes with an ad-hoc setup with solely a couple of tenth of the quantity of personnel you’d anticipate to be wanted to tug this off.
To drag this off FOSDEM makes use of customized construct “video boxes” that comprise half the gear wanted to run all of the multimedia in each room. Two of those (similar) bins are put in every room for the whole setup. This setup has advanced quite a bit through the years.
This is among the examples: the great laser-cut video bins used from ~2015 to 2023. These have the job of capturing from the HDMI video inputs and ship off the video from the linked digital camera and speaker laptop computer to be encoded for the live-stream. It is a very good and compact resolution for deploying a room for FOSDEM and in the course of the occasion these are managed remotely from the central operations middle permitting just a few individuals to watch and handle all of the video streams.
However what concerning the audio? There is a microphone for the speaker and one or two microphones for viewers questions however these do not hook as much as the customized bins. The room audio in most rooms is dealt with by a Yamaha MG10 audio desk. That is simply sufficient for mixing collectively the audio from 4 sources however has one main draw back: it’s important to be bodily current to show the knobs to regulate something.
Whereas video is often fairly nice whereas watching again the talks I’ve observed there’s generally just a few audio points like microphones which are clipping. The right resolution for this all is a digital audio mixer that may be managed remotely after all, however these are approach bigger and costlier.
It seems FOSDEM is that good goal for a 4-in 4-out audio mixer that’s managed over USB as an alternative of bodily controls. I am very glad I managed to fulfill up with the FOSDEM video crew, which result in…
FOSDEM Audio Board
So the FOSDEM setup has just a few very attention-grabbing constraints for an audio mixer:
- There’s two audio mixes, one for in-room audio and one for the live-stream
- All mixes are mono, there’s not a lot sense in stereo for working just a few microphones.
- All sources are line-level. The microphones at FOSDEM are all wi-fi and the receivers can output line-level indicators so no want for microphone pre-amps. This massively simplifies the design of the analog inputs.
- Since no condenser microphones or phantom-powered DI bins are used no +48V phantom energy provide is required.
- The present iteration of video bins are inside 19″ 1U rack instances which constrains the scale of the audio mixer quite a bit.
So I’ve virtually no expertise with designing audio gear. Fortunately the extra constraints massively simplify the design which is nice for price optimization as effectively. So I did probably the most harmful factor a software program developer can do: I launched Kicad.

For the design I made a decision to place two of the SGTL5000 codecs on the board. It is one of many few supported codecs which are nonetheless out there and so they already deal properly with line-level indicators. One other nice function of those chips is that they embrace analog achieve management which saves me from having to implement a digital-controlled analog achieve circuit which sounds tough and costly. Having a built-in headphone amp can also be nice for including a headphone connection for monitoring within the room.

That is how the {hardware} is linked internally. There are 3 analog XLR inputs for connecting the microphone receivers and the fourth enter is a 3.5mm jack that is attached for some easy analog mono-summing of the incoming sign. This 3.5mm jack will hook up with the audio output of the HDMI seize card linked to the laptop computer of the presenter.
One of many codecs additionally supplies the two XLR outputs. One connects to the prevailing audio audio system within the room and the opposite connects to the audio enter of the digital camera. The headphone connector is linked to the outputs of the second codec in order that audio combine may be managed individually in software program.
The one factor that should occur along with the schematic of the unique Teensy Audio Protect is coping with balanced indicators. Sadly there is not a “getting began with designing audio interfaces” e book however I discovered the sensible web site from Elliot Sound Products that has quite a lot of data on these circuits. The inputs and outputs have a pair of opamps to transform the indicators. That is carried out with TL072 opamps as a result of they’re low cost, out there and have 2 opamps in a single chip. This implies the entire enter circuit is a single chip and some passives.

The opposite half that wanted determining is the facility half. This surprisingly was much more work than the precise analog audio dealing with. The entire design is powered from 5V from the USB port however there’s quite a lot of separate voltages wanted to run all of the audio {hardware}.
The codec chips want two 3.3v rails and one 1.8v rail to perform. One of many 3.3v rails is for the digital half and one for the analog half. The opamp circuits are much more difficult as a result of they want a optimistic and destructive voltage rail to perform.
The precise voltage for the opamps doesn’t matter a lot but it surely needs to be excessive sufficient that they’re all the time above the analog audio enter ranges and since these are low cost opamps it wants just a few volts additional as a result of the TL072 can’t course of indicators near the provision voltage which ends up in distortion. Then again the output voltage must be under 40 volts as a result of I am constructing an audio interface and never a smoke machine. On this design the provides are +9V and -9V which brings the entire voltage on the opamp to 18V.
To generate the optimistic and destructive 9V rails I first generate +12V and -12V with a switching regulator after which feed these into an LDO to filter out the switching noise from the switching regulator. After coping with all this I now lastly perceive why a lot of the audio gear has old-school transformers to energy them: it makes it very simple to make a dual-rail provide.
It was not simple to determine how one can get the twin rails from 5V in any respect. To start out I made a decision to open up one of many USB powered audio interfaces I already had and see what the designers of that machine did to repair this. On this case it was a Tascam US-2×2.
It is a image of the facility provide part of that audio interface. It comprises quite a lot of completely different voltage regulators to make the assorted rails. It has to cope with just a few additional voltages in comparison with my design since this additionally has +48V phantom energy. After measuring it the primary destructive rail of this board was generated by the 34063 chip on the high of that image. That is used as an inverting switching regulator on this case. The optimistic rail for opamps on this design is generated by the tiny chip labelled U26 all the way in which on the underside of the image, I’ve not been capable of determine this chip.
This all collectively result in my preliminary design:

The highest left a part of the board generates the voltages for the opamp circuits and the highest proper has the regulators for the codecs (and the PC enter jack). This model of the facility provide was not full but because it was missing just a few capacitors and I discovered that the inductor I chosen was approach too small to perform appropriately.
This revision of the facility provide was scrapped as a result of with the proper inductor the facility provide merely turned too giant for the board and I did not wish to make the board any bigger for the reason that inside the FOSDEM field may be very area constrained.
The MCP34063 can also be many years previous expertise by now. It is a switching regulator that runs at 100Khz max. On this design the switching frequency can be ~60Khz however this leads to needing a big capacitor and inductor on the board.
Within the present revision of the board this has been changed with the TPS65130 regulator. It is a far more fashionable switching regulator working at 1.3Mhz as an alternative. This chip is a little more costly but it surely generates each the optimistic rail and destructive rail with a single chip and because of the order of magnitude bigger switching frequency the inductor and capacitor may be approach smaller. The tip result’s a extra compact and cheaper energy provide.

That is the board that was ordered as prototype. It is principally the identical because the board proven above but it surely has an additional header exposing just a few I/O pins of the teensy for prototyping and the PC enter connector has moved so the jack can be above the board to waste much less area within the case.
The precise {hardware}
After ready some days I obtained this partially assembled board:

After soldering on the connectors I powered it on and checked the voltage rails, all of it appeared effective. Then after powering it on a second time it began making a screeching coil-whine sound and inside a second the 12V generator made the underside of the PCB too scorching to the touch. After initially working for a bit I did not get it to generate the proper voltages once more, even after restarting the board. Typically when powering it on it heated up once more, generally it did not however for some motive the output of the +/- 12V provide was +6V/-4.5V as an alternative.
This situation plagued me for some days till someday I had plugged in my headphones within the board whereas measuring issues with the multimeter and instantly the bizarre noise from the inputs disappeared. This occurred after I had the probe of the multimeter on one of many pads of the diode for the destructive provide.
It seems that the solder connection on that diode was not dependable and after heating up that pad with a soldering iron for a second I managed to get the board working on the proper voltage once more… however solely generally. A minimum of the board was now dependable sufficient that I might work a bit on the firmware and all of the performance that did not depend upon the opamps was working nice.
This is among the moments the place it is a large assist when different individuals double-check your schematics. It seems I copy-pasted just a few capacitors and forgot to regulate the values. Particularly I had a capacitor within the suggestions path for the switching regulator that was two orders of magnitude too giant. It seems these capacitors have been non-compulsory anyway in line with the datasheet so after eradicating these from the facility provide it already turned much more dependable. Nonetheless it generally failed to begin and unreliable gear in a dwell atmosphere is a non-starter.
After verifying all the things it turned out that there have been extra capacitors with fallacious values and sadly these capacitors have been truly required. So I took the boards to somebody with precise electronics expertise and likewise the proper gear to debug the boards. A couple of capacitors have been eliminated, just a few have been added and the result’s lovely soldering work like this:

Which is a 100nF capacitor soldered on high of an 10uF capacitor to additional cut back the ripple of the facility provide. The board has since been adjusted to really have these capacitors included. After a night of messing with the board to attenuate ripple the switching regulator part has became fairly a battlefield:

A couple of stacked capacitors, a pad I’ve by accident ripped when eradicating capacitors. The ability-save pins on the regulator linked to GND as an alternative of VCC and within the backside left nook a stupendous stack of three capacitors and a 1k resistor on the output of the regulator.
Fortunately in spite of everything this the regulator began working reliably. To make it a bit nicer on my desk I additionally 3d printed a easy entrance panel for the mixer. I additionally acquired a random oled panel from my components field and linked that to the GPIO pins so I can have a show to indicate real-time debugging data whereas testing the software program.

The software program aspect
For the software program I began off from the Arduino IDE undertaking I had for my earlier weblog put up. The design for the audio at FOSDEM can be less complicated although, no networking is required on the mixer however as an alternative the USB connection can be used for management. Including a community port for the audio mixer would imply it wants extra swap ports within the field and for the reason that community swap ports are on the surface it might want an unpleasant cable popping out to the entrance of the field to attach it up.
The management of the mixer would occur by way of the infrastructure FOSDEM already has the place the volunteers within the rooms can management the bins with a webpage from a telephone and a few software program on the SBC contained in the field will talk with the mixer over a serial port.
There have been additionally just a few small software program points to cope with because of the {hardware}. There are two SGTL5000 codecs on the board. There are two variants of this chip, the 32 and the 20 pin model the place the most important distinction with the 20 pin model is that it does not have any tackle pins for the I²C bus. Sadly the 32 pin variant wasn’t actually out there so the codecs are actually utilizing the identical tackle however on completely different I²C busses of the Teensy. The audio library is hard-coded to have the codec on I²C0 of the Teensy so this requires a little bit of patching.
The problem of patching the Teensy audio library is that libraries within the Arduino construct system are a large number and the audio library can also be a part of the Teensy core within the IDE as an alternative of a separate library. After messing with it to attempt to make it a bit extra sane I made a decision to transform the Arduino IDE undertaking to a plain cmake undertaking that pulls within the varied components of the Teensy core as git submodules and has the entire audio library vendored in. This additionally means it is now potential to construct the firmware for the FOSDEM audio mixer with out first downloading a pre-compiled ARM compiler so it will possibly run shortly in Alpine in CI.
I had additionally added an OLED panel to the board for testing so I added a little bit of code that shows the audio ranges of all of the inputs and outputs of the board on that display screen.

This half will certainly be completely different on the FOSDEM bins since these oleds are very small and the PCB behind it are giant sufficient that it barely suits within the top of an 1U rack case. It is extremely cool to have audio degree bars in realtime although and if there’s a colour show it might even be usable sufficient to see if the degrees are right.
There’s additionally an preliminary implementation of the serial management protocol. The precise protocol has not been totally thought out but however a minimum of it does the one factor all serial protocols ought to do: print one thing helpful when sending a newline.

When sending a newline to the interface it’ll print the state of the blending matrix as percentages.
Additional work
The audio interface has been examined with one of many wi-fi units from FOSDEM, which is a Sennheiser AVX ME2 set. The audio appears to work nice with this and for working FOSDEM there can merely be 3 receivers plugged into the field.

However can this be less complicated? The AVX system works with DECT chips so possibly it might be potential to make the worlds first digital audio mixer with built-in DECT base-station 😀
Conclusion
That is definitely quite a lot of progress for the audio {hardware} a part of the mixer undertaking. Whereas quite a lot of the {hardware} is specified for the precise necessities of a FOSDEM room it does present a neat base to work off for designing digital audio mixers. The components of the {hardware} design are modular sufficient to reconfigure them for different audio wants and now the line-level inputs are working will probably be neat to determine a digitally managed microphone preamp. Or have hi-z enter for devices. Or implement a phantom energy provide.
It is all the time a ton of enjoyable to determine new methods and as an alternative of studying a random new programming language it is {hardware} design stuff for as soon as. I completely could not’ve finished it with out the experience of {the electrical} engineers that helped me design this, particularly Thea who truly is aware of how switching regulators work 🙂
Hopefully the revision B design with the enhancements from all of the testing that occurred with this board can be within the FOSDEM bins in FOSDEM 2025 however I am going to save that for a 3rd half on this sequence of posts.