SynthMaker

some thoughts on pulse and pulse width

Archive · 2012 6 old posts

From the original SynthMaker forum (2004–2014), with its members’ names and dates.

tester ·

While looning for osm's for signal reshaping, I found some discussions regarding pulse/square waves and their quality. According to my understanding - wouldn't be easier to use normal pulse generator to turn a digital switch between 0 and 1? Such digital swich would follow signal changes (pulse width), and it should produce ideal pulse waves, which then can be re-amplified and DC readjusted. Am I missing something?

rl ·

yes, you're missing aliasing.

trogluddite ·

tester wrote: should produce ideal pulse waves

The problem here is that when using a digital system there is not really any such thing as a perfect square wave.

A perfect square wave is made up of a series of harmonics that stretch all the way to infinity. But when using a sampled digital system, there is a maximum frequency (half the sample rate) that is the maximum you can generate. Using a 0-1 'switching' system, all of the higher harmonics are still there - what happens to them is that they have their frequencies transformed into ones that your soundcard can play back. But those are not the right frequencies to make a good sounding square wave - they become nasty 'aliasing'. Aliasing is a horrible form of distortion because it has many frequencies that are not related to the pitch of your 'note', which sound out of tune (they go down when your note pitch goes up, for example).

The SM form of PWM does look rather complicated, I agree. But it is done that way because the saw oscillators used have had all of the 'too high' harmonics removed ('band-limited oscillators'). So the square wave produced also has no 'too high' harmonics. Although the resulting square wave is not 'perfect' (if you look with the scope tool, you can see this) - it will sound much better, because it is not asking your soundcard to do the impossible thing of making frequencies more than half the sample rate.

It's a complex subject, and I doubt I have explained it very well - a quick google for 'aliasing' will find you many much better explanations.

tester ·

Okay, thanks for explanation on that, it clarified everything. My thinking is just still between seeing digital logic (idealistic signals) and non-audio related electronics, where idealism is desiderable and sometimes difficult to achieve. 😉

I also thought about this topic in terms of using the pulse as a slow AM modulator (on/off switcher), where these glitches are rather not good for smooth and quick switching the sound. One of ways to make it roght in cooledit for exampple - was to use exp function to sinus wave, I guess another one would be to use some trapezoid with 10-20 ms smoothing edge (made from sinus by cutting the tops).

Acrobat ·

...you can either way produce a clean square using additive synthesis, summing up sine waves: exonerate+rwillson add synth - Completed and released http://en.wikipedia.org/wiki/Gibbs_phenomenon

Leslie147 ·

Acrobat wrote: ...you can either way produce a clean square using additive synthesis, summing up sine waves: http://en.wikipedia.org/wiki/Gibbs_phenomenon

That Wikipedia article appears to suggest that the half-magnitude of the resulting square wave (in the flat parts) is the same as the amplitide of the fundamental sine wave, but it isn't - it's smaller.

A 4/Pi scaling factor comes out of the full Fourier integral, see http://mathworld.wolfram.com/SquareWave.html, so adding:

(4/Pi)sinx + (4/3Pi)(sin3x) + (4/5Pi)(sin5x) + (4/7Pi)(sin7x) + etc.

... would result in a square wave with unit half magnitude. Conversely, adding:

sinx + (sin3x)/3 + (sin5x)/5 + (sin7x)/7 + etc.

... as in that Wikipedia article, would result in a square wave with a half-magnitude of Pi/4 (i.e. less than the unit amplitude of sinx).

Occasionally, I have found it intriguing (and counter-intuitive) that removing the harmonics from a square wave by low-pass filtering should make its voltage excursion increase, although I haven't found a use for this yet.

The Wikipedia entry on 'Square wave' http://en.wikipedia.org/wiki/Square_wave gets the sum right but uses the same, misleading, graphic.

Chris

Wrote something here? To have a post removed or your name hidden, write to [email protected].

Before your first post

A few rules keep this a friendly place. You agree to them once.

Shown next to what you post, here and in the app. It doesn’t have to be your real name: 3–24 lower-case letters, digits or _ (capitals become lower case, spaces become _).

    Then your post goes up straight away.

    Delete this reply?

    Open it in SynthMaker?

    It goes on the track you’re editing there, in place of that track’s sound, and into My sounds. Your other tracks stay as they are.

    Want to keep that track’s sound? Start a new song in SynthMaker first (Song › New song), then open this.

    Report this reply?

    Only the developer reads reports. The person isn’t told who reported them.

    What’s wrong with it?

    Block this person?

    You won’t see their posts and replies here any more. They aren’t told, and you can unblock them at any time.

    People you’ve blocked

    Their posts and replies are hidden from you. Unblock someone to see them again.

    The community rules

    A few rules keep this a friendly place. Everyone agrees to them once, before their first post.