How to create a LFO that pauses between cycles?

Noisey Parker's icon

I have been trying to create an LFO that will send out one cycle and then pause, so the things is modulating, in this case the gain of an over drive isn't just going on and off in various ways according to the ramp I'm using, but gives a sweep of overdrive and then stops. This way I can have the modulation mostly at zero with occasional bursts of noise. I'm sure there must be an easier way of doing it than the way I have been trying...using mathematical operators and edge~ to detect when it has come back to the zero crossing and then turning it off.

Many thanks for any help.

Roman Thilenius's icon

you could either apply an envelope to the modulation signal or make the silence part of its shape.

Noisey Parker's icon

Thanks for getting back to me. How would I make the silence part of its shape? I would like to dynamically control how often the LFO creates a cycle of modulation. Applying an envelope seems a bit complex for my needs, I sort of imagine having two dials one for how fast the LFO is and one for how quickly the cycles come after one another.

brendan mccloskey's icon

Hi
see this thread, where I asked about a mutable phasor:

Max Patch
Copy patch and select New From Clipboard in Max.

And there are 2 simpler examples here, using line~ and zigzag~ as raja suggests

HTH
Brendan

Noisey Parker's icon

Thank you for the advice everyone, I really appreciate it. Brenden the first example is exactly what I was trying to make. Lovely.

Noisey Parker's icon

Actually, sorry one last thing...i'm not that familiar with the cos~ object, how might I adapt this to implement waveforms line Square/Triabgle/Saw etc?

brendan mccloskey's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Hi
do you mean my own line~ example, or the example given by leafcutter john (I think) in the other thread I mention? If the former, then you can use the line~ ramp to produce other shapes quite simply, if ya think about it . . . . . for example, a square wave is either 1 or 0 right. Or true/false, so if the line ramp is passed through a [> 0.5] condition, then you'll get a square/pulse wave; a triangle will ramp UP to 1 over the first half of a line ramp, then DOWN back to zero over the second half; and so on:

Brendan

brendan mccloskey's icon

ps

all I know about cosine is that it turns lines into curves; something to do with radians, circles and such. Shouldn't have been staring out the classroom window dreaming of rock stardom, in 1978 ; )

Noisey Parker's icon

I didn't listen either, I vaguely remember something to do with KRAKATOA is a mnemonic, but have no recollection what it stands for! I worked out that your patch works with cycle~ as well and the I can use buffers for the different waveforms. See first example below. I was hoping to integrate the envelope into a really neat little max for live patch that is locked to the transport see 2nd below but can't make it work, seems like phasor~ and line~ can't both set the cycle~ phase?

Max Patch
Copy patch and select New From Clipboard in Max.
Max Patch
Copy patch and select New From Clipboard in Max.

brendan mccloskey's icon

Erm, M4L and [transport] issues are a bit beyond me I'm afraid; but your input to [selector~] doesn't seem to be right. It needs values >0 to open specific inlets. Incidentally, is the waveform subpatch of your own making?

The only maths I can remember from 40 years ago smacked me up the face the other day whilst reading to my 2-yr old daughter, Peppa Pig's dad solves quadratic equations:

Brendan

Roman Thilenius's icon

applying an envelope starts with using * 0 or gate msp.

Noisey Parker's icon

Sorry to start this up again, but I'm still not quite getting it, if I want to use the attached patch as my LFO, how can I put an envelope to it, but always start and end with the same bit of the wave cycle?

Max Patch
Copy patch and select New From Clipboard in Max.

jonah's icon

what about using play~ or groove~ and not looping them?

you can also message buffer~ with fill sin, cos, sinc or constants, make some interesting shapes repeatedly applying window, gain, offset.

check out buffer~'s generators + functions and index~'s fft help for drawing shapes.

Noisey Parker's icon

Thanks Jonah, but I think what I want is simpler than that, I essentially want the patch that Brenden posted in this thread but locked to the transport.

Noisey Parker's icon

Hello all,

I have the made the attached patch by piecing together the advice on this thread and going through various tutorials, if any one can offer any advice for improvement then I would really appreciate it. I can't quite tell if my zigzag~ object is set up properly?

Thanks again

Max Patch
Copy patch and select New From Clipboard in Max.

Roman Thilenius's icon

cos msp will make a cosine out of line msp.

note that it works differently than cos.

Roman Thilenius's icon

u should also question that it is an LFO what your trying to build. an oscillator is normallya something which is not interrupted. :)

brendan mccloskey's icon

Well-spotted raja

@[space]hi was my bad; speed-typing :(

Noisey Parker's icon

Thanks so much for checking it over raja, however, in your version the pause time is inconsistent and the rate multiplier of the pause time has no effect at all? Am in missing something?

Noisey Parker's icon

Hi Raja,

My apologies for not being clear, you've gone above and beyond on this one! When I refer to pause time I mean the gaps between the cycle of the LFO (so the top left umenu and the integer box next to it) and the cycle time, which is the other umenu. If the pause time and cycle time are set to the same amount then it will be a continuous LFO.

I am not sure if I need the patch to be sample accurate, but I do need the cycle and the pause to be in phase other wise the pause envelope will cut in in the wrong part of the cycle and not give a smooth curve. Your patch seems to work perfectly now, the only issue being that the square wave and the saw + seem to rest at 1 instead of 0, could I simply multiply by -1?

Thanks again

Noisey Parker's icon

Thanks for all your help everyone it looks like im done, I have a funny feeling that I could have made the whole thing without MSP! I jut could think how to make the curves with line!!