DSPRelated.com
Forums

Audio Signal Filter

Started by RogerG 3 years ago15 replieslatest reply 3 years ago512 views

I am after some help.

A few years ago I built an analogue signal audio filter to provide high frequency, mid range and low frequency for my audio amp. This works fine but I am now looking to design a digital filter to do the same job.

My experience is limited; I have programmed the microchip 18f series a few times with assembly for my audio attenuator with series output to three digipots and an LCD display which works fine.

I am looking for a suitable processor for the filter. The microchip processors appear to be too slow for what I need but I would have liked to use them as they appear to have a long production cycle. With my speed of design I am worried the processor manufacturer will stop production before I finish the design.

I am ok with designing and building some circuit boards but I have been limited to through hole components although I am looking to use surface mount.




[ - ]
Reply by drmikeAugust 15, 2021

The DSPic33CK series from Microchip is a 100 Mips processor so it can do some analog filtering.  The ADC's are in the 3 MHz range, so it's plenty fast enough to gather signal.  You can get eval boards which will let you attach your own analog components to the ADC's and DAC's on the processor.  It's a fun toy to play with and the MPLAB X IDE has a nice debugger which will talk to the eval board.  Or you can get a the ICD debugger tool and connect to the processor directly.  

I've used the DSPic series for several home projects and it's pretty easy to figure out how take advantage of the DMA and interrupts.  Check out this eval board as an example:

https://www.microchip.com/en-us/development-tool/D...

[ - ]
Reply by RogerGAugust 15, 2021

I did look at the DSPic33CK but wasn't sure. That's good from what you have said and I may well try it. My problem is that it takes me a long time to design things so I can probably only go down one equipment track. I like the microchip processors and hopefully now will be able to use them. 

[ - ]
Reply by bholzmayerAugust 15, 2021

Hi Roger, 

As Tomasz proposed, I'd use a Sharc module.
I tried this way some years ago: just picked one of the available evaluation boards with appropriate ADC/DAC codecs. They will come with perfectly adjusted demo code and a plenty of libraries.

Usually you'll find demo code which contains the whole signal path like
accessing ADCs/DACs, handling interrupts etc, so that you can directly create your filters etc. Usually you will not do it in assembly code, but in C (or C++).

Since demo code will give you a good and quick starting  point, don't hesitate to use such a high level language. You'll be astonished how quickly you get to a running system. If it should come to the point where you want to change the processor family, C (or C++) code will be easily adoptable to the new system.

If you're successful with the eval board, afterwards you could even take the same codec and processor chips to your own hardware and use the same code (if that's your goal) or just live with the eval board. 

Good luck

Bernhard





[ - ]
Reply by RogerGAugust 15, 2021

Thanks, yes I think I will use C or C++. It will be another learning curve for me. When I did the program for my audio amp attenuators and LCD display I ended up with 15 pages of assembly code. So hopefully the filter program will be a lot less using C.

I am hoping I will eventually be able to incorporate the attenuation within the digital side of the amplifier then use the DAC before the amp inputs.

It's quite new to me what with changing to digital, using surface mount components and learning C, could take some time. It took around 5 years to design and build my triamp but it was worth it, had a few failures along the way but got there in the end.

It seems that the sharc family of processors have been designed with DSP applications, will check these out but also for my basic learning I may well use the microchip dsp33 processor.

[ - ]
Reply by CustomSargeAugust 15, 2021

Howdy, 1st up: I'm bad w/audio (never get the SNR good enough), analog sensors not so bad.

I'd be looking at various DSP mfgrs and their libraries of canned functions.

Upside: surface mount is your best friend: ground plane effectivity well past any through hole design. I'll suggest staying with SOIC packages, TSSOP is too fine unless Well skilled and proper soldering tools. If anybody can work BGA (and the like) by hand, I'll kiss their ring - they are truly wizards.

Good Hunting - you've got a Lot of entertainment in front of you.  <<<)))

[ - ]
Reply by RogerGAugust 15, 2021

Thanks for that, have been putting off using surface mount but I know I have to do it. One twitch with the tweezers and it's gone, but will be a challenge.

[ - ]
Reply by CustomSargeAugust 15, 2021

Howdy, one toy I use is a spring loaded rubber tipped probe.

Clamp it to the table, lift it up and get it close to holding the chip in proper position. Nudge the board or chip until aligned - solder away.

I shied away from surface mount for Far too long. It's a mind-set and a tool building learning curve.   G.H.  <<<)))


[ - ]
Reply by tmarcinAugust 15, 2021
You would have to define whether you want to design the entire DSP audio system (processor + audio codecs) yourself, or if you plan to use ready-made modules. The dsPIC33 can be used in place of the family 18, but they can process speech, not audio. Currently, DSP processors are not programmed in assembly language rather ...

Maybe it is worth using such a SHARC Audio Module (ADZS-SC589-MINI) from Analog Devices?

https://www.analog.com/en/design-center/evaluation...

[ - ]
Reply by RogerGAugust 15, 2021

I would want to do the design myself, that's my nature. Although I have mainly used assembly for the 18 series pics I have also C. I found assembly better as I felt I had more control of the input and output ports to the digipots and LCD display.I think the digital filter may be easier done in C.

I will look at the shard module, not sure about the IDE for it yet.

[ - ]
Reply by atomqAugust 15, 2021

Roger,

I'd have a look at the STM32G series for the following reasons:

1) single-precision fixed-point FMAC built-in. All the filter crunching would be done away from the core.

2) single/double-precision FPUs allow fast floating-point type multiplications fastening filter calculations which are to be performed by the core

3) kilobytes of core-tied fast RAM allowing time-deterministic operations

4) the core frequency of up to 170 MHz

I'd not suggest using 12-bit ADC which is on-board even with hardware-based oversampling, but rather go in audio I2S external ADCs which can be handled by DMA channels.

For audio purposes, FIR filters are the only solution - lots of multiplications will be then needed to achieve satisfactory quality with steep slopes of the filters. It all depends on the sampling rate you intend to choose and the filter shapes to achieve.

Best of luck.

Adam.

[ - ]
Reply by RogerGAugust 15, 2021

Thanks Adam,

It's very new to me so I have quite a lot of researching to do based on your info and the other replies.

Roger

[ - ]
Reply by dudelsoundAugust 15, 2021

Hi

any 32bit processor with 100MHz should be more than enough. On a STM32 Cortex M4 with 100MHz I implemented several filters, limiter, echo-cancelling and FIR filter and that works. Floating point helps with easier implementation and better results for the filters (less implementation dependant).

For biquad coefficient calculation google "Audio EQ cookbook".

A simple non-optimzed biquad in c would be:

float c[5] = {...};  // biquad coefs
float dI[2] = {0};   // input delays
float dO[2] = {0};   // output delays

void biquad(float *inout, int N)
{
 
  while (N--){
    float in = *inout;

    // calculate EQ
    float out = c[0] * in;
    out += c[1] * dI[0];
    out += c[2] * dI[1];
    out -= c[3] * dO[0];
    out -= c[4] * dO[1];

    // shift delays
    dI[1] = dI[0]; dI[0] = in;
    dO[1] = dO[0]; dO[0] = out;

    *inout++ = out;
  }

}

[ - ]
Reply by RogerGAugust 15, 2021

Thanks for the info 

Roger




[ - ]
Reply by Robert WolfeAugust 15, 2021

Hello,

If your only goal is to filter, unless it's at something like a 500 K sample rate, most anything will work.  I personally would go arm core with FPU and their pseudo-DSP (M4, M7, etc).  Seems to be a good price/performance point, relatively simple, floating point removes some of the fixed point hassle.  Most chips will come with development kit options - the associated schematics can be practically duplicated for any personal PCB or hardware layout/design.

Regards,

Robert


[ - ]
Reply by RogerGAugust 15, 2021

Thanks Robert

Roger