# Mozzi library, weird noise with LowPassFilter

**URL:** <https://forum.arduino.cc/t/mozzi-library-weird-noise-with-lowpassfilter/938363>\
**Category:** Programming\
**Created:** [December 22, 2021, 8:24am UTC](https://forum.arduino.cc/t/mozzi-library-weird-noise-with-lowpassfilter/938363 "2021-12-22T08:24:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![johny05](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/johny05/32/715547_2.png) [@johny05](https://forum.arduino.cc/u/johny05)\
**Post date:** [December 22, 2021, 8:24am UTC](https://forum.arduino.cc/t/mozzi-library-weird-noise-with-lowpassfilter/938363/1 "2021-12-22T08:24:18Z")

</div>

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:

```cpp
#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:

> **[arduinoNoise.wav](https://drive.google.com/file/d/12HxKay-BBFJ0YnjYNzOfmLYmVEgqm9Pc/view?usp=sharing)**
>
> Google Drive file.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [June 20, 2022, 8:24am UTC](https://forum.arduino.cc/t/mozzi-library-weird-noise-with-lowpassfilter/938363/2 "2022-06-20T08:24:41Z")

</div>

Closed on June 20, 2022, 8:24am UTC

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