ΣSigmaStudio Ask AI Русский Log in

[SHARING] Filter coeficents online calculator with sample code for C++, C#, MicroPython and Arduino Sketch

SigmaDSP & SigmaStudio Rocha Jun 17, 2021 00:00 3 replies Original on forum ↗
Thread Summary

Thread Summary

The user shared an online filter calculator that generates code examples for C++, C#, MicroPython, and Arduino Sketch, which can be used freely for personal or commercial projects. The user also inquired about transitioning from SPI to I2C control for a 1701 device, undefined parameters in the generated C code, and the calculation methods for crossover filters like Linkwitz Riley 24, Butterworth 24, and Bessel 18. The final answer thanked the user for sharing the resource, while an accompanying answer noted a bug in the peaking filter calculations and provided a workaround using Bob's spreadsheets.
AI Generated Content
Subscribe
Rocha Question
Jun 17, 2021 00:00

Hi guys, im sharing an online filter calculator, that can generate sample/example codes for C++, C#, MicroPython and Arduino Sketch, also you can check your own code calculations results

This calculator can generate code examples, easy for use with microcontroller.

folow this Link: Online Calculator

The generated code examples can be used for free, either for personal or commercial use, they do not require a license, nor are they copyrighted!

Edit Notes
Added copyright exemption.

[edited by: Rocha at 6:08 PM (GMT -4) on 16 May 2022]

filter design

filter parameter

software

filters

filter implementation

filter coefficient

Show More

4150.DSP-Filter-coeficents-calculator.png
4150.DSP-Filter-coeficents-calculator.png
DaveThib Reply
Oct 21, 2022 00:00

Hello Rocha,

Thanks for the link to this resource.

Dave T

liangsea Reply
Oct 23, 2022 00:00

Hello, I still have many questions. For example, I used to use 1452 spi to control. If the first write register address is 0, then it is write. If it is 1, then it is read.

void SIGMA_WRITE_REGISTER_BLOCK(byte devAddress, int address, int length, byte pData[]) {

#if USE_SPI    // Start of function for SPI write
    // Assert SPI slave select line
    digitalWrite(DSP_SS_PIN, LOW);        // Assert SPI slave select line (active low)
    SPI.beginTransaction(settingsA);      // Initialize SPI
    SPI.transfer(0x0);                    // SPI read address + read/!write bit  0 or 1 read or write
    SPI.transfer(address >> 8);           // High byte of address
    SPI.transfer(address & 0xff);         // Low byte of address
    for (int i = 0; i < length; i++) {    // For each data byte in the packet...
        SPI.transfer(pData[i]);           // Write the data byte to the DSP
    }
    SPI.endTransaction();              // Release the SPI bus
    digitalWrite(DSP_SS_PIN, HIGH);    // Pull up the slave select line
// End of function for SPI write
#else     // Start of function for I2C write

Now I use i2c to control 1701. I don't know the read/write address. The method is different from that of SPI。

Also, I need to calculate the C language code of the filter. Some parameters of the code downloaded from the online calculation are undefined, and I don't know how to define values. I want to get the code for calculating the filter. There is no such code in the routine you provided for download.

res = coeficents( family, FILTER_2ND_BYPASS, fs, 100, 1.41, 1, 1 );
writeToDspSafeload( address, (unsigned char*)&amp;res, sizeof(res) );

Amp and res are not defined, so I don't know how to define them.

for (int i = 0; i < sizeof(coeficents_t); i++) {
if ( i > 0 && (i+1) % 4 == 0 ) {
Serial.printf("%02X\r\n", (unsigned int)((uint8_t*)&coeficents)[i]);
} else {
Serial.printf("%02X ", (unsigned int)((uint8_t*)&coeficents)[i]);
}
}

Lt is also undefined

Also, how does Crossover Filter calculate? Filter TYpe: How is Linkwitz Filey 24 or Butterworth24 or Bessel 18 calculated?

JayEsp Reply
Aug 1, 2025 00:00

Just what i was looking for, together with Bob's spreadsheets i was able to create my code for the esp32, however there seems to be a bug in the peaking filter calculations, changing it to the formulas in the spreadsheet worked