Total noob question about coding Daisy through Arduino

Hi!
I have just started trying to get to grips with prgramming the Daisy with Arduino.
As a test I’m using the reverb example as a base and trying to make a reverb effect with controllable feedback through a potentiometer.
The oscillator example works fine with my current setup, so I know my potentiometer is hooked up right and I get reverb applied to the signal from my synth if I just upload the reverb example without tampering with it.

What I’ve done so far is added this line to my void loop:
feedback = ((analogRead(A0), 0.0, 1023.0, 0.0, 85.0)/100.0);
and then I’ve moved the
verb.SetFeedback(feedback);
to within the MyCallback function.
I’ve tried placing it outside and inside the for loop to no avail.

What I get is a reverb effect added to the signal, but it’s not controllable at all.
Nothing happens when I turn the knob. Is there something obvious I’m missing?

Hmm, can you paste your actual audio callback/loop() code? It looks like the line you pasted is missing the map function call (guessing that’s what you were using there).

One thing I’d say is maybe try mapping it to 0.85 -> 0.99 or a very small range near 1.0 – depending on the lowpass freq setting low settings of the feedback can be very subtle.

Oh wow, yes I had missed the map function call.
That’s a real rookie mistake right there.
I’ve used it for several other things I’ve done with Arduino but for some reason I didn’t spot it here.
My code works now and a range between 80 and 99 seems about right.

Is there any way to set the reverb amount?

Not within the context of the module itself, but you can handle it by treating a knob as either a send amount or as a dry/wet mix. You could also use both or some combination of each.

here is a rudimentary example of each

// Send style (pretend there are left/right versions of each var):
float send, wet, dry;
dry = in[i];
send = dry * knobamt;

verb.Process(send_left, send_right, &wet_left, &wet_right);
out[i] = dry + wet;

// Mix Style  
float dry, wet;
dry = in[i];
verb.Process(dry_left, dry_right, &wet_left, &wet_right);
out[i] = (dry * (1.0 - knobamt)) + (wet * knobamt);
1 Like

Thank you! After a lot of trouble and errors with unmatched data types I managed to get it working and it sounds great! :slight_smile:
here’s the code I ended up with if anyone is interested.

#include "DaisyDuino.h"

DaisyHardware hw;

size_t num_channels;

ReverbSc verb;

float feedback;
float reverbAmt;

void MyCallback(float **in, float **out, size_t size)
{
  verb.SetFeedback(feedback);

  for (size_t i = 0; i < size; i++)
  {
    float wet_left, wet_right;

    verb.Process(in[0][i], in[1][i], &wet_left, &wet_right);
    out[0][i] = (in[0][i] * (1.0 - reverbAmt)) + (wet_left * reverbAmt);
    out[1][i] = (in[1][i] * (1.0 - reverbAmt)) + (wet_right * reverbAmt);
  }
}

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();

  verb.Init(sample_rate);
  verb.SetLpFreq(15000.0f);
  DAISY.begin(MyCallback);
}

void loop() {
  feedback = (map(analogRead(A0), 0.0, 1023.0, 80.0, 99.0)/100.0);
  reverbAmt = (map(analogRead(A1) , 0.0, 1023.0, 0.0, 100.0)/100.0);
}

I think I’ll add another control for the LP frequency.

My end goal with this is to make a switchable multi effect box that I can use with my homebrew modular synth.

4 Likes