[WIP] - Modulo %

The other day I was trying to understand how staircase worked, having never seen one in person, and my misunderstanding lead me to a novel approach to creating the rings I was craving. What I’m working on is heavily inspired by Ken Stone’s Modulo Magic, which is used for cv processing and keeping a voltage within a single octave. The modulo operator gives you the remainder from integer division, allowing you to keep a large signal within small. range While it has some similarities to using full wave rectifiers, it doesn’t invert the signal at each “fold” It instead resets the voltage to 0 when it passes a threshold.

I’d love to get some feedback on the circuit, its extremely simple, resistor values will change for more common values. It doesn’t have any buffers at the moment, but I will add those once I have a working prototype. I’ll be attempting to breadboard it out soon with the eventual goal of selling it as a pcb/panel set if there is any interest. I may add a vca circuit at the beginning so you can essentially cv the number of divisions that occur. I’ve attached a few screen shots so you can see how it works on simple wave shapes.


Oh, this is interesting! I’ve been playing with a wavefolder idea as well but mine used diodes rather than comparators. Very interesting indeed.
I have to recommend you talk to @syntonie about the output saturation voltage of LM6172’s, granted you’re using them for the comparator sections. They won’t output a full +/-12V which this seems to expect (based on the voltage dividers). Bastien’s Phase shifter uses a comparator too so he should know off hand.

I like the stepped output especially!

1 Like

Looks awesome @jerry, eager to see what it will look like processing an external video signal!

As @Fox pointed out, using LM6172 as a comparator is a little hacky. On VU008/Ramp shifter, the LM6172 used as a comparator is powered with +5V/-5V and gives an output of around 3.75Vpp, so I changed the summing resistor accordingly (as the square/pulse output resulting from the comparator is summed with the input signal, so it adds an offset when the square is high, effectively shifting the ramp). Here is a quick simulation with circuitjs. Since the simulation considers an ideal op-amp, I changed the power supply to +3.75V/-3.75V so it is closer to reality. In the original Saw Animator circuit I based VU008 from, the output of the comparator have a variable resistor for summing, so one can set it to the right value to cover for the amplitude loss of the TL07X used as a comparator.
I’ve used +5V/-5V to power the op-amp to minimize the glitch it creates when the comparator switches from low to high, though it is still present.

You can check how Castle ADC does, as it is a fairly similar circuit, with 8 comparator stages. Then instead of being summed, outputs are sent to an 8-to-3 bit priority encoder, which makes sense for 3-bit RGB. Here, the op-amps are also powered using +5V/-5V, and the outputs are clipped to remove the negative part before reaching the priority encoder. The fact that the outputs doesn’t reach +5V isn’t much of an issue, as the threshold for the encoder input is probably around Vcc/2.

Then maybe using rail-to-rail op-amps would give better results, though they often needs to be powered with +5V/-5V also.

Best solution is probably to use a dedicated comparator chip, like AD8564 as shown in LZX Reference Designs though also asks for +5V/-5V, which, I suppose, does helps with keeping a fast slew rate.


@Fox @syntonie Thanks for the feedback, I didn’t even realize the similarity to the Castle ADC. I rebuilt it in iCircuit using the comparators to turn on switches, now I’m starting to understand why Ken used two 4066s in his version. This also allows you to change the threshold voltage of the mod operator, although this feels less interesting since it quickly goes outside the 0-1V range. I am running into one issue, which seems apparent in both the op amp comparator version and switch version, the mod operation seems a bit imprecise and it tends to actually go outside the 0-1V range, I’ve been seeing a -.3V to 1 V range which doesn’t appear to be symmetrical given a sine wave. Ive attached the switch based schematic which better shows the strangely shaped output


Yes, that is curious… The same effect is slightly less visible on the first simulation. I’ll try simulating it myself and let you know if I come up with anything.

I am not familiar with this simulator, but I am guessing all of the parts are “ideal,” right?

I see that you’ve added 4.7M resistors as negative feedback. This creates huge gain, but they are not operating as comparators now. If Ken decided to use them in their design, they may be specific to the op amps they used.

It’s just an observation, but will slow down their outputs.

This resistor looks unnecessary.

1 Like

I don’t understand the electronics, but I am super intrigued by the modulo idea. Love the waveforms. I have a bank of Buchla-style wavefolders for processing LFOs, as well as Bastien’s quad rectifier… but this looks like next level stuff. Love the idea of modulating the divisor with a CV input, this is a must have.

1 Like