@@ -1103,15 +1115,93 @@ If you need to change the configuration of the filter, but need to maintain the
...
@@ -1103,15 +1115,93 @@ If you need to change the configuration of the filter, but need to maintain the
useful if you need to change the sample rate and/or cutoff frequency dynamically while maintaing smooth transitions. Note that changing the format or channel
useful if you need to change the sample rate and/or cutoff frequency dynamically while maintaing smooth transitions. Note that changing the format or channel
count after initialization is invalid and will result in an error.
count after initialization is invalid and will result in an error.
The example code above is for low-pass filters, but the same applies for high-pass and band-pass filters, only you should use the `ma_hpf` and `ma_bpf` APIs
The `ma_lpf` object supports a configurable number of poles, but if you only need a 1-pole filter you may want to consider using `ma_lpf1`. Likewise, if you
instead.
only need a 2-pole filter you can use `ma_lpf2`. The advantage of this is that they're lighter weight and a bit more efficient.
The `ma_lpf`, `ma_hpf` and `ma_bpf` objects support a configurable number of poles, but if you only need a 1-pole filter you may want to consider using
`ma_lpf1`, `ma_hpf1` and `ma_bpf1`. Likewise, if you only need a 2-pole filter you can use `ma_lpf2`, `ma_hpf2` and `ma_bpf2`. The advantage of this is that
they're lighter weight and a bit more efficient.
If an even number of poles are specified, a series of 2-pole filters will be processed in a chain. If an odd number of poles are specified, a series of 2-pole
If an even number of poles are specified, a series of 2-pole filters will be processed in a chain. If an odd number of poles are specified, a series of 2-pole
filters will be processed in a chain, followed by a final 1-pole filter. Note that the pole count for band-pass filters must be an even number.
filters will be processed in a chain, followed by a final 1-pole filter.
High-Pass Filtering
-------------------
High-pass filtering is achieved with the following APIs:
High-pass filters work exactly the same as low-pass filters, only the APIs are called `ma_hpf1`, `ma_hpf2` and `ma_hpf`. See example code for low-pass filters
for example usage.
Band-Pass Filtering
-------------------
Band-pass filtering is achieved with the following APIs:
Band-pass filters work exactly the same as low-pass filters, only the APIs are called `ma_bpf2` and `ma_hpf`. See example code for low-pass filters for example
usage. Note that the order for band-pass filters must be an even number which means there is no first order band-pass filter, unlike low-pass and high-pass
filters.
Notch Filtering
---------------
Notch filtering is achieved with the following APIs:
Where a high-pass filter is used to eliminate lower frequencies, a low shelf filter can be used to just turn them down rather than eliminate them entirely.
High Shelf Filtering
--------------------
High shelf filtering is achieved with the following APIs:
The high shelf filter has the same API as the low shelf filter, only you would use `ma_hishelf` instead of `ma_loshelf`. Where a low shelf filter is used to
adjust the volume of low frequencies, the high pass filter does the same thing for high frequencies.