--
You received this message because you are subscribed to the Google Groups "Mozzi-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mozzi-users...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/mozzi-users/ee9f451e-a312-4263-bbfc-7bbb0e956dc1n%40googlegroups.com.
Hi All,
I would like to use a low-pass filter with LowPassFilter.h.
However, when the cutOffFreq is around 180, the sound suddenly stops or becomes distorted as if it's broken.
Is there something wrong with my settings?
Here is my code:
cpp
#include <Mozzi.h>
#include <Oscil.h>
#include <EventDelay.h>
#include <tables/saw2048_int8.h>
#include <LowPassFilter.h>
#define MOZZI_CONTROL_RATE 64
Oscil<SAW2048_NUM_CELLS, MOZZI_AUDIO_RATE> aSaw(SAW2048_DATA);
LowPassFilter lpf;
EventDelay toggle;
bool noteOn = true; // Note on/off flag
const int analogPin1 = A0;
int freq = 55*2;
int8_t cutOffFreq = 180;
void setup(){
startMozzi();
aSaw.setFreq(freq);
lpf.setCutoffFreq(cutOffFreq);
toggle.start(50); // Wait time
}
void updateControl(){
int potValue = mozziAnalogRead(analogPin1);
//cutOffFreq = map(potValue, 0, 1023, 0, 254);
//lpf.setCutoffFreq(cutOffFreq);
if (toggle.ready()){
noteOn = !noteOn; // Toggle note on/off
toggle.start(50); // Wait
}
if (noteOn){
aSaw.setFreq(freq); // Set frequency
} else {
aSaw.setFreq(0); // Stop
}
}
AudioOutput updateAudio(){
int audioSignal = aSaw.next();
audioSignal = lpf.next(audioSignal);
return MonoOutput::from8Bit(audioSignal);
}
void loop(){
audioHook();
}
In the future, I plan to use a potentiometer, but for now that part is commented out.