[sdiy] FIR or IIR Digital filters for the PIC

Veronica Merryfield veronica.merryfield at shaw.ca
Fri Jun 6 00:33:27 CEST 2008


I have used IIR filters going back 20 years now even on a poor 6Mhz  
Z80 and they do resonate. FIRs don't resonate but IIRs do - it's why  
they are called Infinite Impulse Response . I can some code somewhere  
in my archive for taking cutoff frequency and resonance and producing  
the parameters which I can try to find if required but there are  
examples on the web. It would need to be moulded to use in a pic. For  
the actual IIR stage, you need as efficient a MAC (Multiply and  
ACcumulate) as you can get and a short delay line. You also need a  
reasonable number of bits. I have implemented IIRs and FIRs in 16 bit  
but you have to pay a lot of attention to numbers. 32 bit would be  
better. You can use floating or fixed point numbers and I have done  
both.

TI use to have a superb resource of IIR and FIR filters to go with  
their TMS320 range of DSPs and somewhere I have a hefty book on the  
subject. There is also some work on correlations, convolutions and FFT/ 
DFT. Would be worth poking round their site for details. They also  
have much of their training seminars online too.

On 5-Jun-08, at 8:15 AM, Scott Gravenhorst wrote:

> Csaba Zvekan <czvekan at gmail.com> wrote:
>> Hi group,
>>
>> Has anybody done some work on FIR and IIR digital filters with the  
>> PIC
>> or dsPIC family that can be used for SDIY ?
>> I would look at some codes and designs .
>
> Not for a PIC, but for DSP inside an FPGA.
>
> I tried to use a single stage IIR filter as the main filter in the  
> GateMan-I synth.
> While it works, it is sonically underwhelming.  It is, however, very  
> easy to tune.
> This filter does not have what we call a corner frequency, at least  
> not in the same
> way we describe analog filters like SVF or ladder.  It also doesn't  
> have resonance.
> The single stage IIR leaves the corner frequency at zero Hz and the  
> tuning parameter
> changes the rolloff slope.  Sonically, it's more like a simple tone  
> control than what
> we like to use as an audio filter in music.
>
> Two places I found this IIR filter very useful and appropriate are  
> the reflection
> filter in PolyDaWG/8, a Karplus-Strong tight string synth and as the  
> main processing
> element to implement portamento in all 3 of the GateMan synths.
>
> The reason I mention a single stage IIR is that it's simplicity will  
> be attractive to
> someone using a device like a PIC, but I warn that it is not a good  
> choice for a
> filter used as we often do in modular type synths.
>
> An FIR can be quite simple too, but is not so easily tuned, fixed  
> filters are fairly
> easy to implement.
>
> AVRsynth (google it) is probably a good place to look at digital  
> filter code for
> microprocessors, I don't know what type of filter is used in that  
> synth however.
>
> My favorite digital filter so far is the State Variable Filter.   
> While it sounds
> great (IMO), it does have some rather intense computational and  
> sample rate
> requirements.  I found it fairly simple to implement and it tunes  
> quite easily.
>
> I'd give references to my Verilog code, but it isn't that easy to  
> transmute into
> microprocessor type instructions.
>
> If you are interesed, here are links to the projects I've published:
>
> - http://www.fpga.synth.net/pmwiki/pmwiki.php?n=FPGASynth.GateManI
> - http://www.fpga.synth.net/pmwiki/pmwiki.php?n=FPGASynth.GateManII
> - http://www.fpga.synth.net/pmwiki/pmwiki.php?n=FPGASynth.DigitalWaveguide
> - http://www.fpga.synth.net/pmwiki/pmwiki.php?n=FPGASynth.GateManPoly
>
> These projects are all implemented on a Xilinx Spartan-3E Starter  
> Kit (a development
> board) with very minimal external hardware (the schematics for the  
> external hardware
> are posted with the projects and is the same hardware for all of  
> them).
>
> -- ScottG
>
> -----------------------------------------------------------------
>
> -- Scott Gravenhorst
> -- GateManPoly - FPGA Based Polyphonic MIDI LA/FM Synthesizer
> -- GateMan-III - FPGA Based Monophonic MIDI LA/FM Synthesizer
> -- PolyDaWG/8 - FPGA Based 8 Voice Polyphonic MIDI Synthesizer
> -- FatMan: home1.gte.net/res0658s/fatman/
> -- NonFatMan: home1.gte.net/res0658s/electronics/
> -- When the going gets tough, the tough use the command line.
>
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at dropmix.xs4all.nl
> http://dropmix.xs4all.nl/mailman/listinfo/synth-diy




More information about the Synth-diy mailing list