Jump to content

How do you make a square wave?

Featured Replies

Basically that, I know that there has to be some way to infinitely add types of sine waves so that they have the same period, but I don't really know how to do it, and websites arn't discrete enough for me.

Edited by questionposter

Basically that, I know that there has to be some way to infinitely add types of sine waves so that they have the same period, but I don't really know how to do it.

 

 

????????????

  • Author

????????????

 

On an oscillometer a square wave looks like a sine wave but with rectangles instead of parabolas.

 

It's the type of wave some synthesizers make, and there's a formula controller in the sound program I'm using so I want to make different types of waves from scratch.

Edited by questionposter

You don't infinitely add sine waves of the same period; you add many sine waves with different periods.

 

Wikipedia gives the Fourier series of a square wave -- the infinite series of sine waves you must add:

 

https://secure.wikimedia.org/wikipedia/en/wiki/Square_wave

 

Is there something about its description that's confusing?

  • Author

You don't infinitely add sine waves of the same period; you add many sine waves with different periods.

 

Wikipedia gives the Fourier series of a square wave -- the infinite series of sine waves you must add:

 

https://secure.wikim...iki/Square_wave

 

Is there something about its description that's confusing?

 

Well I guess the description makes sense, but the formula controller doesn't read a summation or limit symbols, I don't know how else to write it, I can't type infinitely and the program doesn't have infinite space.

Edited by questionposter

On an oscillometer a square wave looks like a sine wave but with rectangles instead of parabolas.

 

It's the type of wave some synthesizers make, and there's a formula controller in the sound program I'm using so I want to make different types of waves from scratch.

 

Sine waves do not have parabolas in them.

 

You can write down a Fourier series for a square wave, but the convergence is rather poor -- Google "Gibbs phenomena". There are more sophisticated summability methods that can provide better convergence (Google Cesaro summability) but they are more complicated.

 

In any synthesizer you will be limited to a finite number of sinusoidal components, so the wave generated will always be continuous, and in fact infinitely differentiable. You can't get a true square wave in that manner.

 

If your synthesizer uses square waves as the basic building blocks then you may be concerned with ways to generate arbitrary functions with trains of square waves -- Walsh functions. This involves the general theory of orthogonal functions and thus Hilbert spaces.

 

There is no simple "formula", but the general theory does not, at the most rudimentary level, require much more than calculus.

 

You might take a look at Fourier Series and Orthogonal Functions by Davis or Mathematical Methods in Engineering and Physics, Special Functions and Boundary Value Problems by Johnson and Johnson.

Well I guess the description makes sense, but the formula controller doesn't read a summation or limit symbols, I don't know how else to write it, I can't type infinitely and the program doesn't have infinite space.

Not knowing anything about your "formula controller", I can't really help here. You could approximate by adding up as many sine waves as you can, but you'd really have to learn how to use the system effectively to know the best method.

You can use a 555 timer to generate one. Google 555 astable multivibrator or oscillator for circuit ideas.

In any synthesizer you will be limited to a finite number of sinusoidal components, so the wave generated will always be continuous, and in fact infinitely differentiable. You can't get a true square wave in that manner.
You could approximate by adding up as many sine waves as you can, but you'd really have to learn how to use the system effectively to know the best method.
Practically speaking, a hundred sine waves will look an awful lot like an infinite amount. If you were to accurately describe a wave that was truly not a smooth function - then it wouldn't be able to accurately describe the behavior of a speaker's diaphragm, so it would be useless for a synthesizer.

If your formula controller has the floor or ceiling function you can play around with:

 

Floor:

 

[math]\lfloor \text{sin}(x) \rfloor[/math]

 

Ceiling:

 

[math]\lceil \text{sin}(x) \rceil[/math]

 

You will probably have to play around with the amplitude due to the way those functions trim decimals, but it might suit your purposes.

  • Author

For a simple, graphical illustration of what happens you could try this link. Within electronic circuits you can never get a perfect square wave. To achieve such a thing you would have to produce instantaneous changes of voltage. http://www.mathworks...b/xfourier.html

 

Yeah, I thought that would happen, but then again, maybe there's some way to use entanglement...

 

And Cap, it basically only uses basic symbols and parenthesis along with "sin" and probably a few other things, but it's weird because there are more advanced instruments on the program where all I do is turn a knob and a sine wave turns into some perfect square wave, and there's even an oscillatometer that supposedly reads perfect square waves when I play a pre-made square wave sound.

Archived

This topic is now archived and is closed to further replies.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.