Pulse Width Calculator
Turn oscillator duty cycle into period, on-time, off-time, sample counts and the harmonic null pattern that shapes a pulse wave's timbre
Full Calculation Breakdown
| Harmonic | Frequency | Rel. Amplitude | dB |
|---|---|---|---|
| — | — | — | — |
| Duty | Null Spacing | First Null | Character |
|---|---|---|---|
| 50% | every 2nd | 2nd (even gone) | Hollow, odd only |
| 33% | every 3rd | 3rd | Reedy, woody |
| 25% | every 4th | 4th | Bright, buzzy |
| 20% | every 5th | 5th | Nasal, thin |
| Duty | Period | On-Time | Off-Time |
|---|---|---|---|
| 50% | 2.273 ms | 1.136 ms | 1.136 ms |
| 40% | 2.273 ms | 0.909 ms | 1.364 ms |
| 33% | 2.273 ms | 0.750 ms | 1.523 ms |
| 25% | 2.273 ms | 0.568 ms | 1.705 ms |
| 10% | 2.273 ms | 0.227 ms | 2.045 ms |
| Duty | Sound | Harmonics | Typical Use |
|---|---|---|---|
| 50% | Hollow, woody | Odd only | Clarinet, sub bass |
| 40–45% | Warm, full | Slightly thinned | PWM pads, leads |
| 33% | Reedy | 3rd null | Bass, reed tones |
| 25% | Bright, buzzy | 4th null | Classic leads |
| 10–20% | Nasal, thin | Many nulls | Oboe, bright pluck |
I bet if you listen to a square wave you’re hearing something hollow, whereas listening to a narrow pulse might sounded brighter, more buzzy. That’s not magic, just math in disguise. Your synthesizer pulse width parameter is essentially a volume knob for certain harmonics; turn it one direction, get bite. Turn it another, get warmth. If you understands this relationship, you can start to sculpt your tone rather than guessing what each knob does.
Duty Cycle. Consider this to be the proportion of total period where signal is high compared to when it’s low. In a typical square wave, this number is 50%: For every cycle, the signal spends half its time high, and half its time low. That peculiar sonic consequence of this symmetry is that all even-numbered harmonics are canceled out. The first, third, fifth, and seventh partials exist, while those pesky second, fourth, and sixth ones dissapears into nothingness. And that gives rise to that reedy quality many of us associate with old-school video game bass lines or clarinet sounds; you lose some lower-end heft, but you do get something more distinctive in the upper mid-range.
How Pulse Width Changes Sound
If you lowers that duty cycle below half, however, you’re breaking that symmetry, and even harmonics rush back into the picture to fill up the spectrum. Not all are equal, though, as there’s a rule about which frequencies come through and which don’t. The first null occurs at the reciprocal of the duty fraction; If your duty is one quarter or twenty five percent, then its reciprocal is four, and fourth harmonic will go quiet at this setting. At 33 percent duty, the third harmonic goes quiet; the sound will sounded reedy because the third partial is gone. Because these missing frequencies create notches in the sound, those notches define the timbre. A pulse with a duty of ten percent sounds nasal, because it filters out nearly every other harmonic based off its sinc envelope.
If you want exact numbers, then just plug your desired duty cycle and frequency into the calculator up top and it’ll do the math for you. Aside from knowing that the off-time and on-time are returned in milliseconds, what’s important here is that this can become relevant if you’re working around hardware restrictions or sample-based synthesis. To avoid aliasing artifacts, you must know exactly how many samples make up high part of the wave. If it is less than half a sample (meaning your period isn’t longer than 2 samples), you’ve got yourself a problem. It also displays harmonic null pattern, allowing you to visualize exactly what overtones you’re silencing before you even hear the sound.
Because these are higher frequency pulses with very narrow duty cycle, they needs to be sampled at high frequencies to be rendered correctly. If you have a pulse of 10% at four hundred hertz, then that pulse has a very short on time. However, if you are using low samplerates, it is possible that brief spike won’t be captured correctly. That could of result in pitch errors or worse still, distortion. The reference table on the page explains how those millisecond windows shrink as you head upwards through keyboard.
Pulse width modulation is a movement effect most producers use, where slowly sweeping it results in a throbbing vibrato. However, with static duty cycles, you can create a similar sound to real instruments such as a 20% pulse for something that hints at an oboe or a 50% square wave for something closer to a clarinet. What’s going on here is what they call subtractive synthesis using the shape of the waveform, and the key is your ear is listening for the nulls (where a harmonic drops out). Suddenly the tone will change colour dramatically; now it sounds harsher/thinner. Sometimes it’s only by one or two percent but this will tip the balance towards buzz or warmth.
That’s where the character lives, don’t be scared to go asymmetric. Symmetry is clean, but it is often boring too. Breaking it puts the spectrum back together again. It is a tiny thing, but it matters; it fills in gaps to make a sound feel aggressive or full. When you hear the harmonic nulls as features of your sound instead of bugs, your patching becomes intentional. You no longer search for a good sound, you build it from the ground up. So the hollow square wave was only the beginning. Now you hold the keys to every color in between.
