Hacker News new | ask | show | jobs
by timewizard 439 days ago
"Variable duty cycle?"

So just PWM?

Also, if you needed to exceed 50%, you could have just combined two different square waves, out of phase, and you'd be there.

3 comments

> if you needed to exceed 50%, you could have just combined two different square waves

I don't think this is possible. A balanced square wave has no even harmonics in the frequency domain. Anytime the duty cycle is not 0%, 50%, or 100%, you will have non-zero even harmonics.

A linear combination (scaled sum or difference) of two balanced square waves will necessarily still have all even harmonics at zero, and thus cannot emulate a square wave with a duty cycle different from 50%.

> Anytime the duty cycle is not 0%, 50%, or 100%, you will have non-zero even harmonics.

The article is specifically trying to achieve those harmonics. This is the initial problem.

> A linear combination (scaled sum or difference) of two balanced square waves will necessarily still have all even harmonics at zero

Yea, that's why you need the phase offset, as I mentioned.

> and thus cannot emulate a square wave with a duty cycle different from 50%.

You can /synthesize/ a square wave at any duty cycle you like. We're still doing Fourier just without the whole transform.

That's true, I'm coming into the audio and signals world as a beginner so I'm still picking up the lingo but totally! For my purposes I only want to keep track of a single source for a channel so I've gone down this wave transformation path rather than composition but that also would get the job done
Yeah, at least in the context of music synthesis, everyone just says PWM. (The term even being subject of a meme with a certain youtuber who seems to be fond of it ;)).