Pulse Width Modulation
Pulse Width Modulation (PWM) is a method for changing the timbre of a square wave. It is frequently found in analog and digital synthesizers as a means for enriching a sound, for example in pads.
A PWM signal can be generated with a case based logic, respectively a threshold. In programming, this can be implemented with a phasor and the pulse width $\tau$:
$$ \mathrm{PWM}(t) = \begin{cases} 1 \ \ \ \ \text{for} \ t<= \frac{T \tau}{100} , \\ -1 \ \text{for} \ t> \frac{T \tau}{100} , \end{cases} $$The pulse width usually takes values beween $0\%$ and $100\%$: