Using FPGAs and MCUs to build my dream audio setup
To make the experience fit your profile, pick a username and tell us what interests you.
We found and based on your interests.
Hello everyone !
Last update was about the single ended filters, which i thought we were done with but somehow something really important dawned on me, let me explain :
Here's the kicker, single ended outputs are usually reserved for signal transfer, not for for driving
why not use an OpAmp ? an OPA1611 should deliver way enough power without coming close to bottlenecking on noise or THD...
Literally just placing it after the single ended filter should do the trick, no clue how that flew above my head but yeah.
A few design choices remain to be made :
Futher testing is required !
Hello everyone !
Little update on the DAC, let's see what we have in store for today.
First things first, Since i'm doing an output stage, i'm going to have to deal with differentials filters, differentials amps, power supply filtering etc. The board will include those elements, but they'll be somewhat isolated (i need to test them after all ! ). The entire thing will be powered by a stabilized power supply, so expect banana plugs and BNC test points.
Since my outputs can be differents (bridge tied vs single ended), It means that I will have to use AD and BD modulation.
For testing, i also want a mono single ended output.
Let's start designing ! the datasheet says that the output PWM frequency for a 96kHz 24 bit audio signal will be over sampled x4 which is 384kHz. That's a lot less than i expected (I would have thought it'd reach the MHz range). So, i think a higher order low pass will be needed because i doubt -20dB will cut it to remove all those high frequencies harmonics.
I know the actual speakers can't reproduce those sounds, i'm mainly focusing on the EMI produced by all that switching over the cables.
Might aswell go overkill, so here's my attempt at a 5th order Butterworth filter with a ~60KHz cut off frequency. I chose this frequency such that any ripple that happens after normalizing the components values would be ideally after 20KHz.
I ended up with a sliiiight ripple but it's inevitable, and check this out, -72dB at 300KHz. Take that high frequencies !
So, changing the load changes the frequency response : if you...
Read more »Hello everyone, i've been hard at work ̶g̶e̶t̶t̶i̶n̶g̶ ̶m̶y̶ ̶c̶a̶d̶e̶n̶c̶e̶ ̶l̶i̶c̶e̶n̶s̶e̶ ̶b̶a̶c̶k̶ on the DAC, but also "redrawing" the whole project.
First things first, let's address a few important points/thoughts I had since last time :
Let's see those points in detail.
One thing that might have not been clear before is that the mixing unit acts as a separation between the sound sources and the amps/headphones/whatever : Any data out of the mixer either goes back to the sources through USB (as a microphone input) or get sent out through I2S. What we're currently designing is the "DAC", or the output unit, used to transform the I2S into analog signals that can then get amplified by any kind of analog amp.
Analog amplifiers come into a really wide range of configuration, each with their own unique ups and downs. Class A, B etc. are easy enough to make but are rather inefficient, while class D amps are the opposite : really complex, really fiddly, really efficient. Making a class D amp entirely by myself is out of the question, but chips do exist that allow for the dreaded analog to 1 bit modulation. Most class D amps out there are made with ICs taking analog in and spitting HF PWM out that get filtered back to ~20Hz - 20kHz.
The idea is therefore to create a "comparator amplifier" that acts as closely as possible as an ideal opamp in comparator mode : taking the HF PWM signal (with "Voltage High" and "Voltage Low") and spitting out a symetrical Signal (±V amplifier) such that both waveform are exactly the same, just with different amplitudes.
Here's the structure of the output unit with power amplifier attached.
As you can see, volume control is entirely determined by the power supply of the entire output stage.
In our case, the output unit actually needs at least 2 analog output : Line Out and Headphones Out. I'll just do the same comparator Amplifier + Filtering Combo on the same PWM input to get both signals, with different V_amp voltages for each.
I'll also allow a PWM output because my portable DAC unit won't have a beefy variable voltage source needed for the power amplifier part. Therefore, i want to future proof it by being able to be connected to such an amp down the line : making different modules make prototyping much easier.
NB : by choosing this method, i completely bypass the analog pre amplifier needed for the input module that i was supposed to design now, which mean i'll have to design it later.
NB : This output module is entirely optional, there exist many I2S to Analog DACs out there. I'm just designing it because it's fun.
NB : This method moves the complexity away from the actual amplifier design and toward the power supply design.
In the introduction of the project, I devised a few ways to deal with potential overflow. Since i wanted to not deal with distortion so much, i decided to just put the 24 bits + overflow onto a 32 bit channel and pretend everything was fine. it's not fine.
So, let's say we have a 32 bit DAC chip, working with a specific voltage. It takes I2S as an input and output an analog signal using what is black magic for our intents and purposes. That output should be perfectly linear. Well, let's say we're using a symmetrical 5V power supply. The DAC's resolution is 10/(2^32) volts, or roughly 2.33 nanovolts. Let's be clear, that's absolutely impossible to achieve, which means the least significant bits of our signal are straight up noise. The DACs are more expensive, I2S timings are tighter,...
Read more »There is a very easy way to test the preamplifiers and the bridge : making a dedicated audio DAC, such as the ones you can buy. We just need to connect our USB bridge to the DAC.
The Input module doesn't technically needs to exist for a purely digital system, but as I plan to use this with analog devices (microphones and instruments) so I am designing it.
This module is therefore separated in two specific part :
From this description, it is therefore clear that the Input Module is a magic box that looks like this :
NB : the USB bridge only works as a slave. I have no plan on making it work with USB headphones, or USB microphones. I don't know how nor am I interested in that feature for now.
Also important is the fact that the USB bridge will probably be on this module : this allow clean cable management on a rack which is noice. unpopulated components will be placed on the main mixer PCB so that if you want only 2 USB devices and 4 analog inputs you don't have to buy 6 MCUs instead of 2.
As you can see, the Analog part has some processing in it, and it is crucial. Our analog devices might need phantom power, an attenuator, a pre-amp, the input might be balanced, stereo, mono etc.
The Input module is in fact the most important module because even if everything else works, if it isn't calibrated correctly the rest will sound like garbage : if the bridge doesn't work then no audio will reach the mixer/the user, if the analog part sucks then the processing won't give correct results etc.
The processing chain will look something like this :
This will be short : most of it will be taken from this amazing tutorial by DJJules and its included references : https://www.instructables.com/Build-the-Four-Channel-SSM2019-Phantom-Powered-Mic/
Basically : you press the phantom power button and the inputs gets polarized to a specific voltage. He uses 15V, I have yet to decide what to use.
To be done : this part will be reused for other parts, so we will study this later.
To be done, still have to check whether resistor cause too much noise vs using dedicated audio ICs ( it'll probably be resistors)
This'll be short : I'll simply use an out of the box two channel ADC that outputs I2S at 24 bit 96kHz. That's all it has to do, and most modern ADCs are so good that most of the issues will be with my circuit, not the chip.
To be done : this part will be reused for other parts, so we will study this later.
In the general description of the project, I briefly mentioned the 4 core units of the project :
Those are obviously incredible simplified. In the next few logs i will write a bit about the inner workings of and limitations of each module, the protocols that will probably be used and why they'll be used.
This one will be dedicated to the star of the show, the MIXING MODULE
The mixer is able to take digitalized audio streams, process independently and together, then output them to the outputs selected. Here are all the features that i want
Feature | Use Case |
Stereo Sound through USB | Using Headphones or 2.1 systems |
Modularity | You want to plug 2 PC and 1 guitar or 5 microphones and 1 PC |
Per Output Input selection | You want Output 1 with Input 1, Output 2 with Input 1 and 2 |
Per Input volume control | Allow to turn down your microphone if it's too loud |
Per Output volume control | Allow to turn down music if it's too loud |
Each Input get its own EQ / filter | If your microphone is hissing, you can remove it from all the outputs easily |
Each Output gets its own EQ / filter | Make using a subwoofer or a tweeter at high power easier |
Each Output gets its own delay line | Allows to synchronize all outputs, if one is too delayed because of filtering |
Specs aren't the point of this project, i want them to be lax enough to have fun and to learn : I'm not looking for a 0.0001% THD or something like that, at least not for now.
My setup is rack mounted, so it'd be fun if the modules were rack mounted too / something akin to eurorack in a 19 server rack ? ¯\_(ツ)_/¯
the audio streams will be encoded in PCM over I2S because it's a standard and makes creating input and output modules easier since compatible ICs already exist.
NB : every stream from now on is considered stereo, until specified otherwise
In simple terms, PCM means that the audio signal is encoded by saving its amplitude at a specific frequency. a 8bit 1kHz PCM stream means that every milisecond, you get a byte of data representing the amplitude of the audio signal. 0xFF is the maximum (positive values) , 0x00 is the minimum (negative value) and 0x0F is the middle point or zero.
NB : those values are not representative of volts or whatever, they're normalized. each ADC has a gain of "bits per volt" called resolution that ISN'T shared to the system. this means that over the entire processing chain, we have no clue how loud the sound is. This tie with issues like headroom, clipping etc.
The fact that we are encoding amplitude makes mixing absurdly simple :
NB : this result only works if all the streams are at the same frequency
The mixer must be able to be used for recording music, so instead of the average 48kHz sampling frequency, we will go with 96kHz. This roughly means that if you want to process your instrument by slowing it down by a factor of 2, you will still end up with a 48kHz sampling frequency. This doesn't increase quality in any other way.
N.B : Some acquisition cards go up to 384kHz for the same reasons, we could but we won't go near that since i have no way to actually test it nor do i care about it.
With the same idea, we'll go into audiophile territory a bit and go with 24bit encoding instead of 16bit, even though the differences can't be heard. Following the same logic as choosing 96kHz over 48kHz, this will allow more flexibility when processing amplitude instead of frequency (ie : you can digitally amplify audio more before hearing distortions)
So, instead of going with the usual 16bit 48kHz, the inputs are 24bit 96kHz streams, which isn't that special for high end audio hardware.
Let's say i have 4 inputs...
Create an account to leave a comment. Already have an account? Log In.
Become a member to follow this project and never miss any updates