trying to use the Low Pass Filter Class #1502
-
Hello I feel a bit dumb but I wanted to ask if I am declaring the low pass filter properly. all I get are errors FilteredStream<int16_t, float> filt_stream(sqr_stream, info.channels); // Defiles the filter as BaseConverter setup "audio_tools::LowPassFilter::LowPassFilter(float frequency, float sampleRate, float q = (0.7071F)) [with T=float]" (declared at line 319 of "/Users/cricketbee/Documents/PlatformIO/Projects/Billy Club/ESP32 CODE/ESP32-S3_TFT-TOUCH-DAC-ENCODER/lib/arduino-audio-tools/src/AudioFilter/Filter.h") is inaccessible |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments
-
I think there is something wrong with the version that you currently have in PlatformIO. I suggest to delete the .pio folder to trigger a reload of the actual version. ps. I was just double checking the code and indeed there was an error in my code on line 319! Strange that Arduino did not complain. |
Beta Was this translation helpful? Give feedback.
-
I got the filter working with intitial cutoff , SR and Q Values but unlike other classes I do not see any methods like SetCutoff, SetQ in order to change the values in real time (say via a pot) I wanted to do something like this but for Cutoff and Q // Sets the volume control from a linear potentiometer input |
Beta Was this translation helpful? Give feedback.
-
I am not sure what you are referring to. AudioInfo info(44100, 2, 16);
I2SStream in;
FilteredStream<int16_t, float> filt_stream(in, info.channels); // Defiles the filter as BaseConverter
LowPassFilter<float> lp0(440.0f, info.sample_rate, 0.5f);
void setLowPassFreqency(float freq) {
// change filter parameters
lp0.begin(freq, info.sample_rate, 0.5f);
}
void setup() {
...
filt_stream.setFilter(0, lp0);
...
}
|
Beta Was this translation helpful? Give feedback.
-
because then I would need to call lpf.begin every signel adc read if i wanted to use an external knob with analogRead. in other words I want to be able to continously change the parameter values using a knob (or any other control signal) thanks |
Beta Was this translation helpful? Give feedback.
-
No you would call setLowPassFreqency only when the value has changed. You could even add the logic to setLowPassFreqency that you call begin only when the freq has changed |
Beta Was this translation helpful? Give feedback.
-
ok so it is not the same as the ADSR or sine wave classes with those classes you have a .begin for setup but then you can manipulate via the setterMethods there are no setter methods in the lowpassFilter and I was just trying to make sure i was not missing something normally you would call the begin in setup and then the setter in your loop sineWave.begin(info, N_C4); sineWave.setFrequency(knob1) |
Beta Was this translation helpful? Give feedback.
-
Ahh I see i can do exactly what I would like to do with the filter in Maximillian |
Beta Was this translation helpful? Give feedback.
I think there is something wrong with the version that you currently have in PlatformIO. I suggest to delete the .pio folder to trigger a reload of the actual version.
ps. I was just double checking the code and indeed there was an error in my code on line 319! Strange that Arduino did not complain.