Daisy patch repurpose CV Inputs as Gates

Hello!

I’m wondering if it’s possible to repurpose the Daisy Patch’s CV inputs (CTRL1-4) as Gates? I tried going the algorithmic way by implementing a trigger function like the one from GateIn class, but I get an extra trigger every time. I’m also unsure if the ramping up voltages of the gate signals will be an issue regarding time.

Here’s the Trig function which is executed inside the AudioCallback:

  bool Trig()
  {
      float mapped = floorf(sonovolt::math::map(control_->Value(), 0.0f, 1.0f, 0.0f, 8.0f));
      float diff = abs(mapped - prev_value_);
      prev_state_ = state_;

      state_ = diff > 1.f;

      bool flipped = state_ && !prev_state_;

      if(flipped)
      {
          prev_value_ = mapped;
      }

      return flipped;
  }

Cheers!

Hey rkrd!

Thank you for the wait.

This code should be a good starting point for what you’re trying to achieve:

bool Trig()
{
  bool state_ = control_->Value() >= kThreshold;
  bool ret = state && !prev_state_;
  prev_state_ = state_;
  return ret;
}

Hope it helps!

1 Like

Thank you @Takumi_Ogata, that’s a much better approach. I was also trying to get the CV value to then use as mapping, but it makes more sense to separate the two from the trigger mechanism.

1 Like