Ok so I know what “#define FILTER_CUTOFF_FREQUENCY” does, but why is it paired with “#define FILTER_ORDER” and what does it do?
What does changing it from the default of 8 accomplish?
Ok so I know what “#define FILTER_CUTOFF_FREQUENCY” does, but why is it paired with “#define FILTER_ORDER” and what does it do?
What does changing it from the default of 8 accomplish?
Short answer: FILTER_ORDER specifies how steep the frequency response curve is.
Long answer:
Wow, that’s alot. Unfortunately that Wiki entry isn’t very helpful for someone with my limited knowledge on the subject lol.
Can anyone break it down to an ELI5 level?
“Quick roll-off around the cutoff frequency, which improves with increasing order
Considerable overshoot and ringing in step response, which worsens with increasing order”
Does the default setting of 8 mean it’s an eighth order filter?
Yes.
A butteworth filter has a roll-off of -6dB per octave per order.
-6dB is half the volume.
So a first-order filter has a roll-off of -6db per octave. (half the volume)
A second-order filter has a roll-off of -12db per octave. (quarter the volume)
A third-order filter has a roll-off of -18db per octave. (eight of the volume)
…
An eight-order filter has a roll-off of -48db per octave. (1/256th of the volume)
Note that this roll-off is per octave. [1]
So if you set the cutoff frequency to 300Hz, and the filter order to 2, then a sound at 150Hz will have a quarter of the volume, while a sound at 75Hz will have one sixteenth of the volume.
The default is probably overkill, a fourth-order filter is probably good enough.
[1] For anybody who didn’t know: an octave means doubling or halving the frequency of the sound.
That’s a lot more my level, thank you very much.
Now that I sorta kinda understand the concept, my brain needs to fiddle around with it and see/hear it in action to fully grasp it’s application.
It’s the slope of a low pass filter.
The higher the order the steeper the slope?
correct… unless i’m totally wrong
@profezzorn
It just dawned on me that maybe we should have this be part of the font config.ini instead of a define in the config that’s globally setting this. A per-font basis makes more sense maybe, no?
No. Filter is done to remove sounds from the font that the speaker can’t play. The speaker doesn’t change when you switch font, so why would you want to change the filtering from font to font?
Any filtering that is part of the design of the font itself, should be incorporated into the actual wav files.
Finally, the filter coefficients are curerntly calculated at compile time, which makes the filter much more efficient, both in terms of cpu time and in terms of flash memory used. If it was a part of the config file it would have to be done dynamically. In some sense that would be easier since there is lots of code available that does that, but it would take up more space and take more cpu time.
Reviving an old thread again, but I’ve been experimenting with the butterworth filter and in case it’s useful to anyone, I’ve found that the following specs work well when using a KR 28mm bass speaker:
#define FILTER_CUTOFF_FREQUENCY 160
#define FILTER_ORDER 4
#define VOLUME 1900
#define BOOT_VOLUME 1400
The thinking behind it is that the default 100/8 is quite steep at quite a low frequency. I’ve struggled to find specific specs for 28mm speakers, but I did find that the old TCS WOW speakers were rated at 250Hz to 20kHz. Hence in theory, if they get high levels at, say, 150Hz (very possible with fonts made on decent audio hardware) that could still be out of range and cause vibrration/distortion issues.
Therefore I figured that setting the frequency slightly higher than default but the roll off less steep, would taper off those frequencies that the speaker can’t cope with more effectively. As the prof said in his explanatory post above, the roll off even at half the default values is pretty steep already, and my guess is those frequencies that do cause unwanted artefacts like vibration or distortion only need to be ducked to fix the problem.
On the hilt I have on the bench at the moment, I tried three identical speakers, all of which were distorting pretty badly with no filter at all, but the 160/4 combo above cured it with no noticeable loss of the bass that we do want. You could probably go a little higher on the frequency - maybe 200Hz, before you’d notice any significant change to the sound itself, but obviously once you’ve done enough, there’s no need to go further.
Just thought this might be useful for someone.
Which impedance speaker is it? 1900 seems low for the 8 ohm ones? I have mine set to 2800 and not blown one.
Sorry, yeh, I should have mentioned that - it’s for the 4 ohm version. 8 ohm speakers can indeed be driven harder, but I don’t have an installed one to test at the moment.
I would imagine the rest of the settings would match up?