# A simple-to-use sound file writer

Alf P. Steinbach alfps at start.no
Sat Jan 16 07:26:08 CET 2010

```* Grant Edwards:
> On 2010-01-15, Steve Holden <steve at holdenweb.com> wrote:
>
>> I will, however, observe that your definition of a square wave is what I
>> would have to call a "'square' wave" (and would prefer to call a "pulse
>> train"), as I envisage a square wave as a waveform having a 50% duty
>> cycle, as in
>>
>>  ___     ___
>> |   |   |   |
>> |   |   |   |
>> |   |   |   |
>> +---+---+---+---+ and so on ad infinitum, (though I might allow you
>>     |   |   |   |                          to adjust the position
>>     |   |   |   |                          of y=0 if you want)
>>     |___|   |___|
>
> That is a square wave.
>
>> as opposed to your
>>
>>          _
>>         | |
>>         | |
>>   ______| |______   ______
>>                  | |
>>                  | |
>>                  |_|
>
> That isn't.
>
> Arguing to the contrary is just being Humpty Dumpty...

Neither I nor Steve has called that latter wave a square wave.

Steve, quoted above, has written that I defined a square wave that way. I have
not. So Steve's statement is a misrepresentation (I described it as a sum of two
square waves, which it is), whatever the reason for that misrepresentation.

>> Or, best of all, you could show me how to synthesize any
>> waveform by adding square waves with a 50% duty cycle.  Then I
>> *will* be impressed.
>
> Isn't that what he claimed?  He said that his algorithm for
> summing square waves demonstrated the converse of the ability
> to construct a periodic function (like a square wave) from a
> sine-cosine summation.

Not by itself, no: it just synthesizes a sine.

For information about what the algorithm does, what you refer to as a "claim"
(but note that a Python implementation has been posted to this thread, and that
it works, and that besides the algorithm is trivial so that "claim" is a rather
meaningless word here), read the article that you then responded to.

Cheers & hth.,

- Alf

```