DSP – how, why, troubleshooting, different hardware, etc.Posted by ajc9988 on September 4, 2021 at 5:04 pm
So, I decided to open this thread to consolidate work on DSPs here. Regardless if you are using Texas Instruments solution that is similar to SigmaStudio, using DIRAC, using miniDSP’s software alternative to SigmaStudio, etc.
DSPs and active crossovers have their own challenges. I even considered putting this in the crossover section because of the DSP relation to active crossovers. But there isn’t a neat place to tuck this. @TVOR-Ceasar – if you want, you can add a new topic in that section for DSPs, as it is similar to crossovers, amplifiers (as some DSPs now have amps with them, such as the JAB series among others), pre-amplifiers due to the signal processing, etc.
@ElliottDesigns – wanted to tag you since you mentioned about this.
Now, recently, I found the problem I was having with some of my designs for the JAB5. When trying to add the part for external potentiometers for each speaker after the active crossover, it stops playing sound. I am still trying to figure out why, as I have decided to do three independent gain knobs for the 3-way, then the master volume.
Does anyone have more experience with sigmastudio? Otherwise, I’ll post the solution once I figure it out.
Edit: turns out it was working, but unlike the master volume which defaulted to full volume, the gain switches defaulted to off. I didn’t plug the potentiometers in because of being lazy, but plugged them in to try. And they work. so now back to figuring out how to import the frequency response (or what I am doing wrong) for the autoEQ. Then is making FIR filters. Then just playing around with different ways to adjust phase, to adjust timing, etc. That way when I build my boxes, I can tune them quickly.
MemberSeptember 4, 2021 at 8:27 pm
There should be an FIR block in sigma studio that you can add lines to in order to accommodate more taps, should then just be able to paste it in in the form of text. To get the text coefficients I just use a program called rePhase.
MemberSeptember 5, 2021 at 5:16 pm
@elliottdesigns rephase worked well for the coefficients, and you can just load the txt file into sigmastudios. Much easier than changing the format from REW saved txt files for the auto-EQ. Results are quite nice.
So I have now fixed the python code from the ADI wiki pages so that it properly converts the REW files over for use.
https://ez.analog.com/dsp/sigmadsp/f/q-a/65120/mlssa-and-auto-eq-algorithm (credit to those that wrote it, I just fixed an error in the code which made it not run; You will need to change the filename in the program for each run, or you can save the text file to the same as the filename in the program, then change filename after you do the conversion to work with sigmastudio).
If you have a python already installed and install another one, then you may need to fix which path is being run in environment variables (if in windows). You may also need to get numpy (which aside from pointing to a different python to run it, the other python didn’t have numpy installed, so had to install that then run it after figuring out the environmental variables setting for PATH; just giving some hints here at what may need checked to get this to work depending on how you have your programs setup on windows).
After having done that, the block format for sigmastudio works directly with rePhase, so you can import measurements easily after the python conversion. You then just set the number of coefficients and a couple other variables and start playing. Thank you for pointing me towards that (I think you mentioned it before, but I now am to where I played with it finally).
MemberSeptember 5, 2021 at 6:46 pm
@elliottdesigns – I am, but there is another reason, which is that I may use a sigmastudio compatible chip in the future for upgrades. Another reason is Texas Instruments has generated a GUI based software with roughly equivalent functionality, meaning more in the space will likely adopt having a software that is similar in function for programming.
But I definitely understand the limitations. Moving forward in future builds, I will have the amps separate from the data processing boards. Possibly even just doing an RPi or Teensy to a HAT for ADC/DAC, then optimized code for FIR filtering, which that would be (for an RPi4b with a HAT around $65 for a HiFi-berry ADC/DAC, $35 for the RPi4b 2GB, and then the cost for the amplifiers being fed from the HiFi-berry).
In fact, one could even do the RPi to the HIFIberry ADC/DAC to a JAB5 if making it needlessly complicated (no master slave, just an extra digital to analog conversion). You do all pre-processing on the RPi, then use the jab (or an adau1701) for simple active crossover routing, then to the amplifiers.
Is there a good solution for acting as an active crossover for RPi or Teensy? Granted, you can put out 3 outputs off the Hifi berry, so it is limiting the frequency range per output.
Could you talk about your project and its current direction? This thread is about DSP, regardless of manufacturer. All solutions welcome here.
MemberSeptember 5, 2021 at 7:04 pm
@ajc9988 Yeah, I’ll get to doing a write up sooner or later. What I’ve been doing is creating a stereo filter where the left channel is a linear low pass with the linear version of the REW correction filter applied and the right channel is the same but with a high pass. I then use the left channel output from the amplifier for the woofer and the right channel for the BMR. That’s the basic gist of it. 👍
(My current setup is just using the many analogue outs of my motherboard that have been rerouted and had FIR filters applied using Equaliser APO, only have stereo ATM, but I have enough outputs to do quadrophonic 2-way outputs before having to get teensy boards set up)
MemberSeptember 5, 2021 at 8:29 pm
@elliottdesigns completely understandable on doing channel out instead of L/R using one for BMR.
I’m also looking at the newer chips from ADI. The person on the forums pushed for the ADAU1452, which can do over 20,000 taps. The ADAU1466 and 1467 can do more than the 1452.
That is a core board on top of a board with all the inputs and outputs. If you then connect the outs (which this board is only stereo), you could put that straight into small amps for each driver (still thinking of this in a plate amp scenario), while also having good performance. But, that is just another option for those that have not seen it. Just note, the version of just the core board is around $50, the version of the core board connected to the other board is $160 and I am talking the latter. Then is buying an amp per channel. Solution (with power supply) would likely run $250-350 would give good performance. But, once there per speaker, you could look at the SHARC lineup. https://www.aliexpress.com/item/1005003234803636.html?algo_pvid=04b0d785-c8fb-4b1a-9c36-dd216b53f7a1&algo_exp_id=04b0d785-c8fb-4b1a-9c36-dd216b53f7a1-1 ($135 for a core board for a 21489 SHARC) ( https://www.aliexpress.com/item/4000685375571.html?algo_pvid=5fbf5f0f-d60f-430a-9c5c-fbf351293c18&algo_exp_id=5fbf5f0f-d60f-430a-9c5c-fbf351293c18-7 ) The second link shows a really cool setup for the SHARC, although you have to buy all the components which will be around $250, plus the additional cost of each amplifier and your PSU (power supply unit), that really isn’t too bad to get a SHARC going.
MemberSeptember 5, 2021 at 9:07 pm
@ajc9988 True, but you could just instead use a Teensy for far cheaper and only lose 2000 taps of capability since the Uniformly Partitioned FFT program/audio library add-on does 18 000 taps. 🤷♂️ Just a suggestion. Why spend over 5x the price for barely any more taps? 😉
Edit: sorry didn’t see the other prices included amp and power supply, still. It’s probably a little cheaper and a lot easier to set up 🤷♂️
MemberSeptember 5, 2021 at 9:51 pm
I do agree, which is why I may, for this project, get that and try to set it up with an ADC, then just output it to the JAB to finish with the amplifier and crossover and knobs (not like it is doing much more than that after using the FIR on the Teensy4.1). Or throw a passive crossover somewhere in the mix. In any case, you are right in it costing so much more for the same outcome.
What have you decided to use for the ADC/DAC with the Teensy?
Also, you read right, those solutions are before including Amp and PSU. So $162 for the ADAU1467 (which has triple the program memory and double the parameter memory of the ADAU1452 which does 20,000 taps, but the processing speed, etc., is the same; You do not need to deal with ADC/DACs), you get a fair amount. With the SHARC solution, you are dealing with a ready made routing solution that can support USB, ethernet/ tcp/ip, the modular nature, and it being able to do many more calculations. I also did not check if the modular board implemented the internet support or USB support, I just know the processor on it is capable.
You are correct. That is probably the economic decision there. But let me know a bit more what you are doing for ADC/DAC.
AdministratorSeptember 6, 2021 at 3:37 am
You both are doing great work! I really don’t have much to add to the discussion. But I am impressed with what is going on here. I’m not sure I’ll be much of help, but I am following this thread closely.
MemberSeptember 7, 2021 at 4:56 pm
@ElliottDesigns – I figure I can start collecting the data here on different options and daughter boards (HATs, EZ expansion boards, etc.) as well as start better describing why some of the higher cost items may be a better option (even though they all take work and the highest cost option is just buying a finished product).
All In One Solutions
This is a good entry into this area. It contains the most basic of filtering and acts as an active interposer with ways to address time and phase shifts. The downside is that it is limited severely on the instruction count, which causes it to really be a limited choice. Total cost is at most $70 at the moment with 4CH@100W@6Ohms, thereby being the amplifier, the crossover, and entry level correction. There is a learning curve to the SigmaStudio software, but once you get the ropes, it generally is easy (and if you plan to use ADI’s more advanced chips down the road, this is a good way to cut your teeth). As with any AIO, it is a jack of all, but master of none.
This is possibly the lowest cost solution, although the HATs/expansion boards may greatly increase, depending on selection. It is able to do around 20,000 taps for a fir filter. Now, you still have to buy amplifiers if this is going inside of a plate amp, but it also can be stand alone to drive multiple channel speakers as well as integrated. It is a cheap, powerful solution. If you add the cost of the 4.1, the extra memory to solder on, and the Hi-Fi Berry DAC+ ADC Pro, you would be around $100 in, not including power supply (PSU) or amplifier. But, for 20,000 fir taps, that is not bad at all.
Raspberry Pi 4b
Starting with the Pi 4B, the processing power of the Pi greatly increased over prior generations. This is comparable with Intel’s mobile processors from circa 2015, IIRC (not meaning Atom processors, meaning laptop, and one of the pages I saw compared it to either an Ivy or Haswell laptop processor, which still won, but not by much). This can be a power house, but requires the right expansion boards as there is no analog connections for this processor. That means buying an ADC/DAC, as well as any other components you would like. You also have to buy the PSU and the amplifiers separately. Being such a large community, a lot of legwork has been done on this developer board. But, there is a time and learning cost. The board runs linux and runs arm instructions instead of x86-64. You will still have to learn to compile kernels, integrate kernel modules, etc. You may have to learn some basic python/c/c++ coding (more of google copy paste, with a learning curve and discovering enough to know when to change specific variables; please whenever possible credit the original sources of code, as it is their work that gets this done and they will usually appreciate the shout out). The cost of the basic RPi 4b with 2GB ram is about $35 before shipping. With an HDMI mini to get it programmed (need at least one), there is another $7-8. Plus the SD card, there is another $5-10. Then the HAT like the HiFi berry is $65. Then the amplifiers. You quickly are looking at $115 before the amplifier, plus then needing to know a bit more on programming. But, there are even HATs that can extract 8-channel audio from HDMI, meaning you can create a pre-amp that pulls the audio, then a different hat not mentioned can output to your entire 7.1 system, all while running a FIR filter which one person claims can do over 200,000 taps per channel. Feed that into amps per channel and you could have a really good time. The downside is the learning curve and getting everything to speak to each other correctly (if it was easy, this would just be the way). The FIR claim was made on the git page of CamilleDSP, which works with known software on the platform like Pulse Audio. You can even do low level coding to make this work. Lot’s of options, but to use the advanced features, the learning curve is steep. Not for the faint of heart.
Analog Devices Inc. (ADI) is a somewhat large presence in the DSP market. They have made from Blackfin and Sharc systems that work with Dirac products to their DSP and Codec lines that work with SigmaStudio. Many of miniDSP’s products are based in one way or another on their chips (although competing product lines exist from Texas Instruments for DSP, with them releasing a graphical programming interface; I have seen LabVIEW and Code Composing Studio, which are similar to ADI’s sigmastudio and CrossCore Embedded Studio, respectively). And not only that, companies can then develop their own, more limited software so that certain abilities are not accessible to the end user, which makes sense so you do not have to talk through advanced features on the more advanced software platforms to troubleshoot someone trying to add functionality. See the miniDSP 2×4 non-HD as an example (uses the ADAU1701, just like the JAB series from Sure Electronics).
With this, if doing a one off project, one might consider buying project evaluation boards with their expansion boards directly from ADI. Some of the following are examples that might be worth considering at varying costs.
This was one of the higher rated chips for doing DSP for awhile, even though some may consider it getting long in the tooth. The price is listed as $315 from ADI, but you have to contact them directly to buy it. The link is at the bottom of the attached page.
What you are getting is the following:
- Analog Devices ADAU1979 – Quad Analog-to-Digital Converter
- Analog Devices ADAU1962A – 12 Channel, High Performance, 192kHz, 24-bit DAC
- CAN-FD 2x ADM3056E
- Macronix MX66LM1G45G 1 Gbit OSPI Flash Memory
- Gigabit Ethernet TI DP83867
- 10/100 Ethernet TI DP83848
- USB 2.0 PHY Microchip USB3340
- USB 2.0 to QSPI FTDI
- MicroSD Card Socket
- 2x A2B® Interface Connectors
- Debug Interface (JTAG), On-Board ICE-1000 Emulator
The ICE-1000 Emulator, bought separately, costs $150 from them. You also have multiple ethernet connectivity, the DAC and ADC chips, the engineering for the board, etc. What you are paying for is an extra cost for what they developed to showcase the product. It supports a linux kernel as well. It works with CCES. I do not know that this is DIRAC ready, but after getting it setup, there is a chance you could negotiate a DIRAC license from DIRAC directly (possibly $100, give or take depending on functionality, but they charge that for a product from JBL integrating the 21489 SHARC chip, with that license covering the full range of frequencies; but this is an individual negotiation between you and them, so the pricing could be more or less). Even with the license, you will need to integrate the software and debug/troubleshoot to get it to work right. If you have all the equipment and knowledge on testing, this may be a good solution for you, especially since the OpenDRC product from miniDSP uses the weaker 21369 chip (which has other benefits over the 21489 chip, like 8 different native convolution frequencies instead of 4 as is found on the other AlieExpress product that I pointed to), costs around $315, doesn’t support DIRAC but does support openDRC (as its name suggests) and importing filters from third party software, such as RePhase. It is a finished product, so less hassle, has 2.4GFLOPs of compute (21489 has 2.7GFLOPs and a larger L2), and works with software many of us already know. The point is, you are now paying in the range that you can start buying finished products, although weaker in processing capabilities, that require less work to get the results desired. Always be aware of the point at which buying a finished product becomes the better choice over building your own, as unless doing it for skill building or projects to keep us busy, it is at this point introspection is needed. To be clear, though, products using the SC594 chip have costed $750-1500, so if you can get it working at half that $750 mark (ignoring the price of the case, PSU, etc.), then maybe it is worth it to push forward. I just wanted it to be clear that there is a point after which the cost/benefit of DIY switches, and looking above the $300 threshold, you may be quick approaching the threshold. But, these boards also include DAC/ADCs and the hardware is known to work with each other, so the main issue is getting software working correctly. That is part of the benefit. And some functions, like DIRAC, if willing to pay and get them working, are a hell of a software library to access.
There is also a SigmaStudios for SHARC, so once you get to that point, you can work with that and include advanced libraries as well. https://www.analog.com/en/design-center/evaluation-hardware-and-software/software/sh_sigst_00.html#software-overview
But, there are some boards from ADI that cost too much and should be ignored, like the $500 board for the 21489, especially when alternatives to it are on the market at lower pricing.
This board comes with 4in and 8output, thereby saving on the need to buy an ADC/DAC board. It is able to quickly be programmed with sigmastudio. You do not have amplifiers with it, but that is fine. This can do 20,000 taps, similar to the Teensy 4.0/4.1 board. What you are paying for is the convenience of it being already done and as a single board, instead of multiple boards wired together. You are also paying for the ease of integration, as you can quickly run the wire from this over to the amplifier in a plate amp, or have this as a small form factor for a home theater (although with only 4 in, capabilities are limited, although it could run a 2 speaker 4-way crossover scenario easily).
But these are examples of buying evaluation boards from the manufacturer, which designed these to make other companies want to buy their chips and design their own. These are not made for end consumers, but that, arguably, is what makes them fine for DIYers that are willing to put in the elbow grease to do what the corporations are doing to make their products.
Anyone interested in DIY electronics has no doubt stumbled across AlieExpress a time or two. Who could resist looking through, after all, so many boards are assembled or products assembled in China, there is a plethora of talent. Not all is good, but with a keen eye, you can find some possible gems (note, I have not bought the specific products yet, but they are interesting and can deserve consideration).
This ADAU1467 board has dropped in price to $143.78, it is the core board and the expansion board, it has an AD1938 4 ADC 8 DAC chip and an ADAU1977 4 ADC, giving a total of 8 input and 8 output, making this a board that can be used for a 7.1 correction pre-amp. Once again, the premium is for the 8 input and output and the convenience because the hardware and the expansion card are made for each other, that way you throw it in sigmastudio and get started. The chip is capable, doing approximately the FIR taps of the Teensy, supposedly. The question is, is it worth the premium. That is a personal question. Also, you may want to change the channel in plugs to something else, like RCA or any other number of connectors. If so, you either have to desolder and resolder, or get the two channel plugs (like for headsets) that break out into a pigtail where you can attach it to each channel having RCA or something similar mounted on the back of the case. But those are personal choices, just be aware of there being other cost considerations before diving in.
It seems from the cursory look I read this posting wrong. The total cost is $147, has one ADC card with 4 channels of input, then 4 DAC boards with 2 channels of output each, the backplane (everything plugs into), and the core board for the SHARC ADSP-21489.
This uses the Burr-Brown TI PCM1804 ADC and the Burr-Brown TI PCM1798 for the DACs. That is, these have an extremely high SNR, 24-bit 192kHz sampling, etc. Stop band attenuation of -98dB, pass-band ripple of 0.0002dB according to TI on the data sheet ( DAC https://www.ti.com/lit/ds/symlink/pcm1798.pdf?ts=1631033417699&ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FPCM1798 ; ADC https://www.ti.com/lit/ds/symlink/pcm1804.pdf ).
So what are you paying the extra for? You are paying for great quality ADCs and DACs, the engineering for the plug and play, the ability to mount the backplane right to the back of the case for the RCA connectors, and the capabilities of a SHARC processor while using the SigmaStudio for SHARC program with the libraries that that has access to.
Edit (new content below):
So, there are numerous HATs that can be used with the raspberry pie, but there are a couple to note:
HiFiBerry DAC+ ADC/ Pro
$50 version https://www.hifiberry.com/shop/boards/hifiberry-dac-adc/
$65 version https://www.hifiberry.com/shop/boards/hifiberry-dac-adc-pro/ (better ADC THD+N of 90dB instead of 85dB, slight other differences, SNR on both devices is the same)
Now these use the PCM5122 (32-bit 384kHz DAC with an SNR of 112dB; https://www.ti.com/lit/ds/symlink/pcm5122.pdf?ts=1631050235133&ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FPCM5122 ) and the PCM1863 (2 channel 192kHz 110SNR ADC https://www.ti.com/lit/ds/symlink/pcm1863.pdf?ts=1631050443126&ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FPCM1863 ).
This would be good if doing a speaker build for up to 4-way with a raspberry pi.
If you are looking to get audio extracted from an HDMI plug, such as using the RPi with camilledsp, and using this to feed a room FIR system, this may be an accessory. You do not have to mount it as a hat. This can allow you to use an audio HAT, then connect this to the RPi through alternative means. That will allow the signal to be processed, then put out through the DAC HAT, opening up different possibilities. This is discussed at DIYAudio forums. https://www.diyaudio.com/forums/pc-based/334443-2-8-dsp-platform-using-raspberry-pi-hats.html . If this is what you want to do, one might consider the Audio Injector Octo sound card (below), which allows for 6 inputs and 8 outputs.
As such, this build becomes looking at more of a full room pre-amp scenario, with an ability to take in the HDMI audio for 7.1, then deliver it out to the amplifier. But, this is also possibly a solution to take in the audio for a home soundbar, possibly (although it is not clear that ARC is working on the RPi, so this use does need fleshed out and I have not fully read the thread yet, so I am not fully informed of the nuance yet).
Audio Injector Octo
Details are light on this, so just be aware.
https://elinux.org/RPi_Expansion_Boards#Sound (listing Wolfson and other sound cards).
Not all HATs are worthwhile, and depending on what you are building, suddenly the ADAU1467 and ADSP-21489 may become more viable options.
MemberSeptember 7, 2021 at 5:46 pm
@elliottdesigns – I’m also doing it on a per speaker basis, but have looked through to understand what these different solutions are, cost comparisons, etc., after our last conversation and not being able to answer why the higher cost solutions should be considered. In fact, that SHARC one, by finding a different listing on AliExpress, looks even more compelling. Per speaker, after buying your individual amplifiers or a 2.1 amp for a 3-way, etc., you can keep a couple of the DAC cards out and just hook them to the amps to the driver units.
And yes, I do prefer one unit doing all the processing and making it simple. Hell, if I had an easy way to hook up the I2S to the RPi 4B (even with all the work done, no one has created a simple GPIO map to say connect the MCLK here, connect the BCLK here, connect the LRCLK here, connect the sdata here), I would even recommend considering the JAB5 to the RPi. Right now, if starting over, I’d likely go RPi with the HiFi Berry DAC+ ADC hat and call it a day. Take the output straight into the amplifiers and be done. Nice, simple, elegant. ( https://github.com/HEnquist/camilladsp ). Add in the kernel support that was removed from the more recent builds for the DAC+ ADC, run camilladsp plugin to pulse audio, output that to the amps. Sure, that costs a fair bit more than $70 per, but since I’m talking about the $50+ extra to add in the RPi, I’m now approaching the cost of just going with some of these other solutions.
I bought the JAB5s early on, not realizing how much I planned to take this project into a higher quality product. Now that I’ve done more research, I could buy better dedicated amps, better all in one processing solutions, better DAC and ADC chips, better SNR, etc.
Also, I looked at the other solutions because building a pre-amp may be in my future for when I look at building a 5.1 or 7.1 system. That could easily be turned into a receiver if you want to put amps in the same case (better have good cooling), along with then outputting more watts per channel than you can get on even high end receivers (also means a MASSIVE power supply to feed the amps so much, so keep that in mind).
I’m a techie, but even I have much to learn. Had I known audio had such good tech and nuance involved, I may have done this as a hobby sooner (building computers and overclocking took up that budget, but now, something tells me audio will take it up for a good while now)!!! Same was true with display calibration.
Also, thank you on the RePhase point. That was awesome!
Right now, I’m researching HATs (which started to figure out how they implemented the GPIO connections, that way to do the same from the JAB5 to the RPI and back). But, I found some cool ones, like taking 8ch audio from HDMI connections and a breakout to an 8-output. That will be added shortly above, followed by moving back to figuring out how to get the JAB5 and RPI to speak.
MemberSeptember 8, 2021 at 4:43 am
MemberSeptember 15, 2021 at 4:27 pm
@elliottdesigns – so this morning, while still waking up, I flipped an input GPIO debounce to a data line and blew up one of the amp chips in my JAB5. Turns out they use the TDA7498E chips. I have a few other SMB components right by it to check and ask the values from Sure Electronics to verify if those need replaced along with the TDA7498E, but it looks primarily like the chip being replaced may fix the issue.
At least on this board, I do not see a mirror on size of the SMB resistors that come after the amp chips.
But, looks like I will get to practice my soldering. LOL.