pwm()

pwm(x, width)

Category

Oscillator / Waveshaper

Description

Pulse-width oscillator. The second argument controls the pulse width, normally from about 0.05 to 0.95; animated width values create classic PWM motion.

Waveform

pwm waveform

Example: pwm(X,0.5)

Arguments

Typical Values

Width is most useful around 0.05 to 0.95. Avoid exactly 0.0 or 1.0 for sustained tones because very narrow pulses can become silent or clicky.

Example

pwm(X, 0.4)

Notes

For pitched oscillator functions, X already contains the current MIDI note pitch and transpose information. Prefer saw(X), sin(X), or pwm(X, 0.4) unless you intentionally want an octave or ratio shift such as 0.5*X or 2*X.