Total noob
I want to control the seed example file using a potentiometer. I have one on pin A0, the only example that seems to use a pot is the oscillator one but I can’t figure out how to use a pot to control a filter instead of the LFO in the example sketches.
I tried copying that portion of the oscillator sketch to the Moog filter sketch.
why doesn’t it work? (all the lfo stuff is still there) I get no sound.
// Title: moogladder
// Description: Sweeps the cutoff with an lfo
// Hardware: Daisy Seed
// Author: Ben Sergentanis
#include "DaisyDuino.h"
DaisyHardware hw;
size_t num_channels;
static MoogLadder flt;
static Oscillator osc, lfo;
float freq1;
void MyCallback(float **in, float **out, size_t size) {
float saw, output;
for (size_t i = 0; i < size; i++) {
saw = osc.Process();
flt.SetFreq(mtof(freq1));
output = flt.Process(saw);
for (size_t chn = 0; chn < num_channels; chn++) {
out[chn][i] = output;
}
}
}
void setup() {
float sample_rate;
// Initialize for Daisy pod at 48kHz
hw = DAISY.init(DAISY_SEED, AUDIO_SR_48K);
num_channels = hw.num_channels;
sample_rate = DAISY.get_samplerate();
// initialize Moogladder object
flt.Init(sample_rate);
flt.SetRes(0.7);
// set parameters for sine oscillator object
lfo.Init(sample_rate);
lfo.SetWaveform(Oscillator::WAVE_TRI);
lfo.SetAmp(1);
lfo.SetFreq(.4);
// set parameters for sine oscillator object
osc.Init(sample_rate);
osc.SetWaveform(Oscillator::WAVE_POLYBLEP_SAW);
osc.SetFreq(100);
osc.SetAmp(0.25);
DAISY.begin(MyCallback);
}
void loop() {freq1 = 24.0 + ((analogRead(A0) / 1023.0) * 60.0); ;
}
I’ve also seen this type of “map” in other ppls sketches:
void loop() {
pitch = map(analogRead(A0), 1, 1020, 24.0, 100.0);
Thanks