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.
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?!)
I'll just mention http://www.dspguide.com/ as a really fantastic resource - a free book aimed at scientists and engineers but so well written as to be easily accessible to the interested lay person.
A lot of the math-related articles on Wikipedia are terrible. When you look at the page for the Math project the FAQ basically says 'it's an encyclopaedia, not a textbook, go write on the talk page of individual articles.' The project managers seem hyper-defensive about it, in constrast to the comprehensive and inclusive approach of many other fields. The Wikibooks project is not much better (so far).
I find the Wolfram Mathematica pages more accessible for dealing with new concepts.
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.
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!
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 :)
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/ 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.
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".
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).
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.
You can do additive and additive-like synthesis with ZynAddSubFX, but instead of using per-harmonic envelopes and shift amounts, you can control the bandwidth and spacing of each harmonic.
To mimic an existing sound, such as an organ, I once used audio software to plot the FFT of the original sound, then manually entered the amplitudes of the fundamental and harmonics in a ZynAddSubFX XML instrument definition. I'd like something that automates that process.
Edit: regarding spectral manipulation, there is also SpectraLayers.
Back in my day, real men had to buy all these damn synths! My fave setup was to use additive synths for a lead, analog for the bass/strings/background texture, and fm for chunky mid ranges.. Worked really well... I kind of missing having all that crap.
You may be looking for an Analog synthesizer ( I can recommend the Arrick) or an FM synthesizer (like the DX11) which was based on Chowning's FM synthesis work at Stanford.
If you really want to create an arbitrary waveform (and I caution you that much of the timbre is in the attack and decay and harmonic filtering effects) the simplest way for non-engineers to do that is to use something like an Arduino with a Adafruit Waveshield and a scripted tool to generate .WAV files. The production path then is 'gen file, copy to SD card, stick in WaveShield and hit reset'.
Additive may not mean what you think it means perhaps? FM involves modulating the frequency of one oscillator with the value of another, whereas additive synthesis involves simply (lol) mixing multiple sinewave oscillators to generate a harmonic series.
Unless there is some more fundamental way in which they are equivalent, in which case I would be eager to learn more.
So I stand somewhat corrected, I had a memory of Chowning describing it as additive in his book "FM Theory & Applications" which I got with my TX11 but as it turns out he felt calling it additive was too simplistic as modulating a frequency is multiplicative. Each 'Op' however is added together to give the resulting tone. Now contrast that to my Arrick where I'll feed a square wave into a VCLF and peel the push filter out the harmonics over time to get a nice 'gong' sound which is definitely subtractive.
I did get a chance though to re-read chapter Chapter 3 "What is FM" and marvel at the relatively simple way it composes into very complex waveforms.
It's possible to calculate the exact frequencies that would be generated by FM synthesis and additively produce exactly those partials that are under Nyquist instead. IIRC, "alias-free" FM synthesis is the name of this technique when used to produce cleaner, band-limited waveforms.
Your post prompted me to get off my ass and upload my .WAV file writer to BitBucket. I wrote it almost two years ago to do exactly what you're talking about -- generate a waveform and learn how to design my own sounds. There are a lot of sophisticated synth tools out there already, but I wanted to start from first principles and really understand what I was doing.
It's stupidly simple C code -- you just need to use three functions: One to open a file for writing audio, one to write a stereo sample, and one to close the file performing cleanup and bookkeeping. I included two examples -- a really basic example to just create a sine wave, and a slightly more complicated one that creates a sine wave with a panning effect.
While I've written a lot of code before, it's rare for me to put code up as open source. So, if I've missed something important, please let me know.
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.
Yes! If you skip every other term you'll be going up by 2n.
I'm a bit rusty but going up by 2n (1n,2n,4n,6n...) gives you the even harmonics, the opposite (1n,3n,5n,7n...) gives you the odd harmonics. Old tube-amps are known for keeping the odd harmonics around, it's a "warmer" sound.