MCUdude / SigmaDSP

A versatile Arduino library for interfacing with the ADAU1401, ADAU1701 and ADAU1702 audio DSPs
GNU Lesser General Public License v3.0
165 stars 33 forks source link

Implementing custom crossovers #21

Closed SitrucL closed 2 years ago

SitrucL commented 2 years ago

Hi,

I've recently come across this library and it seems to be the ideal tool for attempting to create a hardware controlled variable cross over however I've been struggling to understand how I would go about implementing these blocks (see attached image) in code. My aim is to have an input split and then fed through 4 cross overs and have 4 outputs at the end

The generated dsp params file (zipped and attached below ) is a lot more complicated compared to the examples and Im not quite sure how to go about feeding one filter into another (cascading them).

Is anyone able to offer any help as to how I can implement my sigma studio project using this library? Is there a simpler way to achieve my objective with different sigma studio blocks?

Thanks in advance

image

SigmaDSP_parameters.zip)

MCUdude commented 2 years ago

If you can live with second-order filters, you can actually use the 2nd order EQ algorithm! I haven't tested this exact code, but I've used the exact same filter block as you do, only with 2nd order filters.

Figuring out algorithms yourself can be a bit time-consuming. Most of the algorithms in SigmaStudio aren't proprietary, but they are still closed-source and have to be reverse-engineered. There is a lot of resources on the Analog Devices forum on how you can do this. This library is just a versatile tool that lets you quite easily interface with your DSP from a microcontroller once you have a working algorithm. If you want a simple challenge, try reverse-engineering the volume slew slider and see if you can get the same algorithm as this library uses. Use the output in the SigmaStudio capture window.

There are also simpler algorithms you can crack such as muxes/demuxes or the linear gain block.

// Create struct object for a filter
secondOrderEQ filter;

//...

// Use ::lowpass or ::highpass
filter.filterType = parameters::filterType::lowpass;

// Filter frequency 100Hz
filter.freq = 100;

// Q value 0.7071 used by Sigma Studio
filter.Q = 0.7071;

dsp.EQsecondOrder(MOD_NFILTER1_ALG0_STAGE3_NTHORDERDOUBLE1_0B_1_ADDR, filter);
SitrucL commented 2 years ago

Hi MCUdude, appreciate the advice, I am definitely going to switch over to 2nd order filters and experiment with those. I have been looking through the forums which has proven useful in finding ways to achieve my objective but I'm still unsure of how to cascade the filters (one filter feeding into another filter) are you able to provide a quick example of how that would look using this library?

e.g

High pass 2nd order filter feeding into a low pass 2nd order filter?

edit: I accidently closed the issue

Thanks in advance

SitrucL commented 2 years ago

I have just had a thought, is this library solely controlling the sigma blocks and the logic from the original sigma project (linking of blocks) still maintained? Meaning that all I need to focus on is controlling the blocks via the library with hardware from an MCU? I wont have to specify or adjust any outputs from the blocks as these are exported from the original sigma project file etc? If so, that is perfect

MCUdude commented 2 years ago

The program flow you've created in Sigmastudio is not touched, this library only changes parameters that "belongs" to a block. You write to different blocks by using different addresses as shown in various examples.

It's just like changing the numbers in SigmaStudio in real-time.

SitrucL commented 2 years ago

Thanks for clarifying that