Просмотр исходного кода

Document FIR filter requirements, fixes #114

dds
PaulStoffregen 8 лет назад
Родитель
Сommit
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.

Загрузка…
Отмена
Сохранить