Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve iir filters docs #221

Merged
merged 2 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/cxxdox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ groups:
string_io: "String conversion/printing values"
biquad: "Biquad filter and design functions"
fir: "FIR filter and design functions"
iir: "IIR filter and design functions"
window: "Window functions"
sample_rate_conversion: "Sample rate conversion"
oscillators: "Oscillator functions"
Expand Down
33 changes: 32 additions & 1 deletion include/kfr/dsp/iir_design.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @addtogroup biquad
/** @addtogroup iir
* @{
*/
/*
Expand Down Expand Up @@ -1030,6 +1030,13 @@ KFR_FUNCTION T warp_freq(T frequency, T fs)

} // namespace internal

/**
* @brief Calculates zero-pole-gain coefficients for the low-pass IIR filter
* @param filter Filter type: chebyshev1, chebyshev2, bessel, butterworth
* @param frequency Cutoff frequency (Hz)
* @param fs Sampling frequency (Hz)
* @return The resulting zpk filter
*/
template <typename T>
KFR_FUNCTION zpk<T> iir_lowpass(const zpk<T>& filter, identity<T> frequency, identity<T> fs = T(2.0))
{
Expand All @@ -1041,6 +1048,14 @@ KFR_FUNCTION zpk<T> iir_lowpass(const zpk<T>& filter, identity<T> frequency, ide
return result;
}


/**
* @brief Calculates zero-pole-gain coefficients for the high-pass IIR filter
* @param filter Filter type: chebyshev1, chebyshev2, bessel, butterworth
* @param frequency Cutoff frequency (Hz)
* @param fs Sampling frequency (Hz)
* @return The resulting zpk filter
*/
template <typename T>
KFR_FUNCTION zpk<T> iir_highpass(const zpk<T>& filter, identity<T> frequency, identity<T> fs = T(2.0))
{
Expand All @@ -1052,6 +1067,14 @@ KFR_FUNCTION zpk<T> iir_highpass(const zpk<T>& filter, identity<T> frequency, id
return result;
}

/**
* @brief Calculates zero-pole-gain coefficients for the band-pass IIR filter
* @param filter Filter type: chebyshev1, chebyshev2, bessel, butterworth
* @param lowfreq Low cutoff frequency (Hz)
* @param lowfreq High cutoff frequency (Hz)
* @param fs Sampling frequency (Hz)
* @return The resulting zpk filter
*/
template <typename T>
KFR_FUNCTION zpk<T> iir_bandpass(const zpk<T>& filter, identity<T> lowfreq, identity<T> highfreq,
identity<T> fs = T(2.0))
Expand All @@ -1065,6 +1088,14 @@ KFR_FUNCTION zpk<T> iir_bandpass(const zpk<T>& filter, identity<T> lowfreq, iden
return result;
}

/**
* @brief Calculates zero-pole-gain coefficients for the band-stop IIR filter
* @param filter Filter type: chebyshev1, chebyshev2, bessel, butterworth
* @param lowfreq Low cutoff frequency (Hz)
* @param lowfreq High cutoff frequency (Hz)
* @param fs Sampling frequency (Hz)
* @return The resulting zpk filter
*/
template <typename T>
KFR_FUNCTION zpk<T> iir_bandstop(const zpk<T>& filter, identity<T> lowfreq, identity<T> highfreq,
identity<T> fs = T(2.0))
Expand Down