@@ -129,8 +129,8 @@ pipeline. Both formats use transposed direct form 2.
...
@@ -129,8 +129,8 @@ pipeline. Both formats use transposed direct form 2.
Low-Pass, High-Pass and Band-Pass Filters
Low-Pass, High-Pass and Band-Pass Filters
-----------------------------------------
-----------------------------------------
APIs for low-pass, high-pass and band-pass filtering has been added. By themselves they are second order filters, but can be extended to higher orders by
APIs for low-pass, high-pass and band-pass filtering has been added. By themselves they are second order filters, but can be extended to higher orders by
chaining them together. Low-pass, high-pass and band-pass filtering is achieved via the `ma_lpf2`, `ma_hpf2` and `ma_bpf` APIs respectively. Since these filters
chaining them together. Low-pass, high-pass and band-pass filtering is achieved via the `ma_lpf2`, `ma_hpf2` and `ma_bpf2` APIs respectively. Since these
are just biquad filters, they support both 32-bit floating point and 16-bit signed integer formats.
filters are just biquad filters, they support both 32-bit floating point and 16-bit signed integer formats.
Sine, Square, Triangle and Sawtooth Waveforms
Sine, Square, Triangle and Sawtooth Waveforms
...
@@ -1000,7 +1000,7 @@ and will result in an error.
...
@@ -1000,7 +1000,7 @@ and will result in an error.
Low-Pass, High-Pass and Band-Pass Filtering
Low-Pass, High-Pass and Band-Pass Filtering
===========================================
===========================================
Low-pass, high-pass and band-pass filtering is achieved with the `ma_lpf2`, `ma_hpf2` and `ma_bpf` APIs respective. Low-pass filter example:
Low-pass, high-pass and band-pass filtering is achieved with the `ma_lpf2`, `ma_hpf2` and `ma_bpf2` APIs respective. Low-pass filter example:
@@ -1035,7 +1035,7 @@ If you need to change the configuration of the filter, but need to maintain the
...
@@ -1035,7 +1035,7 @@ 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_hpf2` and `ma_bpf` APIs
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_hpf2` and `ma_bpf2` APIs
instead.
instead.
...
@@ -1728,19 +1728,19 @@ typedef struct
...
@@ -1728,19 +1728,19 @@ typedef struct
ma_uint32 channels;
ma_uint32 channels;
ma_uint32 sampleRate;
ma_uint32 sampleRate;
double cutoffFrequency;
double cutoffFrequency;
} ma_bpf_config;
} ma_bpf2_config;
ma_bpf_config ma_bpf_config_init(ma_format format, ma_uint32 channels, ma_uint32 sampleRate, double cutoffFrequency);
ma_bpf2_config ma_bpf2_config_init(ma_format format, ma_uint32 channels, ma_uint32 sampleRate, double cutoffFrequency);
typedef struct
typedef struct
{
{
ma_biquad bq; /* The 2-pole band-pass filter is implemented as a biquad filter. */
ma_biquad bq; /* The 2-pole band-pass filter is implemented as a biquad filter. */