Daisy Seed Poteniometer Requirements

Hi! NOOB alert. I want to set a potentiometer to be a parameter for filter effect. What am I missing?

in main(void)

seed.Configure();
seed.Init();
sample_rate = seed.AudioSampleRate();
int block_size = 48;
callback_rate = sample_rate / block_size;
// initialize Moogladder object
flt.Init(sample_rate);
flt.SetRes(0.9);


AdcChannelConfig knobAdc;
knobAdc.InitSingle(seed.GetPin(PIN));
seed.adc.Init(&knobAdc, 1);
knob1.Init(seed.adc.GetPtr(0), callback_rate);
filterCutoff.Init(knob1, 50, 20000, filterCutoff.LOGARITHMIC);
seed.adc.Start();
seed.StartAudio(AudioCallback);
while(1) {}

and in static void AudioCallback

updatePotentiometers();

void updatePotentiometers()

knob1.Process();
freq = filterCutoff.Process();
    flt.SetFreq(freq);

everything compiles fine, make program-dfu gets it on the board, but my poteniometers have no effect on the parameters. Have checked the potentiometer with Knob seed example, and LED corresponds to pot resistance, so wiring should be fine.

Thanks!

1 Like

Right off the bat, you’ll want to use your filterCutoff Parameter in updatePotentiometers(), not knob1 (which is an AnalogControl).

i.e.
flt.SetFreq(filterCutoff.Process());

In the future, could you upload the whole file somewhere? In this example it’s hard to tell right away exactly what knob1, filterCutoff, etc. are.
Additionally there could be mistakes elsewhere in the code.

Let me know if that works!

1 Like
https://www.dropbox.com/s/fw30f766cmwytrp/z_filt.cpp?dl=0

Thanks for the reply! I took the time to test again to make sure, but the code at the dropbox link passes filtered audio, but doesn’t respond to potentiometer changes.

I based the adc knob initialization on of the pod MultiEffects.cpp example.

It would be helpful if we could take a look at your schematic / circuit diagram too .

I have followed the wiring as laid out here:

I also have these examples running with the pots wired as is, both are capable of controlling led brightness.

It looks like your code is okay, but a few things I can suggest for trouble shooting.

I don’t think you mentioned above, but is resonance working, just not cutoff?

Also, you can try to confirm the the AnalogControls are working as expected by doing a simple linear scale/offset with its output before using the parameters. Something like:

float cutoff;
cutoff = 500.f + (knob1.Process() * 12000.f);
flt.SetFreq(cutoff);

One other thing that doesn’t necessarily have an effect on whether it works or not, but makes it a little trickier to find where the issue might be, is the scope of variables. Many of the globals are correct, and/or necessary, but a few of them make it a little harder to trouble shoot (like freq and res, that seem to only be needed in the UpdatePotentiometers() function).

I don’t think you mentioned above, but is resonance working, just not cutoff?

No, neither parameter is working.
I implemented the suggestion as follows:

void updatePotentiometers()
{
// freq = filterCutoff.Process();
float cutoff;
cutoff = 500.f + (knob1.Process() * 12000.f);
flt.SetFreq(cutoff);
// res = filterResonance.Process();
// flt.SetRes(res);
}

and still I have no effect. Again, the pots successfully control the Knob example. It seems like they aren’t updating or something? I am programming via make program-dfu if that would matter.

Sorry about the code formatting, the reason the scope of my variables is global is that I am debugging this problem :slight_smile: I appreciate the help! I love daisy so far, even though I have yet to solve this basic problem…

Your code works for me on the pod, but I had to change the knob1 and knob2 pin numbers to 21 and 15 respectively to match the pod. If you followed the knob schematic exactly, your pots will be on 21 and 15 as well.

One other thing to change. In the callback you’re processing both the left and right inputs through one filter. You can either have two identical filters, one for left and one for right, and then pass their outputs to left out and right out. Or you can just pass one input to the filter and then pass that output to both left and right. You choice there.

1:
out[i] = fltL.Process(in[i]);
out[i+1] = fltR.Process(in[i+1]);

2:
float sig = flt.Process(in[i]);
out[i] = out[i+1] = sig;

Hey, thanks again for your help. I added the stereo fitlers as you suggested. Then I took the daisy back to the breadboard and realized that the pinout I was using


differs from the one included in the examples on github.
I have the pots as parameters working now that I can see AGND… thanks again for your help!

Nice! Glad to hear it’s working.

This (Knob example controlling cutoff and resonance of a filter over a simple wave) cleaned up the way you think works best would make a great addition to the examples - as a styleguide how to best do this in C++ and Arduino. I think it would help a lot of users.

3 Likes