View the source of the articles and you will find thousands of lines of readable HTML, handwritten JavaScript using canvas and WebGL, and handwritten audio manipulation using window.AudioContext. Similar stories for the author's other incredible articles.
It's hand-crafted WebGL with no frameworks, which is insane. If you View Source on the page, you'll see that the JS is readable because he doesn't minify at all.
I love the web audio API. I've been making a game where the theme is "I don't do art" so my assets are CSS, emojis, and manually made sounds using frequency and sinewaves and such.
The one lesson I learned the hard way is that if you run a full-volume sine wave long enough you can permanently destroy your laptop speakers.
Reminds me of Marcan trying to make Asahi not do that on MacBooks, and so far failing (https://github.com/AsahiLinux/linux/issues/53). I didn't know that Windows laptops also had speakers that would burn out with high-volume playback.
+1 for the recommendation for "The Scientist and Engineer's Guide to
Digital Signal Processing" by Steven W. Smith. I spoke to Steven many
years ago about his putting all of the book PDFs online for free and
since then have recommended at least 5 university libraries to buy it
because the students could get free copies of a great book that can be
referenced in the library.
FWIW the The Scientist and Engineer's Guide doesn't actually cover a
lot on sound. It starts in a particular DSP way with frequency domain
definitions and convolution - and I actually think Steven's background
is in medial imaging, though I could be mistaken.
pdfs are the chapters are available freely on that website, but if anyone wants to spare themselves the effort of combining them all into one for easier perusal, feel free to email me (in bio) and I can send the combined pdf. I'm currently around page 200, and it's been great as an introductory resource as someone with no other background in DSP.
Wow. Such a profound insight could not get published for 15 years because others couldn’t grasp it. Including Lagrange!
It’s an uncomfortable reminder of how essential reputation and credibility are in the machinery of science.
”The paper contained the controversial claim that any continuous periodic signal could be represented as the sum of properly chosen sinusoidal waves. Among the reviewers were two of history's most famous mathematicians, Joseph Louis Lagrange (1736-1813), and Pierre Simon de Laplace (1749-1827).
While Laplace and the other reviewers voted to publish the paper, Lagrange adamantly protested. For nearly 50 years, Lagrange had insisted that such an approach could not be used to represent signals with corners, i.e., discontinuous slopes, such as in square waves. The Institut de France bowed to the prestige of Lagrange, and rejected Fourier's work. It was only after Lagrange died that the paper was finally published, some 15 years later.“
> Lagrange had insisted that such an approach could not be used to represent signals with corners, i.e., discontinuous slopes, such as in square waves.
Isn't that true though? You can only approximate it, right?
In practice, yes you can only approximate it, because in theory it requires an infinite series of sinusoidal waves. But since maths is all about the theory, Laplace's objections were silly.
(though I admit I don't know what the state of acceptance of infinite series was at that time)
Also, it's fine to cut off the infinite series of sinusoidal waves because all physical systems cut off around a given frequency, for example human hearing around ~20kHz.
Also, in practice, there's no such thing as a truly sharp corner, which makes sense intuitively based on the math, I think. But real systems have inertia, friction, stray resistance/capacitance/inductance, etc. so you can't have a truly perfect square wave in a physical or electrical system in the real world.
Not quite, that's not the problem. We're in the realm of maths here and therefore of pure abstraction, so that's not the point. Adding terms to the Fourier series of a square wave you have an overshoot that does not converge to zero as the number of terms goes to infinity. This is called the Gibbs phenomenon https://en.wikipedia.org/wiki/Gibbs_phenomenon
In the same sense that a circle does not exist, because you can only approximate it with an arbitrary number of points/lines. But an infinite number of points the same distance from the origin is a good definition of a circle. In a similar way, an infinite set of sine waves approximating a square wave is a square wave, mathematically speaking.
Sort of. The error at a square wave's "cliff" does shrink in width as you add higher and higher frequencies to the approximation, but the height of the error does not diminish, so you have to be explicit about what you mean by "converge". If you considered MAX(ABS(approximation(x) - square(x))) as your error metric it would not go to zero even in the limit; for most intents and purposes we don't care about that, though, and in any case the limiting behavior is much nicer for "normal" functions that don't have discontinuities like a square wave.
Corners in signals are like limits in calculus or irrational numbers in arithmetic. Once you accept them as an abstraction that you can't touch them directly all the anxiety dissipates.
I have this conviction that I ought to be able to code up crude audio DSP processors before I understand the totality of the theory.
For example, every DFT/FFT explanation seems to start with complex numbers. I wish there was a resource that was programming focused, starting with "Step 1: Process this artificially created periodic signal by multiplying it by sine waves of frequencies from from 1 to N. There are our bins! Step 2: OK, for real world signals we need phase, so now let's talk about complex numbers."
I've been studying math for a while trying to build up the prerequisites for writing audio DSP code. I have this sneaking suspicion that at the end what I want to achieve won't be as hard as DSP resources imply. At least there will be parts that I could have done with hardly any theory at all. But because of the way these resources are written, I have to consume massive amounts of theory first.
(For background, I've worked as a mastering engineer and have done a fair amount of audio production, so I know intimately what the tools ought to do.)
> "Step 1: Process this artificially created periodic signal by multiplying it by sine waves of frequencies from from 1 to N. There are our bins! Step 2: OK, for real world signals we need phase, so now let's talk about complex numbers."
Maybe the latter part could be prepped by resynthesising the time-domain signal by summing the sines, and seeing that it doesn't match the original. And it can't, not least because all of the sines start at 0. But if you have cosines as well, it can. Then refer to the geometrical relationship between sine/cosine and phase.
A preliminary to the earlier part might be to multiply a single long sinusoid by another one, and see what happens when their frequencies do or don't match. (But there is a whole well here about what it means for frequencies to "match", which in the discrete world has to do with how long the relevant part of the signal is.)
I posted this as a submission a while ago but you might find it helpful. While learning about signal processing my self I built a collection of educational tools for visualizing some concepts. [1]
Especially the fourier cube [2], the complex exponential [3], the digital filter designer [4] and the signal generator [5] might be helpful.
Additionally the matrix multiplier [6] has an option for complex numbers that highlights the perspective that complex numbers can be seen as just a subset of 2x2 matrices.
Your intuition is right, in that most of the heavy math is simply unnecessary or irrelevant at the practical level. Complex number notation doesn't fall into that category, though. The notion of frequency is intimately tied to the notion of vector rotation, and just as you can't represent Cartesian translation without negative numbers, you can't represent Cartesian rotation without complex ones.
The Smith book is definitely for you; also check out Rick Lyons's books. Bo Pirkle and Julius O. Smith are good for audio-specific theory and applications.
Saying that you can't represent cartesian rotation without complex numbers seems a bit much? You do need two numbers. But you can teach a trigonometry class without complex numbers, using either cartesian coordinates or polar notation. And matrices do work.
I once found one article that started with the concept of "probing" with a test signal, and then you need to probe with both sine and cosine to reconstruct the phase. Complex numbers seem to be a neat mathematical notation for this sin/cos pair.
I'm actually reading through it right now after trying out a few other DSP resources. It is by far the clearest and most approachable, without sacrificing much depth at all. It's a great book.
It's the best. I learned DSP from that ~20 years ago and still use those mental models whenever I need to think through a problem. A good book like that is a friend for life.
I'd really like to learn to do what he does. It's always so impressive, clear, concise and comprehensive. I feel like everything he does is a perfect pedagogical modality. I just wish everyone could get on board, especially university professors and publishers.
I love how every Ciechanowski post starts explaining from the very basics, but makes things so beautifully explained that my 10s attention span magically extends up to the way where I can learn a lot.
The three keys piano at the beginning is so responsive and nice that I was stuck playing with it for 5 minutes, that's how you hook someone to read an article
I love it when I'm halfway through something and take a second to pause and wonder why someone put so much effort into it, and them I appreciate that they did. This is amazing.
One thing that surprised me the first time I learned it is how 'dense' air is under normal circumstances. The 'mean free path' is the mean distance that a particle travels before changing velocity (typ due to collision). The mean free path of atmospheric air at standard pressure is ~65 nanometers, with ~2x10^19 (20 billion billion) molecules per cubic centimeter experiencing about 10^33 collisions per second. This is roughly the volume of an adult's ear canal.
Whilst I imagine he'd produce content regardless of income, he does have a slightly successful Patreon. To encourage this effort, consider supporting him in some form, if you don't.
I was able to reach 10^-7 mbar with a good vacuum system and I though I would have few thousand molecules, turns out there is a billion (10^9) molecules per cubic centimeter at that vacuum level.
And yet somehow, as far as we know, the energy of every molecular collision is faithfully preserved during a supernova, when effectively the entire volume of a star collapses into its core in less then a second.
That's not accurate. Only the inner core collapses (hence the "core-collapse supernova"; there are also other types), the rest rebounds, is heated up by core-produced neutrinos, and gets ejected. The Wikipedia article is a good start, also there are plenty of good papers on arxiv (e.g. on still-not-too-successful numerical modeling of the aforementioned "heating", without which the thing simply doesn't go bang).
Hmm, on Windows 10 Chrome/Firefox the demos with the movable ears don't work very well when the position changes. Both browsers output horrible audio in those sections.
edit: If I limit Firefox to 60fps (down from my display's 280hz) then it seems to work fine.
They way he is able to explain complex subjects by starting from first principles, gently adding more and more layers, with beautiful, custom-made figures and animations is truly, literally, awesome.
I strongly recommend supporting the author via his Patreon if you enjoy his blog posts.
The article on mechanical watches had so much depth and such good explanations I thought he was a mechanical watch engineer or enthusiast who happened to also have web design, 3d animation, and writing skills
He does :) hope he doesn't mind me sharing from his Patreon:
> I myself don't even own any traditional watches, so the topic was very new to me. Thankfully, it was easy to understand the gist of how mechanical watches work just from watching some YouTube videos and I decided to give the topic a go.
If you subscribe -- you should subscribe!! -- you can read his "making of" posts which are also fascinating. I don't think he's a domain expert in anything he's written about, he just does a ton of research and only produces a few articles per year.
He has an commentary article on Patreon where he says he doesn't even own any traditional watches, and had to buy a movement to take apart and understand
These are amazing - from the design to the interactive demos to the writing. I think "digital monograph" is almost a more apt description than "blog post". I've written tons of blog posts and they have almost nothing in common with what he's doing. 8,000 well written words plus formatting and links plus 50 or so embedded demos is really an astounding amount of work. What I appreciate most is the use of the medium itself. Imagine if the standard format for academic papers was updated from the black and white two-column format used for a half century to something like this?
This is how school must be. I'd rather pay people like him to create interactive content than pay the school to teach my kids useless material in dry, rigid ways.
221 comments
[ 3.1 ms ] story [ 227 ms ] threadhttps://ciechanow.ski/archives/
Seeing there's a new Bartosz Ciechanowski explainer might be my one exception to this rule.
A link to all the HN submissions from ciechanow.ski
The one lesson I learned the hard way is that if you run a full-volume sine wave long enough you can permanently destroy your laptop speakers.
Don't hold your breath. It'll be rudimentary. I'm making it for my own joy and learning, but will probably publish it by EOY.
Minutes? Hours?
I never repeated the experiment. Maybe my laptop was a dud or something.
Amazing content as always otherwise.
:facepalm
No one knows for sure, one of the true mysteries of the universe.
I checked system audio settings and see nothing muted.
FWIW the The Scientist and Engineer's Guide doesn't actually cover a lot on sound. It starts in a particular DSP way with frequency domain definitions and convolution - and I actually think Steven's background is in medial imaging, though I could be mistaken.
[1] https://www.analog.com/en/education/education-library/scient... [2] https://www.analog.com/media/en/technical-documentation/dsp-...
It’s an uncomfortable reminder of how essential reputation and credibility are in the machinery of science.
”The paper contained the controversial claim that any continuous periodic signal could be represented as the sum of properly chosen sinusoidal waves. Among the reviewers were two of history's most famous mathematicians, Joseph Louis Lagrange (1736-1813), and Pierre Simon de Laplace (1749-1827). While Laplace and the other reviewers voted to publish the paper, Lagrange adamantly protested. For nearly 50 years, Lagrange had insisted that such an approach could not be used to represent signals with corners, i.e., discontinuous slopes, such as in square waves. The Institut de France bowed to the prestige of Lagrange, and rejected Fourier's work. It was only after Lagrange died that the paper was finally published, some 15 years later.“
from chapter 8 http://www.dspguide.com/ch8/1.htm
Isn't that true though? You can only approximate it, right?
Also, it's fine to cut off the infinite series of sinusoidal waves because all physical systems cut off around a given frequency, for example human hearing around ~20kHz.
For example, every DFT/FFT explanation seems to start with complex numbers. I wish there was a resource that was programming focused, starting with "Step 1: Process this artificially created periodic signal by multiplying it by sine waves of frequencies from from 1 to N. There are our bins! Step 2: OK, for real world signals we need phase, so now let's talk about complex numbers."
I've been studying math for a while trying to build up the prerequisites for writing audio DSP code. I have this sneaking suspicion that at the end what I want to achieve won't be as hard as DSP resources imply. At least there will be parts that I could have done with hardly any theory at all. But because of the way these resources are written, I have to consume massive amounts of theory first.
(For background, I've worked as a mastering engineer and have done a fair amount of audio production, so I know intimately what the tools ought to do.)
https://observablehq.com/collection/@skybrian/digital-signal...
Maybe the latter part could be prepped by resynthesising the time-domain signal by summing the sines, and seeing that it doesn't match the original. And it can't, not least because all of the sines start at 0. But if you have cosines as well, it can. Then refer to the geometrical relationship between sine/cosine and phase.
A preliminary to the earlier part might be to multiply a single long sinusoid by another one, and see what happens when their frequencies do or don't match. (But there is a whole well here about what it means for frequencies to "match", which in the discrete world has to do with how long the relevant part of the signal is.)
Especially the fourier cube [2], the complex exponential [3], the digital filter designer [4] and the signal generator [5] might be helpful.
Additionally the matrix multiplier [6] has an option for complex numbers that highlights the perspective that complex numbers can be seen as just a subset of 2x2 matrices.
[1]: https://tools.laszlokorte.de/ [2]: https://static.laszlokorte.de/fourier/ [3]: https://static.laszlokorte.de/complex-exponential/ [4]: https://static.laszlokorte.de/signal-transform/ [5]: https://static.laszlokorte.de/signal-generator/ [6]: https://static.laszlokorte.de/matrix-multiplication/
The Smith book is definitely for you; also check out Rick Lyons's books. Bo Pirkle and Julius O. Smith are good for audio-specific theory and applications.
One thing that surprised me the first time I learned it is how 'dense' air is under normal circumstances. The 'mean free path' is the mean distance that a particle travels before changing velocity (typ due to collision). The mean free path of atmospheric air at standard pressure is ~65 nanometers, with ~2x10^19 (20 billion billion) molecules per cubic centimeter experiencing about 10^33 collisions per second. This is roughly the volume of an adult's ear canal.
Reality is very strange.
This is the type of blog I aspire to make, one day
edit: If I limit Firefox to 60fps (down from my display's 280hz) then it seems to work fine.
They way he is able to explain complex subjects by starting from first principles, gently adding more and more layers, with beautiful, custom-made figures and animations is truly, literally, awesome.
I strongly recommend supporting the author via his Patreon if you enjoy his blog posts.
> I myself don't even own any traditional watches, so the topic was very new to me. Thankfully, it was easy to understand the gist of how mechanical watches work just from watching some YouTube videos and I decided to give the topic a go.
If you subscribe -- you should subscribe!! -- you can read his "making of" posts which are also fascinating. I don't think he's a domain expert in anything he's written about, he just does a ton of research and only produces a few articles per year.