as for the 100k waves signal being indistinguishable from the original, you could subtract it from the original in an audio editor and listen to the difference
The ''person that talk about something with nice visual and get you invested no mater what the subject is'' got to be my favorite RUclips genre. Edit : mom I'm famous
@@tomnewsom9124 just realizing I've seen plenty of her videos and never actually subscribe because RUclips just kept recommending them, I'm'a correct that right now.
9:07 I think that's a very accurate simulation of microphones used in aviation. Pilots always sound like that somehow. But for the simulation at least I see two very easy ways in that it could be improved: 1. Instead of a rectangle for the speaker, try to use a bowl or cone shape instead. Currently the sound waves are very unfocused and are getting dispersed too quickly. 2. More space. Due to the very limited space in the simulation, the waves are reflected from the walls and begin bounding around, causing a ton of interference. The microphone very quickly begins to swim in a soup of noise. This would also be part of why adding more simulation steps helped so much: it gave the noise time to settle. Obviously, simply simulating more space would also mean you'd need a lot more particles, but there's also a very simple way to fake it. Instead of letting particles get reflected by the outer walls, you could simply remove them from the simulation and spawn in new particles in low-density areas around the walls, essentially simulating air leaving and rushing into the volume from outside. Alternatively, and visually more interesting, you could try adding ripple shapes around the walls to work as noise dispersion. But I also get that this wasn't the main focus of the video and I probably already put too much thought into it. But maybe it'll help if you were intending to make a full version of "Bad Apple, but the audio is a fluid simulation too". The part on the DFT was great and I'm looking forward to the video on the FFT. Also: Yay, cat. Very cute.
I also seen an issue in the speed of the speaker. Based on the speed that sound waves propagate, it seems to be supersonic... No real-life speaker moves that fast, so I can't say exactly *what* effect it would have on audio quality, but I feel that it can't be good.
@@erictheepic5019 piling onto this critique, the speaker driver has mass and the voice coil should need to accelerate and decelerate the driver. There was also a lot of reflected interference from sound bouncing off the walls. So depending on the type of microphone, the recorded sound isn't necessarily just the voltage. And when driving the speaker the voltage isn't just an absolute position of the cone. The microphone must compensate for those raw voltages to define the actual waveform, but similarly the circuit driving the speaker needs to compensate for the physical properties. Assuming that the microphone is making those calculations itself, Sebastian really just needs to adjust the speaker design so that there are different drivers which are tailored to operate in notched filtered frequencies which aren't as affected by trying to accelerate the speaker cone outside their range. This is easiest to accomplish with a sub, a mid range, and a tweet, working together. Baffling on the walls should absorb any sound pressure and impart no reflected resonance. The software mic would need to have a gain amplified to pick up the reduced audio sound and normalize the volume again. I'd be real curious how this sort of processing would affect audio fingerprinting as the sampled audio would not match the original anymore from a binary perspective, and having the different speaker positions offset would affect the phasing at different frequencies. Passing it through the transform again, I expect that the same frequencies are found again even though the raw data would look indistinguishable.
@@timschulz9563that was my instinctive thought because the visualisation makes it look like it's using finite element method or similar but if the simulation is based on particles moving around a region then removing particles is going to mess things up.
i love that most of coding adventures these days feels like reinventing the wheel, for the purposes of determining the actual principles behind why a wheel and how the wheel works. not necessarily to build a BETTER wheel, but just because you're curious about wheels and how they work.
Yes indeed. I have researched the Fast Fourier Transform myself a year ago, written my own simple implementation for learning purposes. Learned about complex numbers before it was even taught in math class!
These coding adventures always excite me and at the same time reignite my imposter syndrome when I realize that I couldn't be farther from making any of these on my own without a ready solution
Sometimes it's just a matter of giving yourself time to think about the problem and read through the theory. These videos are awesome but they hide most of the actual work behind the scene required to pull them off
@@uhrguhrguhrg not most of his coding adventures though, you'd need to be pretty good at math to do these, and I'm just not. It's not easy to learn math at all, and so far I've failed miserably each time I tried to do so, but I keep trying.
@@kurushimeeMaths itself is not the difficult part (usually). It's just not very accessible because there often aren't many resources to give people without an aptitude towards abstraction a good grip on the concepts. With that said, these resources and ideas do exist: They are what makes 3blue1brown, etc. successful. You're not bad at maths, you can do it! It's that you are trying to rebuild centuries of experience, experimentation and research from nothing in a few hours or days. You can do it! Many times have I heard that people don't understand a topic until someday they hear somebody explain it in whacky way and it just clicks for them.
@@kurushimee then make small projects about the math you're learning. You can't just bash your head against theory, practice is also required to understand things.
Fortunately, the field of programming is vast enough that there is enough room for EVERYONE to be a bad programmer. So equal footing as long as you are legitimately trying.
The thing with this kind of content is, despite him hinting at it (which is great already), you just can't see the hours and hours of failing and trying to understand what's wrong. It seems so easy watching him do it, but really i have no doubt there was painful work here, he's smart for sure, but his "can do" attitude certainly does more of the work than pure brain power.
@@GabrielPettier Absolutely. This is the edited shots of all his SUCCESS. Not the hours of hair pulling "I'm an idiot, why isn't this working. Dang it, I freaking missed a SPACE in the variable?"
I love the confluence of 3b1b and Sebastian. Please let these two collaborate in the future! They are both so very good at visualizing the learning process. I feel like either of them could give a masterclass on effective visual communication, so I would love to hear the two of them talking about what they've learned.
I'm currently working on implementing a sound engine in a project I'm making. I can not get it to work at all and literally said to myself *"Man, why can't there be a Sebastian Lague video about fourier transforms. That would make my job so easy!"* Thanks for literally saving my project!
This world is full of people that are insanely smart. But being this smart and also so great at communicating/teaching is a feat even many professors do not achieve. I take my hat off to you
"In today's episode of Coding Adventures, Sebastian proves that you can speak German by just speaking in English backwards!" Love your videos! They remind me why I wanted to get into coding!
When I was playing with reversing speech years ago, I observed the reversed audio sounded Scandinavian, so I recorded myself saying that and learned that backwards the word Scandinavian sounds like "naervindanahks"
Seeing the 3b1b DFT visualization animated with tunable parameters was absolutely beautiful! Also, as someone who has been working with Fourier transforms for many years now, it's very nice to see someone going through the process of gaining an intuition for how sample duration and sampling frequency affect the frequency domain resolution. Thank you so much for sharing some of the beauty that's hidden behind maths!
Dude, the way you explain things is admirable. Natural teacher. For those of us that struggle with numbers, you make understanding possible. Showed my son your explanation of sin and cos and he was like "now I get it", and that sir is invaluable. Thank you for the excellent videos.
25 years ago I cried tears of blood at the university while learning about discrete Fourrier transformation and Nyqist-Shanon theorem. And now, look at me, I enjoy watching a video talking about this :D
i remember when after 16 years, a human being accidentally let me see fft(log10(fft())) i was so pissed it took me three fing years to touch it and then they have the nerve to microwave me when i'm in bed. they're a bunch of guys who wear aprons.
@@atomictraveller I feel like this is some sort of deep joke where the fast fourier transform is used to look like boobs or something. Maybe I don't get the joke though.
@@Alexander_Grant that short expression there is the cepstrum. that's all the notation i saw and all it needs. if you use fft some, you can infer the log10 applies to the mag bins to nyquist same as you would for a graphic readout. then you fft those and you have the cepstrum. now you can do formant shifting and higher level spectral ops like that. that's 16 years of car chases and fist fights and plane crashes into a burning lake of dog farts.
The reflections from the boundaries of the simulation box at 9:30 were probably affecting the sound quality a lot. In electromagnetics, people use absorbers or perfectly matched layers (PMLs) at the boundaries to remedy this issue.
It's absolutely insane the amount of effort that goes into these videos. I really liked the final showcase of only using the X most "important" frequencies, it's impressive how many different frequencies human speech makes/requires.
to be fair, the demonstration is a bit deceptive. because Sebastian's voice is not some repeating signal, the highest amplitude frequencies are background noise, and then the algorithm has to spread out the voice part over many quiet frequencies. those frequencies aren't actually there in the continuous signal (which is how your ears and brain analyse sound), but because of the discrete sampling it's mathematically indistinguishable. had you isolated small portions of the recording, such that every portion only contained some specific sound (part of a letter basically), you would need far less frequencies to reconstruct understandable speech, as the frequencies calculated by the DFT would match very closely the actual signal of the sound. this is how audio compression and processing algorithms actually work.
@@malbacato91 wow that is super interesting. Thanks! Had to read it like 5 times tough. So what you‘re saying is that audio compression algorithms first split a recording into many chunks and then apply the DFT for each one? If so I have some follow-up questions that I’m hoping you could help me out with: 1. Is there an optimal way to choose the chunk size? 2. With this approach we now have to save a spectrum for each chunk right? So if the chunk size is too large, can we end up with more frequencies than using the entire recording? A larger file so to say? 3. Is there a further optimization possible by noticing that a frequency can occur in multiple chunks? 4. When replaying the spectrums chunk by chunk, is it ever a problem that a transition is noticeable? Like a jump in the signal? Does this require further processing? Thank you for your time!
@@Laiserball8 It's a two-step process, and the frequency domain representation is actually used to *remove information* and thereby make the signal *more compressible* (lowering its entropy) based on a "psycho-acoustic model" with rules like "humans can't really hear the difference between a high-amplitude wave alone and that same high-amplitude wave plus a much lower-amplitude wave close in frequency". Essentially you remove components of the signal that the model deems inaudible, then reconstruct the audio, and then compress the simplified, lower-entropy wave using ordinary lossless compression methods. The actual compression part of MP3 isn't all that different from gzip compression. There are also simpler schemes available. About twenty years ago when I was young and promising :) one of my fellow students and myself thought we invented a super basic sound compression algorithm that we called logsound during a telephone call. It began with me asking questions about CD audio - I was a hifi guy in a small way but had only just begun to learn about digital signal processing. I argued that if we perceive an amplitude of 65536 relative to one of 32768 (half) in the same way we do an amplitude of 2 to 1, using linear sample values would result in _subjectively_ "poor resolution with respect to amplitude" for weak (components of) a signal, while at the same time "wasting resolution" for loud parts of the signal. My friend is a very skillful coder and quickly implemented linear and logarithmic downsampling to 8 bits so we could test this, and lo and behold, while both 8-bit files produced from processing a 16-bit file ripped from a CD, the version using the logarithm of the amplitude rather than the amplitude itself was clearly superiour. The irony is that we later discovered that the telephone network actually made use of this very trick already! So the whole time when we were discussing and testing "logsound", we were unknowingly using the very encoding scheme we were "inventing". Encoder and decoder can both be implemented with a simple lookup table (there are only 65536 possible sample values, so precalculate the logarithm of them all and store your 8-bit downsampled logsound value, and you can look them up by using the sample value as the index; for the decoder you go the other way, but only need 1024 entries if, like the phone networks did, you used 8-bit logarithmic values). For those nerdy enough to want to know more about this - or, I guess, those who think I'm making it all up, here is some more info on such a scheme: www.nxp.com/docs/en/application-note/ANE408.pdf
I work at an ISP, so we deal a lot with spectral analysis and similar concepts when implementing DWDM. It's awesome seeing someone coming across a lot of the concepts I know, except coming from a starting point of audio processing. Great video as always!
i’d just like to explain why it was "necessary" to double the amplitude of all of the frequencies except for the 0 and N/2 frequencies in order to get the correct output. it mostly has to do with the fact that a "true" discrete fourier transform does actually output a complete N amount of input signals for a given input signal of length N. however, due to aliasing and the nyquist sampling theorem, the second half of the output array effectively ends up measuring "negative frequencies", mirroring the first half of the array. eg, the exact frequency measured by each element of the output array would look something like [0, 1, 2, 3… N/2-1, N/2, -N/2+1.. -3, -2, -1]. "but how does a negative frequency make sense?" it’s pretty simple actually. having a negative frequency can be thought of as wrapping the signal around the circle at the *opposite* direction, but at the same speed to its corresponding positive frequency. it’s helpful in this case to interpret the "center of mass" of the spiraled up waveform as also having a horizontal and vertical component, and not just as a magnitude and phase*. the horizontal component measures how much of a pure cosine wave at the given frequency is present in the signal, and the vertical component does the same for a pure sine component. it turns out that, for any given negative frequency, its horizontal component (or real part) stays unaffected, but its vertical component (or imaginary part) gets flipped around the x axis, or effectively negated. this holds true for all frequencies between 1 and N/2-1, but not for the frequencies 0 and N/2 as they only are measured once each even by the full FFT. now why does this matter? when you do an inverse DFT you should expect that you get exactly the signal that you put into the DFT, and indeed you do thanks to these negative frequencies. notice that *all* of the frequencies play a role in the final sum, meaning that every frequency (that has a negative) will be summed with its negative; because the real parts are the exact same and the imaginary parts are negations between the two, the effect of the summation is that the real part of each frequency finally gets doubled, while the imaginary part vanishes due to additive inverses. the negative frequencies account for the missing half of the amplitude that sebastian had to "double" as a shortcut to get the correct result basically. TLDR: the full DFT calculates corresponding negative frequencies along with the positive ones, except for the frequencies 0 and N/2. when an inverse DFT is performed, these negative frequencies account for the missing half of the amplitude that occurred when only the positive frequencies were considered.
Don't know how it's taken me this long to notice, but I really appreciate that you use a darkmode background for your videos, you speak softly and calmly, and you ALWAYS put in the effort to do subtitles. An amazing teacher and you always pick the coolest topics and explain them so well. I'm due for my yearly rewatch of your boolean logic videos I think.
Oh my god. As I'm a programmer and a musician, I've found myself attempting to make audio plugins and such multiple times now, but the DFT/FFT was what always stopped me. I am yet to find a video which explains it in such a clear and good way as u do, thank u Sebastian, keep up the good work! Coding Adventures has been my favorite series on RUclips for a while now
I can't code, I don't understand more than half of what you are doing, yet every coding adventure of yours is amazing dude, I hope you keep doing this!
29:17 Those bumps are the secondary lobs of the sinc function that is the correct result for a Fourier transform of a non-periodic (with a finite number of sample) signal. It's working as intended, you just need an infinite number of samples to make them disappear, and then you get a Fourier series. It is also intended behaviour to have the energy of frequencies that are not a multiple of the frequency resolution shared on both sides. The max frequency that you need to look for is 2 times your sampling rate, a time discreet signal can not mathematically contain any frequency higher.
I work as a scientist in X-Ray crystallography - which basically relies on 3D Fourier synthesis to generate the positions of atoms within a crystal, so I thoroughly enjoyed this little adventure getting close to my field! haha, great to see you planning on tackling FFT, bravo and goodluck!!!
s0 = 1; s1 = 0; w = 2 * pi * freq / samplerate // loop s0 -= w * s1; s1 += w * s0; // s0 (cosine) is a half sample behind s1 (sine) at this point. very occasionally renormalise s0 and s1 no one else ever notices. people really are stupid. graphics programmers don't understand inter[olation isn't first order.
This is one of the few channels I will drop what I am doing to watch. I don't even use notifications often but this channel I do. Sebastian you are great! Thanks for your amazing work!
Fun fact: 360 is not that arbitrary of a number, there are these numbers called the Highly Composite Numbers, which are the numbers with the highest amount of divisors basically. Kinda like the opposite of a prime. 360 is one of them, so are 12, 24, 60, all numbers that you see pop up when you want to make it easy for people to further divide something (like on a clock, or degrees of a circle).
I love your videos! The editing, the quality, the voice over. You always sound so excited and curious. Ive obviously not watched the video within this split second of me commenting but I know it's going to be good! Thank you for your content!!
To combat the spectral leakage, you should look into windowing functions like Hann and Hamming. They essentially just fade in and fade out the input signal which results in a much more accurate spectral output
29:20 One way to test for "non-integer frequencies" is to use the Goertzel algorithm (with slight modifications), its also faster than the FFT when you want to detect only a few particular frequencies To get hid of the bumps you can apply a window function to the input signal to smooth a few of the first and last samples
@@average6317 I don't think it's a forced smile, he doesn't need to force his voice like troublechute does.. but the fact that it's not forced makes it that much creepier... he's not a creep though, but I feel your pain
Everytime I start one of Sebastian's videos I wonder how he can make the subject interesting. Everytime I'm totally blown away by his ideas and execution.
27:30 Those bumps are there for a reason! It's one of the basic properties of the Fourier transform. Ideally, you would be working on a continuous and infinite signal, but you are working on a small fragment of it. Exactly for this reason ideal spectrum of sinusoidal waves is combined with absolute value of Sinc function which is a FT of a rectangular pulse. Assuming that the signal X is an infinite combination of selected frequencies and Y is a 'rectangle' (takes the value 1 or 0) which shrinks the infinite function to a small fragment, in your code you analyse the function x(t) ⋅ y(t). In the frequency domain, the equivalent of multiplication is the convolution , so you get X(f) * Y(f), where f is the frequency. After applying the Fourier Transform to pure sinusoids, we expect to see Dirac delta functions shifted to specific locations along the frequency axis. By convolving these delta functions with the frequency domain representation of the signal we get repeated spectrum of the signal at those shifted positions. In this case, the spectrum takes the form of a Sinc function (also known as the "Sa" function) because the original signal was windowed using a square window in the time domain. You may want to read the Wikipedia article 'window function' and I suggest you delve into the topic of signal processing. EDIT: 31:20 This result is probably a mix of an issue with your code and another DFT property which is signal/spectrum repetition. It's also described in DTF Wikipedia article
I do enjoy seeing content about sound related things when it comes to data, but I've seen it already many times, what I haven't seen is running a air sim to make that sound! If you are to continue this project please please keep doing the air sim, don't get me wrong I do enjoy the Fourier Transform stuff too, just the simulated sound instead of emulated sound is so cool!
I understand next to nothing you're talking about, I'm only in tenth grade, but your calm voice and the nice visuals are so calming to me, it sounds like you are constantly smiling whilst recording. And I get so excited whenever you talk about something I actually already learned about in school. I hope one day, I will understand everything you're doing.
Yet another masterpiece of a video. You could teach anything and it would be fascinating because of how you approach things. If only programming was as easy as you make it seem... I absolutely understand that this is because you are infinitely more intelligent than I will ever be, but I love how interesting you make things and it inspires me to explore more fun programming concepts like these.
In my field of sleep research, we use the fast fourier transform to help visualise sleep stages - if you search for images of something like "hypnogram spectral analysis" you will see how the sleep stages pop out. A video looking at how to code this would be interesting. Thanks for your very interesting videos
I suffered so much while I was learning things about waves and their interactions during cyber security training at the academy, and 5 years later I see this video. How much simpler things would have been if I had seen it then
40:48 One trick for these kind of vissualisations is that often it is more meaningfull to represent frequency on a logarithmic scale, scine that's how we hear sound typicly. so for example the frequencies between 100 and 1 000 Hz get the same amount of space in the graph as from 1 000 to 10 000. 41:12 It's also usefull to represent amplitudes on a log scale as well. You can still hear it if the amplitude is "extreemly small" compared to the loudests amplitude
This was the best video by you yet, at least for me as an audio engineer. It made me feel smart that I knew a bunch of stuff that you didn't, especially: "you don't need to set a max frequency since that is determined by the sample rate." But your approach also showed some insights that were very very interesting! Also I learned a bunch of stuff I didn't know, particularly about the actual math. And the sounds you made make me want to become a programmer to unlock this world of strange sound processing you are stumbling through for creative uses. And as always, your visualizations are art. By the way, fun fact about the aliasing frequencies: they are a reflection off the "ceiling" set by the nyquist frequency. You get this commonly in digital sound processing with purposeful distortion, which is why distortion plugins for DAWs typically have oversampling built in, to stop aliasing and then filter out the higher frequencies that would cause aliasing, because aliasing sounds really unmusical.
1. I'm really happy to see a new video appear! Once again, it looks very interesting. 2. 9:55 It's possible that the saturated sound is coming from the loudspeaker, which sometimes goes faster than the speed of sound. So perhaps slowing down the sound even more would result in a much clearer sound. 3. I feel like there's a lot of content that could be used for another episode, like slowing down or speeding up a sound without changing its pitch, or changing the pitch of a sound without slowing it down or speeding it up. Also, I'm pretty sure that a prism performs a Fourier transform on light. 4. I really like your way of programming, which consists in understanding things and creating them from scratch. That's something rare, and it's precisely what I'm looking for and why I like your channel. The amont of visualization is also a great idea.
The idea that something that exists in real life like a prism can essentially perform an algorithm is incredible and shows how closely connected digital concepts are to the real world. Reminds me a bit of how motors and gear shifting exists on the microbiological level.
@@SolanaarYes! I just recently saw this video by Smarter Every Day about these bacterial flagellar motors. I previously thought these things probably just vibrate or wiggle in some way but no there are actually gears and rotation involved on molecular level and it's amazing.
Absolutely gorgeous. Reminds me of how fascinated / inspired I was after the first time I watched 'The Conversation' .. watching the character do this kind of calculation and reconstruction with his home-grown recording equipment. I marvel at the knowledge and skill, and this was so beautifully presented.
This first part of simulating speaker and microphone could be pretty cool if you somehow get that to be more performant. Imagine being able to simulate room echo and how differently shaped objects in the room affect the sound. That could be very interesting! You could even simulate different pickup patterns and everything!
very interesting topic! just a few hours ago, i was rewatching one of your videos, and i was thinking "when's the next video gonna be out?"... well, my answer has arrived.
This video teaches you more than 3 CS courses on signal processing combined.. truly incredible.. if we were thought like this in school and uni, everyone would be a genius ❤
I was like bet, another indepth coding exploration of some interesting programming principle. Then the legend BUSTS OUT THE FLUID SIMULATION from earlier and re-records the god damn sound in the simulation. Was not expecting that. He's insane
at 31:01 i’m pretty sure that “strange background noise” is naturally generated reverb. This is because the “recording room” you generated is a box with perfectly flat walls and no pass through for the sound waves to disperse. You could work around this by simulating an anechoic chamber with spiked walls and a high absorption rate. I’d assume this would remove that nasty echo you would expect from a polished concrete room. (see reverberation chamber) TLDR: what you thought was a bug is actually just physics :D
@@Shlaboza yeah but i highly doubt he's still using the rectangle room at the point in the video when he's reconstructing the fourier transform, if he was using the room model you would hear room modes/resonances (and the distortions we heard because of the way the air particles interacted), and not a perfectly smeared signal
Fantastic video as always. I sort of understood the principle behind Fourier transforms before, but now I have a much more robust understanding that will surely come in handy some day! :)
Man this brings me back to many years ago when it first clicked to me that the AnimationCurve class could be used to define simple waveforms, and I built a small synthesizer program in Unity.
22:52 I think that when you don't have an integer frequency your "average" point does not fall in the center because you are not ploting the frequencies in a wide enought range. But, the wider you chose the range, the closer that point will be to the center. With two exception: - the test frequency matches the frequency of the signal (case that you already mention) - the test frequency and the signal frequency are two integers with a very small Least Common Multiple (that fits in your range)
The DFT visualization is the perfect addition to the 3b1b video. It's one of the most beautiful (and useful!) bits of maths and seeing it presented in such an effective way is awesome
I did this same thing a few years ago experimenting with audio compression and I think it was 3Blue1Brown's video on the FFT that inspired me. I made a program that would read in a wav file, do an FFT on it, remove all but the most prominent frequencies based on a compression ratio I specify, and convert it back to a wav file so I can hear it. It's surprising just how much you can remove and it still sounds pretty good. I had more bleeps and bloops when using extreme compression rather than that underwater sound you got.
So much effort to these videos for such a long time (years by now) and yet 1M subs. That's something that touching. Why aren't my peers that interested??
You are a god. That Fourier transform visualisation is not only the best Fourier explanation I've seen, but probably the best mathematical explanation of anything I've ever seen on RUclips.
Thank you for actually showing this in terms of code. In every other video explaining the Fourier transform, they just start jotting down a bunch of Greek symbols in doctor's handwriting like it's supposed to make immediate sense. I don't understand mathematical notation, so this is a blessing. I can't wait for your FFT implementation!
Whenever I watch a Sebastian Lague video it reminds me how much fun my side project is and I go and do it instead of doom scrolling. Thanks Sebastian ☺️☺️
Sebastian’s videos gives me the confidence to start a project that would need a team of 10 people multiple years to make, then I’m brought back to reality
Worked in audio for a bit in the past. It has been my beloved hobby before and after. Always eager to learn more about how stuff works in the field. Was happily using DAWs without knowing all the complex coding that goes on behind the scenes. Now I feel like I know a fraction of a 10th of a percent of it. Thanks! :D
Being deep into signal processing study, this video gave me yet another different visualisation of signals. Very cool to see more people learn this stuff :D
Sebastian Lague’s videos trick me into thinking programming is fun. Thanks!
"trick"
@@Agent-uj8ud and easy
It used to be 😭
It is. Or at least, it can be.
It is, it's just math with a fancy calculator. Who wouldn't have fun with that?
as for the 100k waves signal being indistinguishable from the original, you could subtract it from the original in an audio editor and listen to the difference
❤😂🎉😢
How this dude comment is 6 hr ago. Since video is 9 min old
@@akc21adtpatreon maybe
considering all the work is already done, he can probably just do it in unity and it'd be faster than booting up audacity :D
No need to subtract it.
Just reverse the phase, it will subtract itself.
The ''person that talk about something with nice visual and get you invested no mater what the subject is'' got to be my favorite RUclips genre.
Edit : mom I'm famous
3blue1brown
@@jeffreyrehm8320 yup
sebastian lague and posy are some of my favorite youtubers. always a good time.
Freya Holmér - beautiful videos about splines, beziers and plenty more
@@tomnewsom9124 just realizing I've seen plenty of her videos and never actually subscribe because RUclips just kept recommending them, I'm'a correct that right now.
9:07 I think that's a very accurate simulation of microphones used in aviation. Pilots always sound like that somehow. But for the simulation at least I see two very easy ways in that it could be improved:
1. Instead of a rectangle for the speaker, try to use a bowl or cone shape instead. Currently the sound waves are very unfocused and are getting dispersed too quickly.
2. More space. Due to the very limited space in the simulation, the waves are reflected from the walls and begin bounding around, causing a ton of interference. The microphone very quickly begins to swim in a soup of noise. This would also be part of why adding more simulation steps helped so much: it gave the noise time to settle.
Obviously, simply simulating more space would also mean you'd need a lot more particles, but there's also a very simple way to fake it. Instead of letting particles get reflected by the outer walls, you could simply remove them from the simulation and spawn in new particles in low-density areas around the walls, essentially simulating air leaving and rushing into the volume from outside.
Alternatively, and visually more interesting, you could try adding ripple shapes around the walls to work as noise dispersion.
But I also get that this wasn't the main focus of the video and I probably already put too much thought into it. But maybe it'll help if you were intending to make a full version of "Bad Apple, but the audio is a fluid simulation too". The part on the DFT was great and I'm looking forward to the video on the FFT.
Also: Yay, cat. Very cute.
I also seen an issue in the speed of the speaker. Based on the speed that sound waves propagate, it seems to be supersonic... No real-life speaker moves that fast, so I can't say exactly *what* effect it would have on audio quality, but I feel that it can't be good.
Yes but that's because in aviation it's customary to chew on the microphone to soothe the nerves and fend off boredom, it's common knowledge.
@@erictheepic5019 piling onto this critique, the speaker driver has mass and the voice coil should need to accelerate and decelerate the driver. There was also a lot of reflected interference from sound bouncing off the walls.
So depending on the type of microphone, the recorded sound isn't necessarily just the voltage. And when driving the speaker the voltage isn't just an absolute position of the cone. The microphone must compensate for those raw voltages to define the actual waveform, but similarly the circuit driving the speaker needs to compensate for the physical properties. Assuming that the microphone is making those calculations itself, Sebastian really just needs to adjust the speaker design so that there are different drivers which are tailored to operate in notched filtered frequencies which aren't as affected by trying to accelerate the speaker cone outside their range. This is easiest to accomplish with a sub, a mid range, and a tweet, working together. Baffling on the walls should absorb any sound pressure and impart no reflected resonance. The software mic would need to have a gain amplified to pick up the reduced audio sound and normalize the volume again.
I'd be real curious how this sort of processing would affect audio fingerprinting as the sampled audio would not match the original anymore from a binary perspective, and having the different speaker positions offset would affect the phasing at different frequencies. Passing it through the transform again, I expect that the same frequencies are found again even though the raw data would look indistinguishable.
Or change the boundary conditions to not reflect but absorb the waves.
@@timschulz9563that was my instinctive thought because the visualisation makes it look like it's using finite element method or similar but if the simulation is based on particles moving around a region then removing particles is going to mess things up.
i love that most of coding adventures these days feels like reinventing the wheel, for the purposes of determining the actual principles behind why a wheel and how the wheel works. not necessarily to build a BETTER wheel, but just because you're curious about wheels and how they work.
Yes indeed. I have researched the Fast Fourier Transform myself a year ago, written my own simple implementation for learning purposes. Learned about complex numbers before it was even taught in math class!
The FFT is seriously clever and enabled a lot of modern technology. It deserves an entire video tbh
Veritasium has an entire video on it
But not about coding it.
@@rarelycomments Reducible has a great video on it.
Fuck modern technology!
It may be the most important algorithm of the modern age.
These coding adventures always excite me and at the same time reignite my imposter syndrome when I realize that I couldn't be farther from making any of these on my own without a ready solution
Sometimes it's just a matter of giving yourself time to think about the problem and read through the theory. These videos are awesome but they hide most of the actual work behind the scene required to pull them off
any big project can be divided into smaller solveable projects
start small, experiment, prototype, and you'll learn as you go
@@uhrguhrguhrg not most of his coding adventures though, you'd need to be pretty good at math to do these, and I'm just not. It's not easy to learn math at all, and so far I've failed miserably each time I tried to do so, but I keep trying.
@@kurushimeeMaths itself is not the difficult part (usually). It's just not very accessible because there often aren't many resources to give people without an aptitude towards abstraction a good grip on the concepts. With that said, these resources and ideas do exist: They are what makes 3blue1brown, etc. successful.
You're not bad at maths, you can do it! It's that you are trying to rebuild centuries of experience, experimentation and research from nothing in a few hours or days.
You can do it! Many times have I heard that people don't understand a topic until someday they hear somebody explain it in whacky way and it just clicks for them.
@@kurushimee then make small projects about the math you're learning. You can't just bash your head against theory, practice is also required to understand things.
11:41 "sounds pretty normal"
Bro that sounded like a demon mimicking human speech 😭
11:34 you mean?
Lol
@@Optimus97 yea, lol
It kinda sounded like a German accent
sounds like German. Hallo Ävelon, noch Ich bin wißt so lauf
Just did a Fourier transform exam last week
Sebastian always blows my mind while making me feel like a bad programmer
Fortunately, the field of programming is vast enough that there is enough room for EVERYONE to be a bad programmer. So equal footing as long as you are legitimately trying.
try be very good at something (just a single domain, either is game dev, web designer, machine learning) and you'll feel better.
The thing with this kind of content is, despite him hinting at it (which is great already), you just can't see the hours and hours of failing and trying to understand what's wrong. It seems so easy watching him do it, but really i have no doubt there was painful work here, he's smart for sure, but his "can do" attitude certainly does more of the work than pure brain power.
@@GabrielPettier Absolutely. This is the edited shots of all his SUCCESS. Not the hours of hair pulling "I'm an idiot, why isn't this working. Dang it, I freaking missed a SPACE in the variable?"
@@GabrielPettier right, every good piece of content requires hard work, debugging and curiosity.
I love the confluence of 3b1b and Sebastian. Please let these two collaborate in the future!
They are both so very good at visualizing the learning process. I feel like either of them could give a masterclass on effective visual communication, so I would love to hear the two of them talking about what they've learned.
I would add Reducible as well!! The trio for maths and programming!
This actually sounds like a pretty interesting video idea!
Have a look at braintruffle. His most recent video on orbital mechanics was extremely mind-blowing to me.
@@nankinink For real! The first time I watched a Reducible video, I spent the whole video wondering why 3b1b was sounding different 😂😂
18:00 Sebastian was the cat all along
I'm currently working on implementing a sound engine in a project I'm making. I can not get it to work at all and literally said to myself *"Man, why can't there be a Sebastian Lague video about fourier transforms. That would make my job so easy!"*
Thanks for literally saving my project!
This world is full of people that are insanely smart. But being this smart and also so great at communicating/teaching is a feat even many professors do not achieve. I take my hat off to you
Sorry kids, I know we’re on vacation, but daddy’s gonna take 43:31 minutes to relax.
"In today's episode of Coding Adventures, Sebastian proves that you can speak German by just speaking in English backwards!"
Love your videos! They remind me why I wanted to get into coding!
As a German I thought this sounded a lot like Danish.
When I was playing with reversing speech years ago, I observed the reversed audio sounded Scandinavian, so I recorded myself saying that and learned that backwards the word Scandinavian sounds like "naervindanahks"
Seeing the 3b1b DFT visualization animated with tunable parameters was absolutely beautiful!
Also, as someone who has been working with Fourier transforms for many years now, it's very nice to see someone going through the process of gaining an intuition for how sample duration and sampling frequency affect the frequency domain resolution.
Thank you so much for sharing some of the beauty that's hidden behind maths!
I hope you know how much joy seeing a Sebastian Lague upload brings!
*gaping mouth* I f*cking love science!!!!
Dude, the way you explain things is admirable. Natural teacher. For those of us that struggle with numbers, you make understanding possible. Showed my son your explanation of sin and cos and he was like "now I get it", and that sir is invaluable. Thank you for the excellent videos.
25 years ago I cried tears of blood at the university while learning about discrete Fourrier transformation and Nyqist-Shanon theorem. And now, look at me, I enjoy watching a video talking about this :D
i remember when after 16 years, a human being accidentally let me see fft(log10(fft()))
i was so pissed it took me three fing years to touch it
and then they have the nerve to microwave me when i'm in bed. they're a bunch of guys who wear aprons.
thanks for the description, I'll stay on the lookout@@atomictraveller
@@atomictraveller huh
@@atomictraveller I feel like this is some sort of deep joke where the fast fourier transform is used to look like boobs or something. Maybe I don't get the joke though.
@@Alexander_Grant that short expression there is the cepstrum.
that's all the notation i saw and all it needs. if you use fft some, you can infer the log10 applies to the mag bins to nyquist same as you would for a graphic readout. then you fft those and you have the cepstrum. now you can do formant shifting and higher level spectral ops like that.
that's 16 years of car chases and fist fights and plane crashes into a burning lake of dog farts.
The reflections from the boundaries of the simulation box at 9:30 were probably affecting the sound quality a lot. In electromagnetics, people use absorbers or perfectly matched layers (PMLs) at the boundaries to remedy this issue.
It's absolutely insane the amount of effort that goes into these videos. I really liked the final showcase of only using the X most "important" frequencies, it's impressive how many different frequencies human speech makes/requires.
to be fair, the demonstration is a bit deceptive. because Sebastian's voice is not some repeating signal, the highest amplitude frequencies are background noise, and then the algorithm has to spread out the voice part over many quiet frequencies. those frequencies aren't actually there in the continuous signal (which is how your ears and brain analyse sound), but because of the discrete sampling it's mathematically indistinguishable.
had you isolated small portions of the recording, such that every portion only contained some specific sound (part of a letter basically), you would need far less frequencies to reconstruct understandable speech, as the frequencies calculated by the DFT would match very closely the actual signal of the sound. this is how audio compression and processing algorithms actually work.
@@malbacato91 wow that is super interesting. Thanks! Had to read it like 5 times tough.
So what you‘re saying is that audio compression algorithms first split a recording into many chunks and then apply the DFT for each one? If so I have some follow-up questions that I’m hoping you could help me out with:
1. Is there an optimal way to choose the chunk size?
2. With this approach we now have to save a spectrum for each chunk right? So if the chunk size is too large, can we end up with more frequencies than using the entire recording? A larger file so to say?
3. Is there a further optimization possible by noticing that a frequency can occur in multiple chunks?
4. When replaying the spectrums chunk by chunk, is it ever a problem that a transition is noticeable? Like a jump in the signal? Does this require further processing?
Thank you for your time!
@@Laiserball8 It's a two-step process, and the frequency domain representation is actually used to *remove information* and thereby make the signal *more compressible* (lowering its entropy) based on a "psycho-acoustic model" with rules like "humans can't really hear the difference between a high-amplitude wave alone and that same high-amplitude wave plus a much lower-amplitude wave close in frequency". Essentially you remove components of the signal that the model deems inaudible, then reconstruct the audio, and then compress the simplified, lower-entropy wave using ordinary lossless compression methods. The actual compression part of MP3 isn't all that different from gzip compression.
There are also simpler schemes available. About twenty years ago when I was young and promising :) one of my fellow students and myself thought we invented a super basic sound compression algorithm that we called logsound during a telephone call. It began with me asking questions about CD audio - I was a hifi guy in a small way but had only just begun to learn about digital signal processing. I argued that if we perceive an amplitude of 65536 relative to one of 32768 (half) in the same way we do an amplitude of 2 to 1, using linear sample values would result in _subjectively_ "poor resolution with respect to amplitude" for weak (components of) a signal, while at the same time "wasting resolution" for loud parts of the signal. My friend is a very skillful coder and quickly implemented linear and logarithmic downsampling to 8 bits so we could test this, and lo and behold, while both 8-bit files produced from processing a 16-bit file ripped from a CD, the version using the logarithm of the amplitude rather than the amplitude itself was clearly superiour.
The irony is that we later discovered that the telephone network actually made use of this very trick already! So the whole time when we were discussing and testing "logsound", we were unknowingly using the very encoding scheme we were "inventing". Encoder and decoder can both be implemented with a simple lookup table (there are only 65536 possible sample values, so precalculate the logarithm of them all and store your 8-bit downsampled logsound value, and you can look them up by using the sample value as the index; for the decoder you go the other way, but only need 1024 entries if, like the phone networks did, you used 8-bit logarithmic values). For those nerdy enough to want to know more about this - or, I guess, those who think I'm making it all up, here is some more info on such a scheme: www.nxp.com/docs/en/application-note/ANE408.pdf
18:04: What??? I never knew you were a cat! I was already impressed, but now you completely blew my mind!
we went from watching cat videos to watching videos made by cats !😀
I work at an ISP, so we deal a lot with spectral analysis and similar concepts when implementing DWDM. It's awesome seeing someone coming across a lot of the concepts I know, except coming from a starting point of audio processing. Great video as always!
i’d just like to explain why it was "necessary" to double the amplitude of all of the frequencies except for the 0 and N/2 frequencies in order to get the correct output. it mostly has to do with the fact that a "true" discrete fourier transform does actually output a complete N amount of input signals for a given input signal of length N. however, due to aliasing and the nyquist sampling theorem, the second half of the output array effectively ends up measuring "negative frequencies", mirroring the first half of the array. eg, the exact frequency measured by each element of the output array would look something like [0, 1, 2, 3… N/2-1, N/2, -N/2+1.. -3, -2, -1]. "but how does a negative frequency make sense?" it’s pretty simple actually. having a negative frequency can be thought of as wrapping the signal around the circle at the *opposite* direction, but at the same speed to its corresponding positive frequency. it’s helpful in this case to interpret the "center of mass" of the spiraled up waveform as also having a horizontal and vertical component, and not just as a magnitude and phase*. the horizontal component measures how much of a pure cosine wave at the given frequency is present in the signal, and the vertical component does the same for a pure sine component. it turns out that, for any given negative frequency, its horizontal component (or real part) stays unaffected, but its vertical component (or imaginary part) gets flipped around the x axis, or effectively negated. this holds true for all frequencies between 1 and N/2-1, but not for the frequencies 0 and N/2 as they only are measured once each even by the full FFT. now why does this matter? when you do an inverse DFT you should expect that you get exactly the signal that you put into the DFT, and indeed you do thanks to these negative frequencies. notice that *all* of the frequencies play a role in the final sum, meaning that every frequency (that has a negative) will be summed with its negative; because the real parts are the exact same and the imaginary parts are negations between the two, the effect of the summation is that the real part of each frequency finally gets doubled, while the imaginary part vanishes due to additive inverses. the negative frequencies account for the missing half of the amplitude that sebastian had to "double" as a shortcut to get the correct result basically.
TLDR: the full DFT calculates corresponding negative frequencies along with the positive ones, except for the frequencies 0 and N/2. when an inverse DFT is performed, these negative frequencies account for the missing half of the amplitude that occurred when only the positive frequencies were considered.
Thanks! I was wondering about that here.
Yep, as someone who knows a bit, i was gonna point out, thanks for doing that! ^^
Don't know how it's taken me this long to notice, but I really appreciate that you use a darkmode background for your videos, you speak softly and calmly, and you ALWAYS put in the effort to do subtitles.
An amazing teacher and you always pick the coolest topics and explain them so well. I'm due for my yearly rewatch of your boolean logic videos I think.
Oh my god. As I'm a programmer and a musician, I've found myself attempting to make audio plugins and such multiple times now, but the DFT/FFT was what always stopped me. I am yet to find a video which explains it in such a clear and good way as u do, thank u Sebastian, keep up the good work! Coding Adventures has been my favorite series on RUclips for a while now
I like the new lore that you are actually the cat coding and watching research videos 😮 Amazing voice for a cat!
Best explanation of the nyquist theorem ive ever seen, that visual changed how i think of it
I can't code, I don't understand more than half of what you are doing, yet every coding adventure of yours is amazing dude, I hope you keep doing this!
29:17 Those bumps are the secondary lobs of the sinc function that is the correct result for a Fourier transform of a non-periodic (with a finite number of sample) signal.
It's working as intended, you just need an infinite number of samples to make them disappear, and then you get a Fourier series.
It is also intended behaviour to have the energy of frequencies that are not a multiple of the frequency resolution shared on both sides.
The max frequency that you need to look for is 2 times your sampling rate, a time discreet signal can not mathematically contain any frequency higher.
Great video as always. Keep up the good work 🎉
@@mariandev Thank you!
How is this posted 14 hrs ago... when the video was uploaded 45 mins ago!
@@lycor surely patreons get access to it before it's public.
You're right!
I work as a scientist in X-Ray crystallography - which basically relies on 3D Fourier synthesis to generate the positions of atoms within a crystal, so I thoroughly enjoyed this little adventure getting close to my field! haha, great to see you planning on tackling FFT, bravo and goodluck!!!
im here 45 SECONDS after upload, and somehow 94 people were here before me. This is insane, and very deserved
Same😂
4min after XD, i love this guy, if i see him instaly hit his video, youtube knows so he recomends right after upluoad
...bots
after 6minutes 1400 😂😂
Exactly what I was thinking,
Lague is the shizzle
Lools like Sebastian is a Tau person lol. Good to see other chronically online math nerds are out there
that cos and sin spinny thingy was everything i always wanted to understand but never did. blew my mind so casually
s0 = 1; s1 = 0; w = 2 * pi * freq / samplerate
// loop
s0 -= w * s1; s1 += w * s0;
// s0 (cosine) is a half sample behind s1 (sine) at this point. very occasionally renormalise s0 and s1
no one else ever notices. people really are stupid. graphics programmers don't understand inter[olation isn't first order.
@@atomictraveller There's a point there. I can feel it.
@@General12th you know ufeelit
14:05 Never would've guessed that watching a video at 4am about simulating sound waves is how I'd learn what a radian is actually defined as
"Hello everyone, welcome back to another episode of coding adventures" In that buttery smooth voice gets me every time.
As an predictive maintenance engineer, interpreting vibration patterns of bearings and other rotating equipment (FFT for days)... this was amazing.
This is one of the few channels I will drop what I am doing to watch. I don't even use notifications often but this channel I do. Sebastian you are great! Thanks for your amazing work!
Fun fact: 360 is not that arbitrary of a number, there are these numbers called the Highly Composite Numbers, which are the numbers with the highest amount of divisors basically. Kinda like the opposite of a prime. 360 is one of them, so are 12, 24, 60, all numbers that you see pop up when you want to make it easy for people to further divide something (like on a clock, or degrees of a circle).
I love your videos! The editing, the quality, the voice over. You always sound so excited and curious. Ive obviously not watched the video within this split second of me commenting but I know it's going to be good!
Thank you for your content!!
To combat the spectral leakage, you should look into windowing functions like Hann and Hamming.
They essentially just fade in and fade out the input signal which results in a much more accurate spectral output
I remember implementing FFT for uni, and I also remember not understanding anything I had to do. I'm excited for you to shine light on it
29:20 One way to test for "non-integer frequencies" is to use the Goertzel algorithm (with slight modifications), its also faster than the FFT when you want to detect only a few particular frequencies
To get hid of the bumps you can apply a window function to the input signal to smooth a few of the first and last samples
Sebastian Lague is actually the cat.
Oh my, sound exist!
Interesting theme, thank you
Imagine having a bad day then you saw Sebastian uploaded a new video.
At 12:20 I liked that the slow sound was in red, and the fast sound was in blue. Nice touch hinting at red/blueshift
Love watching these tech adventures accompanied with Sebastian's happy voice, it's almost soothing for the soul!
unless you're me, then it's enraging
@@adamrushford Right? It sounds like he's forcing a smile the entire video, it gives me uncomfortable goosebumps
@@average6317 I don't think it's a forced smile, he doesn't need to force his voice like troublechute does.. but the fact that it's not forced makes it that much creepier... he's not a creep though, but I feel your pain
@@average6317 for me I can't stand anyone who deliberately acts nice or bubbly, it's removed from reality AND their true emotions
Everytime I start one of Sebastian's videos I wonder how he can make the subject interesting. Everytime I'm totally blown away by his ideas and execution.
Ah, good morning indeed! Always a good day when a new coding adventure drops.
27:30 Those bumps are there for a reason! It's one of the basic properties of the Fourier transform. Ideally, you would be working on a continuous and infinite signal, but you are working on a small fragment of it. Exactly for this reason ideal spectrum of sinusoidal waves is combined with absolute value of Sinc function which is a FT of a rectangular pulse.
Assuming that the signal X is an infinite combination of selected frequencies and Y is a 'rectangle' (takes the value 1 or 0) which shrinks the infinite function to a small fragment, in your code you analyse the function x(t) ⋅ y(t). In the frequency domain, the equivalent of multiplication is the convolution , so you get X(f) * Y(f), where f is the frequency. After applying the Fourier Transform to pure sinusoids, we expect to see Dirac delta functions shifted to specific locations along the frequency axis. By convolving these delta functions with the frequency domain representation of the signal we get repeated spectrum of the signal at those shifted positions. In this case, the spectrum takes the form of a Sinc function (also known as the "Sa" function) because the original signal was windowed using a square window in the time domain.
You may want to read the Wikipedia article 'window function' and I suggest you delve into the topic of signal processing.
EDIT: 31:20 This result is probably a mix of an issue with your code and another DFT property which is signal/spectrum repetition. It's also described in DTF Wikipedia article
I do enjoy seeing content about sound related things when it comes to data, but I've seen it already many times, what I haven't seen is running a air sim to make that sound! If you are to continue this project please please keep doing the air sim, don't get me wrong I do enjoy the Fourier Transform stuff too, just the simulated sound instead of emulated sound is so cool!
I understand next to nothing you're talking about, I'm only in tenth grade, but your calm voice and the nice visuals are so calming to me, it sounds like you are constantly smiling whilst recording. And I get so excited whenever you talk about something I actually already learned about in school. I hope one day, I will understand everything you're doing.
Yet another masterpiece of a video. You could teach anything and it would be fascinating because of how you approach things. If only programming was as easy as you make it seem... I absolutely understand that this is because you are infinitely more intelligent than I will ever be, but I love how interesting you make things and it inspires me to explore more fun programming concepts like these.
In my field of sleep research, we use the fast fourier transform to help visualise sleep stages - if you search for images of something like "hypnogram spectral analysis" you will see how the sleep stages pop out. A video looking at how to code this would be interesting. Thanks for your very interesting videos
Just finished the video. Thank you for teaching me about sounds. Excited for the next video!
what a great day with a sebastian upload
It's a good day when Sebastian blesses us with another god tier video
you need to get out more
I suffered so much while I was learning things about waves and their interactions during cyber security training at the academy, and 5 years later I see this video. How much simpler things would have been if I had seen it then
i get so happy whenever i see any of your videos on my recommended :D
40:48 One trick for these kind of vissualisations is that often it is more meaningfull to represent frequency on a logarithmic scale, scine that's how we hear sound typicly. so for example the frequencies between 100 and 1 000 Hz get the same amount of space in the graph as from 1 000 to 10 000.
41:12 It's also usefull to represent amplitudes on a log scale as well. You can still hear it if the amplitude is "extreemly small" compared to the loudests amplitude
no wayy I was watching your videos all week and was sad I've seen the last one 😂 I love it 🤩
This was the best video by you yet, at least for me as an audio engineer.
It made me feel smart that I knew a bunch of stuff that you didn't, especially: "you don't need to set a max frequency since that is determined by the sample rate."
But your approach also showed some insights that were very very interesting! Also I learned a bunch of stuff I didn't know, particularly about the actual math. And the sounds you made make me want to become a programmer to unlock this world of strange sound processing you are stumbling through for creative uses.
And as always, your visualizations are art.
By the way, fun fact about the aliasing frequencies: they are a reflection off the "ceiling" set by the nyquist frequency. You get this commonly in digital sound processing with purposeful distortion, which is why distortion plugins for DAWs typically have oversampling built in, to stop aliasing and then filter out the higher frequencies that would cause aliasing, because aliasing sounds really unmusical.
Thats a phenomenal start into the day. Thanks
This is by far my favorite RUclips voice
1. I'm really happy to see a new video appear! Once again, it looks very interesting.
2. 9:55 It's possible that the saturated sound is coming from the loudspeaker, which sometimes goes faster than the speed of sound. So perhaps slowing down the sound even more would result in a much clearer sound.
3. I feel like there's a lot of content that could be used for another episode, like slowing down or speeding up a sound without changing its pitch, or changing the pitch of a sound without slowing it down or speeding it up. Also, I'm pretty sure that a prism performs a Fourier transform on light.
4. I really like your way of programming, which consists in understanding things and creating them from scratch. That's something rare, and it's precisely what I'm looking for and why I like your channel. The amont of visualization is also a great idea.
The idea that something that exists in real life like a prism can essentially perform an algorithm is incredible and shows how closely connected digital concepts are to the real world. Reminds me a bit of how motors and gear shifting exists on the microbiological level.
@@SolanaarYes! I just recently saw this video by Smarter Every Day about these bacterial flagellar motors. I previously thought these things probably just vibrate or wiggle in some way but no there are actually gears and rotation involved on molecular level and it's amazing.
LETS GOOOOOOOO
Dude you don't know how excited seeing one of your videos on my recommended makes me.
Only just started the video, but can't get over the frightening teeth at 0:18
Absolutely gorgeous. Reminds me of how fascinated / inspired I was after the first time I watched 'The Conversation' .. watching the character do this kind of calculation and reconstruction with his home-grown recording equipment. I marvel at the knowledge and skill, and this was so beautifully presented.
Oh my god a video about sound.
I've been waiting for this
Always a pleasure to see your take on a topic. Here since Platformer2D with raycast collision.
babe wake up sebastian uploaded
This first part of simulating speaker and microphone could be pretty cool if you somehow get that to be more performant. Imagine being able to simulate room echo and how differently shaped objects in the room affect the sound. That could be very interesting! You could even simulate different pickup patterns and everything!
very interesting topic!
just a few hours ago, i was rewatching one of your videos, and i was thinking "when's the next video gonna be out?"... well, my answer has arrived.
This video teaches you more than 3 CS courses on signal processing combined.. truly incredible.. if we were thought like this in school and uni, everyone would be a genius ❤
Today is a great day! 🎉
I was like bet, another indepth coding exploration of some interesting programming principle. Then the legend BUSTS OUT THE FLUID SIMULATION from earlier and re-records the god damn sound in the simulation. Was not expecting that. He's insane
I did mess around with the FT at some point to try to make a sound denoiser. FT is mad powerful
at 31:01 i’m pretty sure that “strange background noise” is naturally generated reverb. This is because the “recording room” you generated is a box with perfectly flat walls and no pass through for the sound waves to disperse.
You could work around this by simulating an anechoic chamber with spiked walls and a high absorption rate. I’d assume this would remove that nasty echo you would expect from a polished concrete room. (see reverberation chamber)
TLDR: what you thought was a bug is actually just physics :D
nah u trippin balls
@@donotoliver you can literally see the waves rebounding and hitting the mic again when he visualised it
you could fft(log10(fft())) cepstrum them away to magical not here land just liek where masons send people who can actually do anything
@@Shlaboza yeah but i highly doubt he's still using the rectangle room at the point in the video when he's reconstructing the fourier transform, if he was using the room model you would hear room modes/resonances (and the distortions we heard because of the way the air particles interacted), and not a perfectly smeared signal
Yesss my yearly dose of Sebastian Lague
Is the cat coding and making all the videos? ARE YOU THE CATTTT?
Fantastic video as always. I sort of understood the principle behind Fourier transforms before, but now I have a much more robust understanding that will surely come in handy some day! :)
vote for who want how do computers work series back
Man this brings me back to many years ago when it first clicked to me that the AnimationCurve class could be used to define simple waveforms, and I built a small synthesizer program in Unity.
I appreciate the low-frequencies being visualized as red and higher ones as violet, it fits. makes me happy.
As always... got lost when Fourier Transforms came into play... Its just incredible how much information is packed in your videos. So good!
22:52
I think that when you don't have an integer frequency your "average" point does not fall in the center because you are not ploting the frequencies in a wide enought range. But, the wider you chose the range, the closer that point will be to the center. With two exception:
- the test frequency matches the frequency of the signal (case that you already mention)
- the test frequency and the signal frequency are two integers with a very small Least Common Multiple (that fits in your range)
The DFT visualization is the perfect addition to the 3b1b video. It's one of the most beautiful (and useful!) bits of maths and seeing it presented in such an effective way is awesome
I did this same thing a few years ago experimenting with audio compression and I think it was 3Blue1Brown's video on the FFT that inspired me. I made a program that would read in a wav file, do an FFT on it, remove all but the most prominent frequencies based on a compression ratio I specify, and convert it back to a wav file so I can hear it. It's surprising just how much you can remove and it still sounds pretty good. I had more bleeps and bloops when using extreme compression rather than that underwater sound you got.
So much effort to these videos for such a long time (years by now) and yet 1M subs. That's something that touching. Why aren't my peers that interested??
You are a god. That Fourier transform visualisation is not only the best Fourier explanation I've seen, but probably the best mathematical explanation of anything I've ever seen on RUclips.
I like the mild implication at 18:00 that you are actually the cat, and the cat has been making and narrating this whole video.
Thank you for actually showing this in terms of code.
In every other video explaining the Fourier transform, they just start jotting down a bunch of Greek symbols in doctor's handwriting like it's supposed to make immediate sense.
I don't understand mathematical notation, so this is a blessing.
I can't wait for your FFT implementation!
Whenever I watch a Sebastian Lague video it reminds me how much fun my side project is and I go and do it instead of doom scrolling. Thanks Sebastian ☺️☺️
Your visualizations for these concepts are really good. This should be required viewing for anyone getting into audio programming.
Sebastian’s videos gives me the confidence to start a project that would need a team of 10 people multiple years to make, then I’m brought back to reality
Worked in audio for a bit in the past. It has been my beloved hobby before and after. Always eager to learn more about how stuff works in the field. Was happily using DAWs without knowing all the complex coding that goes on behind the scenes. Now I feel like I know a fraction of a 10th of a percent of it. Thanks! :D
For the first time in my life, I've actually attempted this before watching this video and not after
I love your video so much
Being deep into signal processing study, this video gave me yet another different visualisation of signals. Very cool to see more people learn this stuff :D