Saturday, October 07, 2023

10-Band EQ Programming

Today has been a hard slog of programming a 10-band equaliser. I started by thinking that I had most of it done. My ages-old code seemed to work, but I wanted it to be its best, so decided to take to time to test and check. The whole testing process is very slow, comparing with test waves and trying lots of options and comparisons.

In the end, it's now nearly 5pm and I'm far from completion, having spent an exhausting day exploring dead ends.

The first used a bank of 10 band-pass filters. This seemed to be working. Here's some white noise with -infinity cuts at 3600hz and 15khz:

See what I mean, it looks, on the face of it, ok, and compares reasonably with my Sony plug-in. But my sounds seemed oddly louder than they started, which for cuts should never happen. I also wanted more than a dip at the ends, more of a round-off, so spent some time programming high-pass and low-pass filters, but the results didn't seem to do much, so in the afternoon I restored the band-pass array.

Then I realised the problem; that I couldn't apply the filters in parallel. Each filter would mess up the signal, interfering with the other filters in progress. So, I applied them serially. Here are 3 dips on my spectrum for 3-bands:

Pretty though that is, those dips are hardly useable for a music EQ. I don't want sharp cuts like that, more of a smooth contour... so I experimented with bandwidths and added some intermediate filters:

Note that some frequencies in the middle are toyed with here, which is why it has a lumpy shape. The top end does slope down more, but it has the look of trying to squash a rubber balloon into a small box. The band-pass filters were not working, so I had to go back to basics.

My earlier idea was a bank of low and high pass filters, to make a series of bar-like regions, but then realised that I only need an array of either low or high pass filters, applied in climbing frequencies. This discovery is probably obvious to existing DSP programmers. Such discoveries remind of my mother who once said 'What if stars were like suns but really far away?' - an epiphany of genius if made one or two thousand years ago.

One hard part is to calculate the gains. When running from low to high, the lowest frequency is processed many times. The arrangement is like the 'Twelve Days Of Christmas' song. The partridge gets repeated attention, so we need to calculate everything so that all 'gifts' are measured correctly at the end of the 'Twelve Days'.

More experiments needed. I had hoped to have it all done today. It may take a week I can ill afford.

Do I need this? At the moment I use an external Sony EQ plug-in (a very rare example of me doing so), and only when mastering, that brief time at the end of a project. It works well, but it would be better if I had a Wet control, to slightly reduce the effect if needed. It would also suit me if it came earlier in my signal chain, before my Cathedral Limiter. It would be better to program my own. It's certainly good mental training.