rect~
Description
Use the rect~ object to generate an anti-aliased rectangle wave.
Examples

Spectral comparison of rect~ and an ideal rectangular wave driven by a phasor~
Arguments
frequency [number]
Optional
First argument sets the initial frequency of the oscillator. The default is 0.
pulse-width [number]
Optional
An optional second argument sets the pulse width. The default is 0.5.
Attributes
Common Box Attributes
Messages
int
Arguments
frequency
[int]
In left inlet: Sets the frequency of the oscillator.
In middle inlet: Sets the pulse width of the oscillator. Signal is wrapped into the range 0-1. A value of 0.5 will produce a rectangular wave that spends equal amounts of time on the positive and negative edges of its cycle.
In middle inlet: Sets the pulse width of the oscillator. Signal is wrapped into the range 0-1. A value of 0.5 will produce a rectangular wave that spends equal amounts of time on the positive and negative edges of its cycle.
float
Arguments
frequency
[float]
In left inlet: Sets the frequency of the oscillator.
In middle inlet: Sets the pulse width of the oscillator. Signal is wrapped into the range 0-1. A value of 0.5 will produce a rectangular wave that spends equal amounts of time on the positive and negative edges of its cycle.
In middle inlet: Sets the pulse width of the oscillator. Signal is wrapped into the range 0-1. A value of 0.5 will produce a rectangular wave that spends equal amounts of time on the positive and negative edges of its cycle.
signal
In left inlet: Sets the frequency of the oscillator.
In middle inlet: Sets the pulse width of the oscillator. Signal is wrapped into the range 0-1. A value of 0.5 will produce a rectangular wave that spends equal amounts of time on the positive and negative edges of its cycle.
In right inlet: (optional) A sync signal. When the control signal crosses from below 0.5 to above 0.5, the oscillator resets itself. A phasor~ object works well for this purpose. The classic use is to set this control signal to your fundamental frequency and "sweep" the left frequency input in a range somewhere several octaves higher than the fundamental.
In middle inlet: Sets the pulse width of the oscillator. Signal is wrapped into the range 0-1. A value of 0.5 will produce a rectangular wave that spends equal amounts of time on the positive and negative edges of its cycle.
In right inlet: (optional) A sync signal. When the control signal crosses from below 0.5 to above 0.5, the oscillator resets itself. A phasor~ object works well for this purpose. The classic use is to set this control signal to your fundamental frequency and "sweep" the left frequency input in a range somewhere several octaves higher than the fundamental.
synctrig
Arguments
sync-value (0 through 1)
[float]
The word rect~ will reset itself).
followed by a floating-point number changes the value at which the object resets itself (i.e., when the input signal crosses from below the specified number to being above it, Output
signal
An antialiased rectangular waveform. An ideal, straight-line rectangular wave generated in a computer contains aliased frequencies that can sound irritating. rect~ produces a nice, analog-esque output waveform.
See Also
Name | Description |
---|---|
cycle~ | |
phasor~ | |
saw~ | |
techno~ | |
tri~ | |
MSP Basics Tutorial 3: Wavetable Oscillator | MSP Basics Tutorial 3: Wavetable Oscillator |