8 ms·
Fourier Toy
- zoba 13y agoThis 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 :)
- gosub 13y agoTry pure data. You can fill a table (an array) with whatever function you like, and then use the tabosc4~ object to generate a signal with that as the waveform of a single cycle.
- anigbrowl 13y agoWhat 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 13y agoI'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 13y agoOh good catch, I had forgotten about that. Good product, but their website really, really needs an overhaul. I should also have mentioned that Mathematica makes this sort of thing quite accessible as well, and if you can't afford it or are just a hobbyist they are pretty liberal with their student licensing. http://reference.wolfram.com/mathematica/guide/SoundAndSonification.html http://reference.wolfram.com/mathematica/guide/SoundAndSonif...
- anigbrowl 13y agoJust 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 13y agoI 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.
- ChuckMcM 13y agoYou 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'.
- jmmcd 13y agoGP wants additive synthesis, not subtractive or FM. As for copying a file to an Arduino... you know you can play wav files on your computer right?
- ChuckMcM 13y agoFM synthesis is additive, and it's a fair point you can play .wav files directly on your machine. I have been tying them to external events which was a bit more difficult.
- JonnieCache 13y agoAdditive 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.
- nitrogen 13y agoIt'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.
- Figs 13y agoYour 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. Here's a link to the library: https://bitbucket.org/cmcfarla/waveout https://bitbucket.org/cmcfarla/waveout 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.
- ryanthejuggler 13y agoThis 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!
- deleted 13y ago[deleted]
- gshubert17 13y agoI'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.
- anigbrowl 13y agoYes, that was the only thing I was missing. I'm tempted to adapt this UI though, it's lovely design.
- tjohns 13y agoThere'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 13y agoVery helpful - thanks.
- clebio 13y agoIt 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.
- chengsun 13y agoYou can change the phase by holding ctrl-shift and dragging the circle. If you want a negative value just use the absolute magnitude with the component in antiphase.
- 205guy 13y agoRight-click the page for some pre-defined wave patterns (pulse, sawtooth, triangle, etc.)--at least it worked for me in FF.
- rjgray 13y agoWow! So cool. I love the connection between the waveform and the trochoid curve on the left.
- hcarvalhoalves 13y agoTry 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%20tela%202013-11-06%2020.20.29.png https://www.dropbox.com/s/89fg14dvsi3wuox/Captura%20de%20tel... [2] https://www.dropbox.com/s/yu05xs10tauumgu/Captura%20de%20tela%202013-11-06%2020.32.30.png https://www.dropbox.com/s/yu05xs10tauumgu/Captura%20de%20tel...
- dnautics 13y agowhat phases did you use?
- hcarvalhoalves 13y agoAll in phase.
- kylebrown 13y agoHit enter in each parameter box to update it
- aadsam 13y agoWell, it won't be the exact same wave, but it approaches the same wave. It's because the ratio between consecutive numbers in the Fibonacci sequence approaches phi.
- zzleeper 13y ago
- wting 13y agoThis article and related commentary are relevant: http://nautil.us/blog/the-math-trick-behind-mp3s-jpegs-and-homer-simpsons-face http://nautil.us/blog/the-math-trick-behind-mp3s-jpegs-and-h... 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 13y agoI 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 13y agoFundamental 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?!)
- lucian1900 13y agoAnd not necessarily if you did finish a CS degree. I was never taught about them, apparently only electronics/signal processing folks were at my uni.
- gotofritz 13y agoIt's more of an electronic engineering thing than CS
- Osmium 13y agoIn fairness, it's more of an everything thing. You won't get far in any science without hitting a Fourier transform somewhere!
- zackkitzmiller 13y agoVery 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
- TheMakeA 13y agoThese 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.
- benched 13y agoWhat determines the time/speed of each circle?
- chengsun 13y agoThe nth circle from the right is n times the speed of the first circle.
- jonahx 13y agoWhy is this? Could you make it work using, say, 2n instead of n? or n^2 instead of n?
- nitrogen 13y agoThe 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
- stolio 13y agoYes! 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. edit: fixed the series
- nilkn 13y agoThat would be the same as this, actually. (For 2n, leave odd terms blank. Etc.)
- oftenwrong 13y agoDoesn't work in Shumway yet.
- leeoniya 13y agoand probably won't for some time without an official bug report ;) https://github.com/mozilla/shumway/issues https://github.com/mozilla/shumway/issues
- ZeroGravitas 13y agoThough perhaps a canvas rewrite would be better?
- joshguthrie 13y agoAnybody got the sequence to draw Homer's head? Reminder: http://www.youtube.com/watch?v=QVuU2YCwHjw http://www.youtube.com/watch?v=QVuU2YCwHjw
- Serow225 13y agoIt 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 :)
- kaitian521 13y agobeautiful wave~~~
- Fingel 13y agoVery nice overview of fourier transforms: http://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ http://betterexplained.com/articles/an-interactive-guide-to-...
- fit2rule 13y agoBeautiful .. has my 6 year old entranced. You know what he said, though? "This thing needs sound." I'm proud of him. :)
- jmpe 13y agoI 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.
- agumonkey 13y agoI'd love this as an OS boot time animation.
- stared 13y agoSuch 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 13y agonice. 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 13y agoI 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/.
- mw67 13y agoJust 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 13y agoAnd he tutored Champollion at age of 11!
- backprojection 13y agoThis 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 13y agoCosine can be approximated by rotating the sine phase 90 degrees.
- DonGateley 13y agoBrilliant! But where's the algebra of complex numbers. :-)