Simplest way of adding a 1 or 2 sample delay to a trigger input?

Hello :slight_smile:

I am working on a hack of a module and I would like to add 1 or 2 samples delay to a trigger input, in code.

I was wondering if there is a function in the VCV “vanilla” code I could use to add this delay, without having to jump through hoops and do it “manually”?

Thanks!

I would say rack::dsp::RingBuffer should help here.

could take some inspiration here Fundamental/Delay.cpp at v2 · VCVRack/Fundamental · GitHub

Yes, it uses dsp::DoubleRingBuffer.

Thanks I checked it out :slight_smile:

I am no master programmer and for my level it is probably a bit too much, I am not sure I understand how to make it simple.

In the meantime I was looking a bit around and it seems like this module here offers a one sample delay, it seems a bit simpler to me:

Guess I have to mess a bit around and see what I can make out of both ways.

Thanks again :wink: