How to Make a Random Ramp Signal?

 

Dave Peck wrote:

I've been trying to figure out how to create a control signal that is shaped like a triangle wave, but that changes direction at random times. It needs to always have the same slope (so you can't just change the frequency of an LFO), and it can't have any sudden jumps in level when it changes direction (so you can't just do random switching or crossfading). I want to use it to create arpeggio patterns that change direction at random times.

So far, the attached patch is the best idea I have for how to achieve this. It uses two triangle LFOs at different rates. These are sent to a pair of AB comparators, wired so the comparators produce a logic signal whenever A becomes greater than B and whenever B becomes greater than A (so it's whenever the levels of the two LFOs cross at the same point). These logic pulses are then DC filtered to produce quick trigger pulses (thanks, Rob!) which trigger a S/H module, which then occasionally switches a logic signal from hi to low or vice versa, depending on the state of the Random Pulse Gen module. This switching signal crossfades the original LFOs, but only when their signals match, and only sometimes.

Then the whole thing gets duplicated and the results get crossfaded again for more variety.

Whew. There must be an easier way. This way is DSP expensive, and the LFO rates & level trims are touchy. After I finished it, it occurred to me that I may be able to use Rob H's soft sync trick applied to a single triangle LFO (this will reverse the direction of the ramp), switched by a random pulse generator. I'll have to review the soft sync workshop. Anybody else got an idea for a better way to do this?

Roland Kuit wrote:

Use a Sample&Hold, set trigger speed, use LFO (in sync if you want) and a rnod LFO, together in a control mixer.

Dave Peck wrote:

Yes, I tried that, but since the random LFO is not linear, it causes the note pattern to skip notes during large value changes, rather than acting like an arpeggiator.

Lennart Regebro wrote:

Wouldn't this work? Control the ramp steepness with the portamentotime, and the speed with which it switches direction with the randomgen speed.

Jan Punter wrote:

Some simple ideas,

Approach A uses a wavewrapper, but when the modulation for the wrap is set too fast, or the wrap too deep pure random will result.

Approach B uses an up/down counter arranged around a S&H, this should work better but it doesn't. Maybe due to the fact that a true random up/down sloping triangle could easily spend most of the time in one of it's extreme values ?

Rob Hordijk wrote:

Here is a LFO direction change example. By inverting the grey signal polarity (the levelshift/invert and crossfade mixer) the LFO ramp changes from up or down or vice versa. But the ramp slope's time remains constant. By S&H'ing the LFO output the key quantizer is synced to the master clock.

Chet Singer wrote:

Here's a method that uses a linear envelope generator to create the rise and fall times. It's driven by a random pulse generator. When the output gets too high or too low, the envelope is forced in the other direction for at least one second. In this patch, it's used to drive the pitch of an oscillator. The overall rate is an interaction of the random pulse generator and the envelope times.

Rob Hordijk wrote:

Another variation

Dave Peck wrote:

In case anybody is interested, attached is a modified version of Rob H's solution to the random slope question. I simplified it a bit (I know, unusual for me). Changing the frequency of the oscs will change the rate of the steps, and changing the random pulse generator will affect how often the slope tends to change direction. I plan to use this circuit to control filter sweeps. I'll attach the finished patch later.

Here is a finished patch which uses the linear random ramp I've been prattling on about in recent posts. It uses a modified version of one of Rob's ideas to generate the linear ramp, which changes direction at random times. This signal is then quantized & used to control resonant filters. This results in resonant peaks which fall exactly on the "notes" in the harmonic spectrum, with each step the same length, so you get an argeggiator effect with random changes in direction.