
Fourier Toy - alxndr
http://toxicdump.org/stuff/FourierToy.swf
======
hcarvalhoalves
Try the Fibonacci sequence:

0.01, 0.01, 0.02, 0.03, 0.05, 0.08, 0.13, 0.21

It generates a beautiful wave [1].

There's also this interesting property that you can use any part of the
sequence, and it will be the same wave [2].

[1]
[https://www.dropbox.com/s/89fg14dvsi3wuox/Captura%20de%20tel...](https://www.dropbox.com/s/89fg14dvsi3wuox/Captura%20de%20tela%202013-11-06%2020.20.29.png)

[2]
[https://www.dropbox.com/s/yu05xs10tauumgu/Captura%20de%20tel...](https://www.dropbox.com/s/yu05xs10tauumgu/Captura%20de%20tela%202013-11-06%2020.32.30.png)

~~~
dnautics
what phases did you use?

~~~
hcarvalhoalves
All in phase.

~~~
arkj
how do you set all in phase?

~~~
pshc
Align all the blue lines inside each circle, hold shift and drag.

------
wting
This article and related commentary are relevant:

[http://nautil.us/blog/the-math-trick-behind-mp3s-jpegs-
and-h...](http://nautil.us/blog/the-math-trick-behind-mp3s-jpegs-and-homer-
simpsons-face)

[https://news.ycombinator.com/item?id=6683866](https://news.ycombinator.com/item?id=6683866)

In fact, it looks like Lucas Viera may have used that blog post as
inspiration.

~~~
anigbrowl
I think you're being downvoted because anyone who is interested in DSP already
knows about Fourier transforms, they're fundamental and quite well known.
Frankly, I'm surprised to find that they're new to so many HN readers.

~~~
mschuster91
Fundamental if you ever finished a CS degree. Shamefully, the Wikipedia
articles (German and English) aren't really good, and I dropped out of
university before FFT was a topic.

Lots of HN readers are self-thaught hackers or come from non-theoretic
backgrounds... so they likely won't have had a good explanation of it.
(Speaking of which, the circle analogy is truly awesome - but how does it work
in code?!)

~~~
gotofritz
It's more of an electronic engineering thing than CS

~~~
Osmium
In fairness, it's more of an _everything_ thing. You won't get far in any
science without hitting a Fourier transform somewhere!

~~~
gbog
Yes, and in music too. When I worked as intern at IRCAM FFT was a big deal,
and was the only part of the code we weren't allowed to checkout.

------
jmpe
I learned about Fourier this way from an old "American Scientist" book. The
writer had a very powerful remark at the end. He explained how Ptolemeus first
used epicycles as a base model to explain planetary motion [edit: their
paths]. The criticism that led to the demise of this model was basically
"yeah, well, you can make planets have square paths this way". If someone
connected the dots at that point we could have had Fourier transform a couple
of hundred years earlier. Maybe we did, but the documents disappeared.

------
205guy
Right-click the page for some pre-defined wave patterns (pulse, sawtooth,
triangle, etc.)--at least it worked for me in FF.

------
fit2rule
Beautiful .. has my 6 year old entranced. You know what he said, though? "This
thing needs sound." I'm proud of him. :)

------
ryanthejuggler
This is really awesome. First thing I did was try a sawtooth wave by entering
sequential powers of 0.5... this had the intended effect of creating a
sawtooth wave, but also the circle diagram was tracing an almost perfect
circle in 2D. Really cool for discovering things like that!

------
TheMakeA
These guys are one of the reasons I love mathematics.

Check this out too:
[http://www.youtube.com/watch?v=QVuU2YCwHjw](http://www.youtube.com/watch?v=QVuU2YCwHjw)

Edit: Didn't realize that this was also linked to in another thread on the
front page as well.

------
joshguthrie
Anybody got the sequence to draw Homer's head?

Reminder:
[http://www.youtube.com/watch?v=QVuU2YCwHjw](http://www.youtube.com/watch?v=QVuU2YCwHjw)

------
zoba
This is very cool and reminds me of something I've wanted for a long time: a
tool like this that is used to make sound. The synthesizers I've used seem
predisposed to making a certain type of sound, however, something like but
which gives you complete control of the wave form, should give you complete
freedom when creating sounds. Maybe I've been looking at the wrong synths...
Neat though :)

~~~
anigbrowl
What you want is an _additive synthesizer_. Usually these contain a lot of
fairly high level 'helpers' rather than control over every individual sine
wave, because while 8 sine waves are fun to play with full sound sculpting
requires more, and applying envelopes, LFOs and other modulation sources to 64
(or 128 or 356 or 512...) sine waves rapidly becomes tedious.

You could easily make one with (or download a premade one for) _Reaktor_ or
_Synthmaker_ (now called _Flowstone DSP_ ) or _Max /MSP_. _Kyma_ is another
system for doing so, but very expensive as it's hardware based. _Pd_ /
_Puredata_ is free, albeit ugly. Various plugins exist, from VSTi's to rack
extensions for Propellerheads' _Reason_. If you're feeling brave/patient and
you want to do it in a hardware instrument, then you can get hold of a _Kawai
K5000_ for only a few hundred $. If you're code-inclined (ugh* ) then try
_Supercollider_ or _Csound_. A related but slightly orthogonal techniques is
spectral manipulation using tools such as _Metasynth_ (Mac, $$$) or _Coagula_
(Win, free). Neither of these latter two have seen an update for a long, time,
reflecting the general lack of popularity of this technique.

(All these _Italicized words_ are well-known product names, BTW that should
come at or near the top in any search engine)

Also, check out [http://amaranthaudio.com/](http://amaranthaudio.com/) for
Cycle which is new and impressive, though a bit clunky last time I checked.
I'm hardware based but this is the first instrument I've seen in a while that
could draw me back to the PC. I'm sure there's a bunch of iPad apps too, but
not having an iPad I only check that platform occasionally.

Additive synthesis is a lot of fun but because there are so many harmonics to
play with it's very easy to go astray and end up making clangorous noises that
are not particularly musical or natural sounding; of course this makes them an
automatic go-to for sci-fi noises, but the problem is that everything sounds
unnatural in much the same way, if you see what I mean - the brain says 'ah,
that's a very unnatural arrangement of harmonics' and gives up for all but the
simpllest cases, much as it decides that poorly-designed FM sounds are quite
noisy or that distorted sounds certainly involve a lot of clipping. It's still
interesting territory for any sound nerd to explore, but don't expect m/any of
your friends/loved ones to share your enthusiasm for such esoteric timbres.

* writing code is a rather masochistic approach to producing sounds IME.

~~~
squidfood
I'll add SynthEdit, because the demo version is fully-featured, intuitive,
standalone and free.

If you just want to do it by numbers without interface, and get as
mathematically crazy as you like, R has some simple "turn a timeseries to a
wav file" libraries.

Also to add: quite a few ipad apps that let you sketch in either a wave form
or a spectrum, then turn knobs on it like a synth. Addictive Synth is one that
lets you draw spectra freehand; WaveGenerator lets you put in various surfaces
or even pictures and "listen" to them. This specific method is called
"Wavetable Synthesis".

~~~
anigbrowl
Just FYI editing the spectra is usually referred to spectral or additive
sysnthesis.

Wavetable synthesis involves a table of single-cycle waveforms that you then
sweep through, either manually or preferably with some sort of modulation
source. The PPG Wave is the most famous case, and Ensoniq's Transwave
technology was basically the same thing. Typically you'll start with 2 waves
of completely different harmonic spectra and interpolate between them. IIRC
there's a quite affordable PPG wave for iPad now from Wolfgang Palm (who is
the authority on this method of synthesis).

~~~
squidfood
I was forgetting for a moment the key part of wavetable was the
sweep/interpolation. Silly me! The name of the Wolfgang Palm App is the
Wavegenerator I mentioned above -- been playing with it a while, v. v. cool,
but (as per your original comment) I can't stray to far from presets without
sounding horribly metallic.

------
mw67
Just read that he was an orphan at age 9 and then made governor of lower Egypt
at age 30 by Napoleon, what a life!

[http://en.wikipedia.org/wiki/Joseph_Fourier](http://en.wikipedia.org/wiki/Joseph_Fourier)

~~~
gbog
And he tutored Champollion at age of 11!

------
stared
Such Fourier decomposition for an interactive quantum simulation:

[http://www.falstad.com/qm1d/](http://www.falstad.com/qm1d/)

(A rare piece of software not getting older with time; and in general, other
Falstad's simulations are great, especially Ripple Tank for optical
interference and electric circuits.)

~~~
csmuk
nice. The circuit simulator is wonderful - have used it for years. In fact I
actually tried to port it to .Net but never finished it.

~~~
stared
I would love to see such things rewritten to JS. And it does not sounds
strange, as there are some applications based on Falstad's code, e.g.
[http://icircuitapp.com/](http://icircuitapp.com/).

------
rjgray
Wow! So cool. I love the connection between the waveform and the trochoid
curve on the left.

------
Fingel
Very nice overview of fourier transforms:
[http://betterexplained.com/articles/an-interactive-guide-
to-...](http://betterexplained.com/articles/an-interactive-guide-to-the-
fourier-transform/)

------
zackkitzmiller
Very much reminds me of the Spirograph I had when I was a young.

[http://en.wikipedia.org/wiki/Spirograph](http://en.wikipedia.org/wiki/Spirograph)

------
gshubert17
I'd like to be able to make a triangle wave, but I think the program needs to
be able to input negative values for the components.

Nicely done.

~~~
tjohns
There's a triangle wave preset already available. Right click on the page to
select it. It uses values: 0.75, 0, 0.083, 0, 0.03, 0, 0.015, 0

~~~
gshubert17
Very helpful - thanks.

~~~
clebio
It uses the phase. The 0.75 is 180 deg out of phase (blue line of circle
points to the left) compared to the 0.083. Compare to the square wave, as
well.

------
backprojection
This is a really nice demo, but note that it's not the full Fourier series.
This is only the 'sine' contribution. I'm not sure how you could expand the
animation to include cosine as well.

~~~
daraul
Cosine can be approximated by rotating the sine phase 90 degrees.

------
Serow225
It would be cool if someone created the inverse of this, where you could input
a signal (audio) and have it show the fft decomposition circles moving around
in real time :)

~~~
spydum
Isn't that approximately every Winamp visualization plugin ever created?

~~~
dualogy
You sure dem younguns ever heard of Winamp?

------
oftenwrong
Doesn't work in Shumway yet.

~~~
leeoniya
and probably won't for some time without an official bug report ;)

[https://github.com/mozilla/shumway/issues](https://github.com/mozilla/shumway/issues)

~~~
ZeroGravitas
Though perhaps a canvas rewrite would be better?

------
DonGateley
Brilliant! But where's the algebra of complex numbers. :-)

------
agumonkey
I'd love this as an OS boot time animation.

------
benched
What determines the time/speed of each circle?

~~~
chengsun
The nth circle from the right is n times the speed of the first circle.

~~~
jonahx
Why is this? Could you make it work using, say, 2n instead of n? or n^2
instead of n?

~~~
nitrogen
The definition of the Fourier series is an infinite series of integer
frequency multiples adding up to reproduce any periodic signal, sort of like
how the Taylor series can additively reproduce a function.

[https://en.wikipedia.org/wiki/Fourier_series](https://en.wikipedia.org/wiki/Fourier_series)

