Filters? Modulation algos?

Programming applications for making music on Linux.

Moderators: MattKingUSA, khz

Post Reply
Markku
Established Member
Posts: 16
Joined: Fri Nov 11, 2016 12:51 pm

Filters? Modulation algos?

Post by Markku »

I'm programming a very poor synth for my own purposes. It has already working oscillator code, saw, sine, triangle and square waves at different frequencies work (says Audacity... :D ). Also 24-bit wav output works.

Now, does anyone have good resource for filters? I have a resonant low pass filter, but it's not very impressive. Possibly my implementation is deficient.

Any sensible FX effects would be of interest too.

Good docs or C sources would be ideal...

Another question, are there good sources or documents how oscillators modulate each other? My system can create oscillators dynamically, which could give interesting possibilities. Adding (mixing) them is quite easy, but are there good explanations how, for example, FM modulation works between oscillators? Or other modulation methods.

I don't want to use any audio libraries. I currently have no dependencies except standard libs. I would very much like to keep it that way.

This is mostly for learning purposes. I do not expect to get very far with this project. However, making something like couple saws detuned and put through something like Moog filter would be awesome.

Also. any ideas for good new waveforms for oscillators? My oscillator code has a wavetable, so I can have some exotic waveforms. Maybe I can import some free wavetables, but mostly I'd like to design them myself.
tramp
Established Member
Posts: 2335
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 454 times

Re: Filters? Modulation algos?

Post by tramp »

You may have a look in faust,
https://sourceforge.net/projects/faudiostream/

it comes with extended library's for fx, filter and osc. You could generate easily self contained dsp classes which you could embed into your project. It's a lot of fun working with faust.
When you are a bit confirm with the math of filters and effects, the faust language comes real handy, and good results comes quick.
As a hint, it include the faust source for a moog filter as well as it allow/ make easy/ the generation and use of wave tables, etc.

here is a nice tutorial for digital filters:
https://ccrma.stanford.edu/~jos/filters/
On the road again.
Markku
Established Member
Posts: 16
Joined: Fri Nov 11, 2016 12:51 pm

Re: Filters? Modulation algos?

Post by Markku »

Thanks! Faust seems to be quite complex. I have to dig in deeper to see what I can learn.

Another thing, I found some Java(!) synth code which seems to have modulation between oscillators.

Yet another thing, there seems to be some implementations of Moog filter which are *very* complex and hotly debated for and against by expert developers -- maybe I should focus on something simpler first. :D
User avatar
sadko4u
Established Member
Posts: 986
Joined: Mon Sep 28, 2015 9:03 pm
Has thanked: 2 times
Been thanked: 359 times

Re: Filters? Modulation algos?

Post by sadko4u »

I've implemented digital filters in my plugin bundles, but the DSP code is currently closed (collecting donations).
After some SSE/AVX optimizations the processing became TIMES faster than native C implementation.
Mostly you need is to learn how to calculate biquad filter parameters and join them into cascaded chains for infinite-response digital filters.
Also you can build finite-response digital filters by using direct/reverse FFT.

Here's also project of digital filters from Robin Gareus that you can study:
https://github.com/x42/fil4.lv2
LSP (Linux Studio Plugins) Developer and Maintainer.
CrocoDuck
Established Member
Posts: 1133
Joined: Sat May 05, 2012 6:12 pm
Been thanked: 17 times

Re: Filters? Modulation algos?

Post by CrocoDuck »

sadko4u wrote: Mostly you need is to learn how to calculate biquad filter parameters and join them into cascaded chains for infinite-response digital filters.
That's interesting. I would like to investigate deeper how to design a parallel or series second order section given a target arbitrary response (magnitude and phase). Do you know any good reference I could look at?
ssj71
Established Member
Posts: 1294
Joined: Tue Sep 25, 2012 6:36 pm
Has thanked: 1 time

Re: Filters? Modulation algos?

Post by ssj71 »

filters? here's some stuff to look at:
THE book:
https://www.native-instruments.com/file ... _1.1.1.pdf
some source examples:
zyn (there's also a SV and formant filter cpp in that DSP folder):
https://github.com/zynaddsubfx/zynaddsu ... Filter.cpp

fons' moog implementation (mvclpf24):
http://kokkinizita.linuxaudio.org/linux ... .0.tar.bz2

there are lots of other examples, but I think those are some of the best. (I'd love to hear other's examples of even better open source filters if there are some).
_ssj71

music: https://soundcloud.com/ssj71
My plugins are Infamous! http://ssj71.github.io/infamousPlugins
I just want to get back to making music!
tramp
Established Member
Posts: 2335
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 454 times

Re: Filters? Modulation algos?

Post by tramp »

CrocoDuck wrote: I would like to investigate deeper how to design a parallel or series second order section given a target arbitrary response (magnitude and phase)
The Audio-EQ-Cookbook
http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt
On the road again.
CrocoDuck
Established Member
Posts: 1133
Joined: Sat May 05, 2012 6:12 pm
Been thanked: 17 times

Re: Filters? Modulation algos?

Post by CrocoDuck »

Cool! Thank you guys!
User avatar
sadko4u
Established Member
Posts: 986
Joined: Mon Sep 28, 2015 9:03 pm
Has thanked: 2 times
Been thanked: 359 times

Re: Filters? Modulation algos?

Post by sadko4u »

ssj71 wrote:filters? here's some stuff to look at:
THE book:
https://www.native-instruments.com/file ... _1.1.1.pdf
some source examples:
Good link with not so many 'Crazy' math.

Also I found that direct form II is more accurate in calculations and allows to achieve more calculation performance rather than direct form I.
https://en.wikipedia.org/wiki/Digital_biquad_filter

When I've switched from DFT I to DFT II, the overall performance became twice greater.
But just direct form II was not enough for equalizer with 32 filters that may contain up to 32 biquad cascades each. So to get more performance I've pipelined filters (don't know if it's right idea to call them polyphase filters in this case), so at each iteration I've processed first 2, then 4, then 8 samples per loop cycle via 2x, 4x, 8x filter cascade.
The overall performance was about 4x times faster on native C implementation with 4x cascade but had performance penalty on 8x. So native implementation is to apply two 4x processings instead of one 8x.
By applying SSE assembly code, I've got about 3x additional performance enhancement.
LSP (Linux Studio Plugins) Developer and Maintainer.
Markku
Established Member
Posts: 16
Joined: Fri Nov 11, 2016 12:51 pm

Re: Filters? Modulation algos?

Post by Markku »

Thanks, all, I try to understand and learn from all this stuff.

Time will tell what I can accomplish. Thank you!
Post Reply