First time here? Check out the FAQ!

How can I make a capacitor-like module?

0 votes

I am looking for a module or sound that would acumulate sample values as they are read and then drop immediatly back to zero when the acumulated signal reaches a set threshold. I designed something myself using feedback input/output modules but i wonder if there wouldn't be a more efficient solution with no latency at samplerate.
asked Jan 8, 2016 in Sound Design by malcolm-braff (Practitioner) (770 points)

1 Answer

+1 vote
I would experiment with two modules: the LossyIntegrator and the Threshold (or SaturatorThreshold).  When the threshold is crossed you could reduce the ReleaseTime of the LossyIntegrator so it quickly drops to zero.  You would still have to use the Feedback In and Out modules as you are doing now, but the latency of that can be a single sample, which is effectively zero latency in a sampled system.
answered Jan 8, 2016 by ssc (Savant) (120,590 points)
Thank you very much! For now i am testing the signal with equality to my threshold value as a constant and then multiplying one-minus-the-test-result by the accumulating signal so it drops immediately to zero. I have the feeling I am adding one sample in the process, I am not sure how. So here is my question: when a ramp signal drops from 1 to -1  does it actually reach 1 and then gets the value of -1 for the next sample or does it replace 1 by -1?
What gives you the sense that you are introducing an extra sample?  Have you tried recording it and looking at the result in the wave editor?  In answer to your question, a fullRamp reaches 1 on sample n and becomes -1 on the next sample (n+1).  Change implies time, and the smallest unit of time in a digital system is the duration of one sample.  In other words, the entire signal flow graph is evaluated once per sample (no matter how long the signal flow graph is or how many modules you add to it).

Hi there,

I'm working with malcolm on this together, the basic idea is:

We use an OscillatorTimeIndex as input (but in the future we want to use a warped timeindex as well) and want multiples (harmonics) of that timeindex at the output. we also want to be able to create subharmonics.

Right now we are doing it using a feedbackLoop and feed it the derivative of the timeindex. then we reset the loop when it's hitting 1. but due to some inaccuracy (which depends on the harmonic as well as the samplerate) the output slowly drifts.

See the attached Sound for an example.

What are we doing wrong? How can we work around this?

maybe when scaled and depending on scaling/samplerate/frequency, the increment of the ramp will clip towards the end of the integration, causing the loss of part of the last incrementation before reset? So maybe what we need is to calculate 1 minus modulo and then generate/update an offset when the value is smaller than the increment?
Since you want to create harmonics and subharmonics of a TimeIndex, could you use the prototype named 'OscillatorWithTimeIndex w/ InputOutputCharacteristic as Frequency Multiplier'?
nice! sadly it doesn't allow arbitrary ratios like 2/3. it's hard synced to the input if you know what I mean.
exactly: the problem with subharmonics is that we want a resulting ramp that would be longer as the original one.
How about using two InputOutputCharacteristics: one of which multiplies the frequency of the master by 2, the other of which multiplies the frequency by 3.  Then you have a 2/3 ratio relative to the master.