You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.0KB

  1. //-----------------------------------------------------------
  2. // Huovilainen New Moog (HNM) model as per CMJ jun 2006
  3. // Implemented as Teensy Audio Library compatible object
  4. // Richard van Hoesel, Feb. 9 2021
  5. // v.1.01 now includes FC "CV" modulation input
  6. // please retain this header if you use this code.
  7. //-----------------------------------------------------------
  8. // https://forum.pjrc.com/threads/60488?p=269609&viewfull=1#post269609
  9. #ifndef filter_ladder_h_
  10. #define filter_ladder_h_
  11. #include "Arduino.h"
  12. #include "AudioStream.h"
  13. class AudioFilterLadder: public AudioStream
  14. {
  15. public:
  16. AudioFilterLadder() : AudioStream(2, inputQueueArray) {};
  17. void frequency(float FC);
  18. void resonance(float reson);
  19. virtual void update(void);
  20. private:
  21. float LPF(float s, int i);
  22. void compute_coeffs(float fc);
  23. float alpha = 1.0;
  24. float beta[4] = {0.0, 0.0, 0.0, 0.0};
  25. float z0[4] = {0.0, 0.0, 0.0, 0.0};
  26. float z1[4] = {0.0, 0.0, 0.0, 0.0};
  27. float K = 1.0;
  28. float Fbase = 1000;
  29. float overdrive = 1.0;
  30. audio_block_t *inputQueueArray[2];
  31. };
  32. #endif