瀏覽代碼

Document FIR filter requirements, fixes #114

dds
PaulStoffregen 8 年之前
父節點
當前提交
29b4ded50d
共有 3 個檔案被更改,包括 18 行新增3 行删除
  1. +1
    -1
      examples/Effects/Filter_FIR/Filter_FIR.ino
  2. +5
    -2
      filter_fir.h
  3. +12
    -0
      gui/index.html

+ 1
- 1
examples/Effects/Filter_FIR/Filter_FIR.ino 查看文件

@@ -62,7 +62,7 @@ AudioControlSGTL5000 audioShield;

struct fir_filter {
short *coeffs;
short num_coeffs;
short num_coeffs; // num_coeffs must be an even number, 4 or higher
};

// index of current filter. Start with the low pass.

+ 5
- 2
filter_fir.h 查看文件

@@ -41,8 +41,11 @@ public:
coeff_p = cp;
// Initialize FIR instance (ARM DSP Math Library)
if (coeff_p && (coeff_p != FIR_PASSTHRU) && n_coeffs <= FIR_MAX_COEFFS) {
arm_fir_init_q15(&fir_inst, n_coeffs, (q15_t *)coeff_p,
&StateQ15[0], AUDIO_BLOCK_SAMPLES);
if (arm_fir_init_q15(&fir_inst, n_coeffs, (q15_t *)coeff_p,
&StateQ15[0], AUDIO_BLOCK_SAMPLES) != ARM_MATH_SUCCESS) {
// n_coeffs must be an even number, 4 or larger
coeff_p = NULL;
}
}
}
void end(void) {

+ 12
- 0
gui/index.html 查看文件

@@ -2218,6 +2218,18 @@ double s_freq = .0625;</p>
<h3>Examples</h3>
<p class=exam>File &gt; Examples &gt; Audio &gt; Effects &gt; Filter_FIR
</p>
<h3>Known Issues</h3>
<p>Your filter's impulse response array must have an even length. If you have
add odd number of taps, you must add an extra zero to increase the length
to an even number.
</p>
<p>The minimum number of taps is 4. If you use less, add extra zeros to increase
the length to 4.
</p>
<p>The impulse response must be given in reverse order. Many filters have
symetrical impluse response, making this a non-issue. If your filter has
a non-symetrical response, make sure the data is in reverse time order.
</p>
<h3>Notes</h3>
<p>FIR filters requires more CPU time than Biquad (IIR), but they can
implement filters with better phase response.

Loading…
取消
儲存