Morp between filter types
I was wondering that is it possible to morph between filter types in realtime?
the most easy A->B solution was to run 2 filters in parallel and just mix these channels against each other.
Yap, but I would like to use 3 filter types…
okay, for three or more filters there are several options how you might want to morph. between all? or only linear, with or without a connection between the first and the last?
when you want morph between the actual parameters of [biquad~], you could use a lowpass instead of a hipass by setting its volume to 0. and inverting the gain input. but of course this is not the same, it gives a totally different transform.
What I want to get.
A dial from 0-127.
If the dial is on 0, you will get a LowShelf filter, with teh controls.
On 64 a PeakNotch.
On 127 a Highshelf.
For example, on 96 you will be ony halfway between a peaknotch and a highshelf filter…
What i got now :
3 filtergraphs, the are OK, with the 3 different filters.
Pak’d the coefs, send them to a 4th filtergraph, every filter is there.
I just have to "mix" somehow the 3 lists comes to the pak object…crossfade between the lists :(
But don’t know how…
I just woke up, with "fresh" mind.
What I need is a crossfader between 3 values…
For example, crossfader can make 0. 60., the values are 1, 2, 3.
0 = 1
15 = 1.5
30 = 2
45 = 2.5
60 = 3
Taked a look after the M4L abstractions, there is a crossfader between 2 inlets, just don’t know, how to add the third :(
Easiest way: use 3 function objects as lookup tables. Set the domains to 127 ms long, then draw the appropriate shapes for each. Send the 0-127 value in the inlet and you’ll get the interpolated y value out the left outlet.
Way easier than doing the math… (and if you need curves, switch function to curve mode!)
Thank you Peter. Could you post an example? Im not familiar with the mentiomed objects…:(
so you want to do what i called "linear".
i would still do this by parallel filters and mixing their outputs.
if you want to do it with 1 filter only it will be definitely more work.
Roman, with your idea my problem is still the same. I have to mix between the 3 filtered signals, but only with 1 knob :(
btw, the approach to peform a linear crossfade between the coefficients might give you some quite unexpected results.
Could you explain?
I’ve tried the crossfade between coeffs…
It is slow, slow, slow :(
Roman, could you tell me a bit more about your two ideas? (Paralell filtering and/or making it with 1 filter)
the problem is that the calculation for the coeffs is different for each filter type.
if you have a highpass at 50 Hz and a lowpass at 2500 Hz and you interpolate between the coefficent list, that wont sound much like a linear fade.
i think you would prefer to interpolate between frequency, reonance, gain, and filter type – where the "interpolation" between the type is something you have to build your own. at the same time this part, the morph between two types, can be replaced just fine by mixing two types.
biquad-highpass biquad-bandpass biquad-lowpass (all with the same frequency, gain, and q setting)
[*~ 0.] [*~ 0.] [*~ 0.]
then control the mixer with your crossfader (i failed to see your question about it)
it is for 3 sources basically nothing more than 2 for 2 sources.
for 2 sources:
| [* -1.]
| [+ 1.]
[* 0.] [* 0.] (into right inlets, left inlets are for the 2 filter ouputs)
for 3 sources:
[if ($f1<1.) then $f1 else out2 $f1 ] (or use the [split] object)
| [- 1.]
| [+ 1.], | [+ 1.]
| || | (2nd and 3rd both go into the middle [* 0.])
[* 0.] [* 0.] [* 0.]
you will find that the values of the outer ones will hang a bit when moving the knob faster.
but i think it is bad enough to read it like this from the forums. ;)
I see, thank you for the help.
What about this Morhp Device :
It seems he managed somehow the morphing…I just can’t fogired out how, cause the patch is a bit messy…
There is also a way to let a pattrstorage do the interpolation. Store just the 5 filter coefficients and let pattrstorage do the magic…
The result might be different than expected. If so take Romans advice and simply cross fade multiple filters…
or do it all by hand:
----------begin_max5_patcher---------- 1369.3oc6Z0rbihCD9r8SAEm8PQqVRH1ayKwdYpToH1LIjwFbA3LY2ol8Yek DfGmD+SmZwxJi2CwQHDnO95eT2szOlNI7tpmyaBC9ifuDLYxOlNYhsKSGS5u dR3prmmuLqwNrvx7uWc2igy5tUa9ys1tWVks3trx6GtQ4lUUaZWl2ZeJnu2t tZ+q04cSYn8QBto+1qyZm+PQ482VmOusaDIxn3YALQjXVfDrsiih29DEKryt FQehOL0esprsLakcJB+y75EYkY6dulh+1dOv751h1hxsf0z2OmN07yr+arxc AvXSH7zNRn6epixHwWRJ4qEKayquuNa8C+y9IgjCQBKKZZCmoeEZspS0XXrE ksGk2.Mio0g3PRmBkUuBLD39nNLMb6qpVSb5ujayKytaoEh6kiTCc18g+Bwb SdaWucXQOylIeVeCtTFo.Pn35KiD7D.AaqXFJDlVwG7mfaFOs0l4YKyCfn.V z6Tq8nLuJkaXdDrTtRZt3PprHNVprR+mWhsVuz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v8K33t7nwjwv4zHhGoe47F8rE2Ptes3Oh9U vQjR9.cWtY.Ymyn+j7AJbKdPJtmQ+I4Czg0UTRUel6N7PRe1g3gj9rCwCI8Y GhGR5ybuIRdP99xERllX2HlztM6dmqNGYFonXPl5tsnkz99w7pcZ6UX9RWaT GBG7bBmtiBQ150OkW2z+NsHIbU1iU1Chgb1ztite2k1CqQXc9SECiGs8jUO+ gh174sap6NpYOqjgSMyyOm9u.bXWPA. -----------end_max5_patcher-----------
Now thats what I was talin about1
Thank you very much!
Could you explain me (sorry I wont be rude or something like this…)
So there are 3 filter types. The coef lists go into the unjoin object, but what happends then?
Glad you checked out my Morph Filter Device, sorry about the messy code. Was quite a quick build and haven’t had time to clean up or comment it yet.
I achieved the filter morphing by using several [filtercoeff~] and one [biquad~] for the actual filtering.
I wanted to morph between five filters so made 5 [filtercoeff~] objects each with controls to change the cutoff, gain, resonance and filtertype.
The [filtercoeff~] object generates 5 signal outputs which are the 5 signal inputs for [biquad~].
I used 5 [scale~] objects, one for each of [biquad~]‘s inputs, to scale between the signal outputs of [filtercoeff~].
I was hoping doing it all at signal rate would make it sound quite smooth and fast. I have another version of the device with built in LFOs. The signal rate LFOs output can go straight into the [scale~] objects which sounds pretty awesome, heh.
I saw your patch, nice, a bit messy, but technically nice.
Got the coeffs and the biwuad, just can’t understand the scale method…
Your patch is just amazing. Now I’ve created 2 diff. morphing filters (both have 3 types).
…so just would like to morph between the 2 new filters :D
Folloew the patch, but after 0.1 ("Morph parameter"), there is a big jump between the filters.
I think it is because is used the same method for this 2…
sorry, just had a look at the patch again, looks like i did something more complex than i thought. i used more [scale~] objects, one [scale~] for each pair of [filtercoeff~] you want to morph between, and 5 [selector~] objects, one for each coefficient input of [biquad~]. the [selector~] objects make sure only one signal from each set of [scale~] objects is going through to [biquad~] at a time. so only two filter shapes are morphing between each other, even though there’s five [filtercoeff~].
it’s been a long day and i’m struggling to describe it, heh. i’ll try and cut out a small part of the patch to show it working between just two filters, but it does sound like the Morph Filter does what you’re after.
ah well looking at Stefan’s patch it uses exactly the same method as i did, except i did it all with signal rate objects.
Stefan’s patch describes the principal perfectly. If you have 3 different filters to morph between you create 3 objects which design the filter coeffs, so [filtergraph~] or [filtercoeff~]. you then create a set of 5 scaling objects, one scale for each coeff, for each filter morph. so for 3 filters you need 2 sets of 5 scale objects. one set of 5 scales for the morph between the first two filters, and another set of 5 scales for the morph between the second and third filter. my Morph Filter has 5 filters so i needed 4 sets of 5 scaling objects.
you then run the outputs of the scaling objects into a selector or join.
Well, the filtergraph is just a sophisticated way to calculate the five parameters for biquad. Look at the help file for biquad an maybe some literature about digital filters. All you have to interpolate are the biquad values. The filtergraph can also display the resulting frequency shape if its in display mode…
The filter types do not exist for biquad, they only help you to calculate the parameters within filtergraph…
The unjoin will simply cut up the list from filter graph into five floats. These floats then are interpolated with scale (five for each range (0.-1. & 1.-2.)… One could also try to achive this with a vexpr…
hope that helps…
And here is the vexpr version:
----------begin_max5_patcher---------- 955.3oc6XtsbaBCDF9Z6mBFlbQOPXXk.AtW09RzaxjwirAGqTLv.xNtMS5yd 0Avw1ASjSsIocxMbPRf902tZ0Jc+vA1SxWmTYa8EqqrFL39gCFnJRVvf52GX uftdZJsR0L6rj6xmbqsitJdxZtp3UIqKJs9vEyfKgO9Iwc7kWLC8QqOaItY8 0pozTZ4h73DKn4ayVtHeIOMgq9wPco5h3+rHQqJaaqqqqpfxmNmkcy3xjobc snnPWOGKLDIugHD0MOWuMeDKVoOgluLpommkmwynKT8f82SJioYzsqqh8KUc .H9caDKKqQqXYYOLbn7higbaFKkmTdSIsX9uam.gGh.orJtsi3WjlSetGZZK Ki2I3vdJtQvJfEn3FfhZGbg1a9QkBrIFGiSxnSRUBrUBE0TndXuiEtJgqKUq DQGK6am5G7E1vH.Bh7Eu5F3GBXP8jGBGDHex6fWrt9EXX5zgV3O2eNy01jZe Ye+t7kIul9xG.YBev3IzraNRln9jt3BIxUX3wX4UBzEU7OUTANcTYxQ6j7r. Q6nf.cztnNIh2qIRDgkD+i1G9HmMe.agnQxh1zyOgIaBvYJbzSeB75BNHjIv oqfdFAtlAJKqYfJzyKflTNubIqamIYaTMNIlwGKiQY+hhEQh7dbRW85CHncL BPqX7akLZZSMo4S+w15TN8X7crX9b0xEX2VIJ9z4J1mvyGNB348N71AdfOxb 3g9G.d6ttvJZ4FcpSC5J35mrnQUQJiKBSXAtcG87vAJ0OXPjxH8Rpgcl6bv6 4NuerQxHSxcFelycFsUty.JvE4MxSl6L3h7InPwSpoSm7zleiYSpC4ZlMAcl sIvt1DrK1Ci8kgybCAB3QjXOB4gQj++sL0wyMyx.mYKSvVVFjHVmeDBgG4XE 5JrOggX47FXD1GEcDFF0.Qvir8OIEEMjkuq0pJeY4zFjWevDVOhi3jJNKixY 4Ya0lvcZybVbbR11PIlUI4jBksmboopAafZjJF0KpAYnZfdQMA6zSGVM8ikB LfMjdiMHCUS+32PdSMmJvP171YFt7fC5TNKXwE4hf+0w7Hip2psJ.OdjJ6c4 KO1O8pm1wpeeT+oe3LneH.0a5eOs09..g5M+YjINDA8WXYSru39SNFYs5O4X hwB5M43eBTydSECUmHKwyMTltoddo5sywTwSfssK4WGV70T93+B4WupjYxWm GOsnXkXeD0ZPobw9qtMWsIBhyP8I4peUsQC6xjUrl1iUkPKE6BhK1BzxR8Ak rNhXOT1OOL7O1O2uAB -----------end_max5_patcher-----------
A further extension to Stefans biquad coef interpolation, using nodes with normalised weightings:
----------begin_max5_patcher---------- 1304.3oc4Z80biZCD+Y6OETl6odoTzp+fnO09knuz4lLXabBWrAOf7cN2MW+ rWoU.g3AGKGiwtsSl3fjgU69a+ocWsjuOch+rhcoU9d+l2e4MYx2mNYBNkYh I0im3uNY27UIU3s4mm90hYe1+N6WoR2ovoUdy7V0L6xhbUU12RMeCILHrd5M koUo4pDUVQ98koyU10UDEouEOZTr4Og0e38o5mJe65hspUoJb8gFYknl+XV9 CckifDDwMBBP4AA5ADYGQYki54Mo1mveVR9C924462dKYKPyQah+Bi20dxSV iO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O.9v FW7wI9CLN7Gm7WhQCeLsJ9Vh+3T7v8T5qu9PFM8I1E0gOtvyw1dQFO8gLDrm 0YK1TnKToNktDaDNkFg0GA1tiaF8x5LbgOGB11d5ODSsF.10FQDI.30Cu.Vf 4E64lKXjRXScIA.YzzGhSATni2NX5qx88FEfNR9qgnd381Avhis+u9fG8TRD sitDagcICOgOZ.J3RLQfcSkACFuDpNUO1oQ2vWRjlzgut4ZtGN5Bv1bQ8gyP 8qSdbMUexYn91b2WJsm.Cf5OfpS3.PFFP0gL.asNj5Xa7RxlMeIsrpVjnl3u N4yEXeeD2gCyxsCwdC4Wl9krl6Ge619IkyeLSkNWssz1F6cRg+Ty57io+CvN dMvF -----------end_max5_patcher-----------
edit- works better with trigger objects now connected properly
Wow, tahnk you so much guys, now everything is clear. :D
Will try to morph between some gen filters :D:D:D
Can I contact you outside of the forum?
(It seems PMs aren’t working these days…)