# Integration/accumulation

I’m guessing there must already be a module that does this but I just don’t know the right keyword: is there something that integrates a signal, in the mathematical sense? I.e. with at least an input and a trigger, which outputs the sum of the input since the last trigger?

I’m not shure if I understand you correct, but I think you could achieve this with the Frank Buss Formula module

but please don’t ask me what the right formula for it is

or Nysthi should have a module for this

https://library.vcvrack.com/?brand=NYSTHI

Thanks! I don’t think that does what I want, since I don’t see from the documentation how to store values, but it looks extremely useful for other things.

The simplest version of what I want would be a module that kept a variable, lets call it X, which is initialized to zero and is reset to zero from a trigger. An incoming signal with sample values Y[i] would be summed into X: X += Y[i]. Then it would be nice to have options for wrapping or folding X within a given voltage range.

I’m pretty sure there are submarine modules that do latches and math units. Pretty easy to patch together from an adder and a latch/shift register. amirite?

1 Like

You’d need to multiply by dt and have a scaling parameter for it to be useful. `output += input * speed / sampleRate` each step.

1 Like

Thanks! I was just trying to sketch the idea, thanks for fleshing it out. I guess I might actually write a little module for it if it doesn’t already exist.

Thanks! I’ll give that a try. It might be nice to combine the functionality into a single module to be able to add more complex options, maybe it would be a good starter project for me.

The submarine AO modules can do integration, you can take an input, scale it and add it to a second signal. You can feed the output back as one of those two inputs to make an integrator.

The only thing I would point out is that its sensitive to changes in your sample rate.

If the Frank Buss formula offers some value that tracks sample rate, then you can use the same feedback approach. You only need to store a value for one sample, and you can effectively store it in the feedback cable.

Ah right, thank you. For some reason I have a mental block about making feedback loops like that. I will give that a try.

An integrator could be written in VCV Prototype.

Oh excellent! I had not noticed that module yet. That can do everything I was thinking of, I suppose its just rather CPU-inefficient.

It has a frame divider so you can run the script’s `process()` function every N audio frames to reduce CPU by about N.

Thanks. I think I may try to extend this idea into a module that would do some physical modeling, a nonlinear oscillator that would react to an input stream as a physical force, i.e. something like y’’ = -cy’ - ky -sy^3 + x/m where x is the input. Maybe it will just sound like crap but perhaps with some tweaking could be an interesting filter (https://en.wikipedia.org/wiki/Duffing_equation#/media/File:Duffing_frequency_response.svg).