Of course, to keep something like this old school it would all have to be done with knobs and sliders, so I figured the max amount of harmonics I could jam onto a semi portable box was 16. The problem with this however was accuracy of the finished wave.

I decided that I wouldnt mind the slight curvature of any large jumps in amplitude, but I would mind the Gibbs phenomenon screwing up those jumps as well. So i decided I would try and beat many years of mathematicions and figure out a harmonic synthesis technique without any ugly artifacts. I also thought about faster ways to do do such synthesis.

I finally arrived that instead of using additive synthesis on sine waves to combine harmonics, I might try a diffrenet basic wave, even more basic then sine, a square wave. At first, using square waves to synthesize a single cycle wave forms seemed riddiculous to me until I started experimenting with a piece of graph paper. I quickly thought about the basic non-square wave forms (saws, sines, triangles) and gave a shot at synthesizing them with only square waves. I soon found out that I was able to do both triangles and saws before it was time for my dinner reservation with added sqaure waves.

I got VERY excited by this for a few reasons. First of all, there were NO artifacts at the visible convergence point of the waves. Second of all, there were much simpler rules governing the behavior of the waves(e.g. the amplitude and frequency of consecutively added sqaures by n^2(n in iterations) creates a saw wave. The offset is left alone for a saw.). Also, digital square waves are much much faster to create than sines.

I have not however found an equivelent for the Fouier transform for this sqaure method which until I find renders this method virtually useless. But in the event that I do(which looks rather promising), I may be onto something very, very cool!

Heres a VERY basic example to help get the gist of what im talking about here, its missing many things but it shows how a saw wave is synthesized out of square waves:

Code: Select all

Const Length as integer = 64000

CONST Steps as integer = 13

CONST DivY as integer = 100

CONST DivX as integer = 100

function Sqd(x as integer, md as integer) as integer

Return (int(x/md) mod 2) * 2 - 1

end function

screenres 640,480,8

Dim as integer i, a, b, x, y, dx, dy, ox, oy

For x = 1 to Length

y = 0: a = 1

For i = 1 to Steps

y -= Sqd(x,a) * (a-1)

a *= 2

Next i

dx = x/DivX: dy = y/DivY+240

Line (ox,oy)-(dx,dy)

ox = dx: oy = dy

Next x

sleep

end