# Spectral "Compensation"?

**URL:** <https://discourse.flucoma.org/t/spectral-compensation/299>\
**Category:** Usage Questions\
**Created:** [August 4, 2019, 12:53pm UTC](https://discourse.flucoma.org/t/spectral-compensation/299 "2019-08-04T12:53:30Z")\
**Posts on this page:** 1\
**Showing post:** 66

<div class="post-metadata">

**Author:** ![rodrigo.constanzo](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/rodrigo.constanzo/32/12_2.png) [@rodrigo.constanzo](https://discourse.flucoma.org/u/rodrigo.constanzo)\
**Post date:** [June 2, 2020, 12:35am UTC](https://discourse.flucoma.org/t/spectral-compensation/299/66 "2020-06-02T00:35:36Z")

</div>

Ok, a bit of a (short) breakthrough, followed by some sadness and disappointment.

After [inquiring over on the cycling forum](https://cycling74.com/forums/create-a-filter-quickly-with-list-of-frequencies-and-db) about a way to create filters quickly and on-the-fly and someone suggested (quite helpfully) to try out `fffb~`, and on the surface this seems like a perfect solution. In the patch, the way things work at the moment is that the `fluid.part~` of the patch generates a list of frequencies and decibels, and then the `hiss.part~` of the patch creates an IR from that.

So if I just convert the dB output from the analysis/stats part of the process into linear amplitude I should be able to feed that right into `fffb~` right!?..

 ![Screen Shot 2020-06-02 at 1.27.08 am](https://discourse.flucoma.org/uploads/default/original/1X/aee19568340239fa272dcf40a2c9f805debc0a48.png)

Well, when I did that, it didn’t sound right at all. Because I had things like this:

 ![Screen Shot 2020-06-01 at 10.27.03 pm](https://discourse.flucoma.org/uploads/default/original/1X/cf55bf0e702cfc4ce2e7cdb0cde54e87dfbbec8c.png)

Those dB values don’t correspond with the filter I’m seeing at all.

So after tracing the patch I realized that a part of the old patch that is pretty important is the `maxgain` message to `irstats~`. This takes the filter output from `fluid.bufmelbands~` → `fluid.bufstats~` and scales it so I have more-or-less unity gain from the resultant filter.

Bypassing `irstats~` ends up giving me filters that are waay too quiet for the most part.

I tried taking the normalization bit from @jamesbradbury’s [automatic spectral compensation patch](https://discourse.flucoma.org/t/auto-spectral-compensation/426/10) and that gives me better results, but I don’t know/think that’s the way to go about that.

Now, bypassing `hiss.stuff~` means I don’t have the smoothing and other nice bells and whistles of that approach, but I was hoping to at least be able to implement a rough EQ quickly, but I’m not sure how to go about approximating the `maxgain` of an EQ curve.

The helpfile for `irstats~` has this to say about `maxgain`:

> Estimated maximum gain within any octave of the IR in dB

Is there a specific formula for this, and is it possible to calculate it using a list of frequencies and gain settings?

Here’s an example of one of the curves:

> 221.833218 -33.454389 362.220601 -36.311383 523.987791 -38.297038 710.390753 -39.677351 925.181305 -41.060575 1172.682637 -43.307582 1457.876324 -45.938757 1786.50259 -42.903525 2165.17585 -45.6 2601.517837 -47.113147 3104.311008 -47.386607 3683.675316 -45.473278 4351.271895 -49.073143 5120.537773 -47.560681 6006.95632 -51.866266 7028.368896 -49.935765 8205.333946 -47.85 9561.540794 -50.37641 11124.286444 -48.3 12925.025005 -48.543471

Also, and I guess this is something I can try to test out, but if I’m using `fffb~` would I then need to specify the “outer” frequencies and give them a gain of 1 so the overall filter is shaped correctly? (as in 20 Hz @ 1.0 and 20k Hz @ 1.0, which it seems like `iruser~` is doing something along those lines)

---

_[View the full topic](https://discourse.flucoma.org/t/spectral-compensation/299)._
