Auto Spectral Compensation

With sage guidance from PA, I was able to concoct a patch that uses the FluCoMa tools and the Huddersfield Impulse Response Toolbox for automatic spectral compensation.

The material that I’ve been working with lately is full off fairly egregious high frequencies and I wanted a way of finding the bands which are problematic and attenuating them with a simple interface. Using fluid.bufmelbands~ to extract a set of frequencies and amplitudes, I produce an inverted impulse response that, in theory, represents a quasi a sonic negative-image. I then convolve the original sound with this signal using multiconvolve~ to get a real-time complex filter on the source audio.

Attached is the max patch as a maxzip/project.

http://boogiebox-nextcloud.cloud.seedboxes.cc/s/DfEtcjAbz2o9bNg

Again, thanks to @tremblap for seeding the idea and giving me expert advice

1 Like

Nice! And @rodrigo.constanzo -grade tidy patching too!

Is the idea of using mel bands, rather than just fft bins followed by more aggressive smoothing that the former will be more perceptual-y? How do the results you get here sound compared to what you’d do manually with an EQ?

I have editorial issues with ‘fairly egregious’ ;-p

1 Like

Yes, the idea is that the spacing of the mel bands better approximates and therefore creates an IR that that will be useful for removing the things we perceive (opposed to the FFT which is equally spaced). The smooething gives you an extra parameter to nudge the filter where it needs to go. Sometimes I want something more general without going into a territory where the bands are completely obliterated at -90db and so smoothing then backing off on the attenuation works to soften the high freq’s without affecting everything else as much.

I was expected this tool to be much worse than what I can do with an EQ manually but I’m pleasantly surprised. I’ve been using a pretty generic biquad in Reaper to get rid of the frequencies I can see being problematic but it takes ages and I have to work gesture by gesture. Doing it this way is a lot faster and I think it works well enough to replace something like a tilt filter, which I have been layering with the more acute biquads.

is it the oxymoronic nature of that statement or have you been exposed to worse high freq material?

P.S

I have made some extra changes that allow you to change the phase of the filter too! I just have to sort out some errors I’m being thrown by iruser~ before I push it.

Super interesting. Thanks for sharing.
One question: what does the normalize subpath do? Min and max are set to zero.

This is quite cool!

I really need to get back on that ‘spectral compensation’ kick from when we meet and geeked last. I’ve not look at it since posting it on the “secret” forum (where it died a quiet death!), but from what I remember, there was some weird funny business that appeared to be more of a bug than a feature.

The patching is indeed super tidy :slight_smile:

One tiny suggestion though, is you can implement @a.harker’s clever mousefilter subpatch from his Convolution Reverb patch:


----------begin_max5_patcher----------
3092.3oc2bs0iaaiE94Y9UHXjGcL3EQJo8sl1sYK1zlhNoHXQvBCZIZOJirn
gD8boEo+1WdQRVRVVVdhryzc.hCMud3GOmCOW3L+40WMYg3Qd9Dm+gymbt5p
+75qtxTkthqJ99USVydLLgka51jT9ChEedxTaSR9iRS0ab98MQLIurAwVYBW
JeZC2N4SlLU8Om+aQyaXxvaiSWMOiGJs8vMfLK.Ro9d.6OH2oNtX3LnW.vqr
Rf2TGh6LvTGDXFnZ9R2tNNUsfFZDVT4RQpLO9OLT.T06c80RclNiJpMNxrOT
6sWicmTaFRYqMyvjuKKlk37FQRzj56BdVAZU.WpQEmvummkGKRqQNWMgsYSs
pup1PzX7mElIxeZUUwo1pfUUkwuOtb7npZYYJrTp.xsYVJ8QZ4NPOMhHdV51
XyLYq7KWWRRlyU8NLeCKzNX8weYy6NcftDpA0QP8+gQlug8qcHn3bVkHBuia
PRPYkhM7z3zMY7bdpjIKn9pli3KYaSjyabXgl0Y6KKnwNar44T0VXUVbjHUS
DMNKzUWtbpcGQuazetayX5QJaSGCVwjn.lCzXtZStMeAKSeTsHg2nQoPjbfl
R3KkEMuINMsEJJEaNbiYwqtsmwtPnZbceysok74aSssNWwUHmmytuIZKYIIE
h+Mm9GYowqUB+xX6Q.BT0HOko1n2lGlIRRZressbeGsDo3xC4ODGIu0rP0YF
TcOdSISzjpS4n3U7bYy5jrU4MqIW9jEzqU01EERwyk70aRzpvZzgFJHqKxVW
QYi5aovTIakyVwqDHqq07dVxV9bk767+PrdQbiNsuFzJdyCnAE55aULRmgHS
cBPsUStupRTsF5VcYGpLg0ZolZyfIkU+kqutrvzyIp8UBWVcXPOy0I6eox4E
s7uTnEKTFeOORoSLTjHxbdEx4UXmW457JxnfeHOOCLhBtr.HlNo0r05FfQDe
aXzSS3MQAtyLHad+vox9mErzUCFVwAFoXOxwgU3yAVQcCqtWHbSYPf5lyHmH
dH6ouNFQ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xurEmrAzcaSPGNBbdUb7AwJs+
Lm3gBV4FsGzdghKFZ7wxsQ7j+FZE7uu9Hgg+BZn4GY2yWJxVOhNL7rsdDLiL
RaNclmecpN0xu1DRf91bUQs3Diw6AB1fakR.upHeWECbeyNcDBlF7HL5id3G
F8.o0L7CcnVIffJhoBQsEAE2hM1pH+bwau..JdnpiwT0qujgIbV1PCzNnG6E
IGgSbWRG1qv3EBrgQ6+sfGrUHv9tEIb0Ul1Dl7Fg3tIiFKWb5cmr2ppsIvu5
lVLEnzHcfvudBi4j6+dLu6xigo635kN90ACXIaGi3uJsyTKkV84HDM3guUtf
5tG4zYzg5491tihXxcVex9n9gP7s1XoDsoDG2D5NEbqt7mToWr7fuuXi.BbK
xZeP.12qnjm+nd6m8WQo2jrkW96y2.i+o9Ed3UjHxc6vf56qwj.yDOjdxT3Q
Q9QjB+9mXmNABPADa1h87vXj84NffJMpiOA91LN+YPgFzqxQcHUq8c7IteiG
cxjlWkJSXkkG.DlfNCBH+GdRh3g9IwVYbGMCPB..+9bb1GQro30yG5atGPMF
R0iBY72.n+NtALAN7shjmAKRkeCDkOYDa1zqea4nPfa1lso+.Tbv7h6UPL5W
5HQIaYT.nEwHG4tAW.Jv5YIfFXDBP9DJxeL2WY7Pd788Gy7t3IprJa2dBT+s
NMNDm03f2V8GMqAD3BpKkZCyfRIqWwqKSwsFf6EsuLbQ47zn7WZZmkrMGSiQ
MGldGSJbdm1RoIi15mK4K2ljHOZP.aF5.Wnx5DisIUFLqMWs8Cxp8aqxmPf1
H1PwdX66WjpXdoiKnZ2TxmUfMGp4jiAdfT9UQw1GwaISFFEfCFU8LR8uTLuj
dAfOn833oSMUUp0WCxFS1wEXqR4QQPrFzyjZXuRzVabL8nN8BCB.T+BEwtE4
ChB.XXy21WK44eHNS9jy+bk3YINaeL7G3uCfW+kq+eTYYg2I
-----------end_max5_patcher-----------

Right now your smoothing and attenuation dials choke when you adjust them cuz they are trying to compute-compute-compute-compute etc…

Oh, is there any reason why the attenuation doesn’t have negative values? (i.e. boosting the egregious frequencies)

The sub patch just takes a list of values and normalises them between 0 and 1. I init to 0. so it works with floats (I think)…

Yeah I wanted to make something like that with mousestate but I just dealt with the lag because I wasn’t changing it much. Let me chuck this in there and update so you can change the phase…

Also I like the fluid visualisation but it’s not really viable across many CPU’s

Okay, more updated version here:

https://boogiebox-nextcloud.cloud.seedboxes.cc/s/rZQFXxM6y7a8eBr

The only thing it doesn’t have now @rodrigo.constanzo is a booster - I can’t figure out how PA changed my normalisation in db’s but when I do I’ll add it.

2 Likes

This link is expired…

updated:

1 Like