Jump to content

How do you make a square wave?


questionposter

Recommended Posts

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

 

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
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

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.