Mozzi library, weird noise with LowPassFilter

I am using the LowPassFilter.h and after a certain treshold the output is just noise. I tried it without the filter it's working without it.
After the mapping, if I go above 200 with the potmeter then i get noise.
Here is the code:

#include <MozziGuts.h>
#include <Oscil.h>
#include <LowPassFilter.h>
#include <tables/SQUARE_ANALOGUE512_int8.h>
#define CONTROL_RATE 64

Oscil <SQUARE_ANALOGUE512_NUM_CELLS, AUDIO_RATE> aSq(SQUARE_ANALOGUE512_DATA);
Oscil <SQUARE_ANALOGUE512_NUM_CELLS, AUDIO_RATE> aSq2(SQUARE_ANALOGUE512_DATA);

LowPassFilter lpf;

int potMeter1 = A3;
int potMeter2 = A2;
int resonance = 0;
int cutoff = 0;

void setup() {
  Serial.begin(9600);
  startMozzi(CONTROL_RATE); // :)
  aSq.setFreq(220);
  aSq.setFreq(110);
}

void updateControl(){
  cutoff = mozziAnalogRead(potMeter1);
  cutoff = map(cutoff,0,1023,0,255);

  resonance = mozziAnalogRead(potMeter2);
  resonance = map(resonance,0,1023,0,255);
  
  lpf.setCutoffFreq(cutoff);
  Serial.println(cutoff);
}

int updateAudio(){
  return lpf.next(aSq.next());
}

void loop() {
  audioHook();
}

Here's a link for the recording of the noise:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.