having trouble with square wave lfo

Mr. Tunes's icon

i have a selector~ with other waveshapes that are working fine, but the rect~ doesn't make the number flip up and down. if i remove the abs 0. object you see the flipping, but that puts it into negative.

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

square-wave.jpg
jpg
Nikolas K's icon

Hi Mr. Tunes,

The way you have it, the numbers going to the [abs 0.] are 432.3 and -432.3, so... [abs] outputs 432.3 and... 432.3!!! so its working right.
As I see the [rect~ ] outputs at a -0.5 - 0.5 range. You should add a [+~ 0.5] after the [rect~ ] to offset to at a [0 - 1] range.

After doing so, you will see the result of the [abs 0.] to go from 0-ish to 900-ish...
(The -ish is, because the [rect~ ], as you see in the [scope] goes a bit outside the [-0.5, 0.5] range)

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

Hope it helps,
Nick

Mr. Tunes's icon

yeah that's great, thanks so much for helping in a pinch!

bkshepard's icon

Here are a couple of ways to generate a full -1 to 1 square wave LFO. The rect~ object produces an antialiased square wave that is better for hearing than for controlling other signals.

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

Mr. Tunes's icon

thanks, that's very helpful

Christopher Dobrian's icon