# Filters

## Setting Cutoff Frequency

Q: When setting the frequency of a filter; for example, `svfilter.dsp` how do I convert from frequency in Hz to the value I need to set the filter?

A: According to Hal Chamberlain's "Musical Applications of MicroProcessors":

  `F1 = 2sin(PI*Frequency/SampleRate)`

where

- F1 is the frequency control parameter for the filter.
- Frequency is Frequency in Hertz
- SampleRate is 44100.0

If Frequency/SampleRate is small, for example less than 1/5, you can use an approximation, as follows:

  `F1 = 2*PI*Frequency/SampleRate`

To calculate a fixed point value suitable for `TweakRawKnob( ItemNumber, FKnob)`, if F1 is expressed as a 16.16 fixed point value (frac16), then:

  `FKnob = F1>>1;`

because FKnob is a 1.15 fixed point value.

## Modulating Selected Frequency Ranges

Q: Is there a way to amplify a specific range of frequencies during the play of an instrument? This is equivalent to the function of a graphic equalizer on a boom box. I am specifically interested in increasing the amplitude in the "bass" range.

A: Yes. You can use the `svfilter.dsp`. In addition to the Output, which is a lowpass filter, it also has BandPass and HighPass outputs. You can use the BandPass output or the LowPass, optionally mixed with original signal, to boost bass response.

Another approach is to use the EQ or filter effects in Sound Designer to boost the bass in the sample before you play it.