Coding Adventure: Sound (and the Fourier Transform)

  Рет қаралды 422,232

Sebastian Lague

Sebastian Lague

Күн бұрын

Пікірлер: 1 100
@Agent-uj8ud
@Agent-uj8ud 3 ай бұрын
Sebastian Lague’s videos trick me into thinking programming is fun. Thanks!
@Yee_.
@Yee_. 3 ай бұрын
"trick"
@Me-0063
@Me-0063 3 ай бұрын
@@Agent-uj8ud and easy
@stickguy9109
@stickguy9109 3 ай бұрын
It used to be 😭
@renx81
@renx81 3 ай бұрын
It is. Or at least, it can be.
@w花b
@w花b 3 ай бұрын
It is, it's just math with a fancy calculator. Who wouldn't have fun with that?
@Dedicatedfollower467
@Dedicatedfollower467 3 ай бұрын
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.
@lev7509
@lev7509 3 ай бұрын
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!
@blizzy78
@blizzy78 3 ай бұрын
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
@amirulmedia3603
@amirulmedia3603 3 ай бұрын
❤😂🎉😢
@akc21adt
@akc21adt 3 ай бұрын
How this dude comment is 6 hr ago. Since video is 9 min old
@stefanoscintilla5225
@stefanoscintilla5225 3 ай бұрын
​@@akc21adtpatreon maybe
@johnnysvensson
@johnnysvensson 3 ай бұрын
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
@bronsoncarder2491
@bronsoncarder2491 3 ай бұрын
No need to subtract it. Just reverse the phase, it will subtract itself.
@Simat_0
@Simat_0 3 ай бұрын
The ''person that talk about something with nice visual and get you invested no mater what the subject is'' got to be my favorite KZbin genre. Edit : mom I'm famous
@jeffreyrehm8320
@jeffreyrehm8320 3 ай бұрын
3blue1brown
@Simat_0
@Simat_0 3 ай бұрын
@@jeffreyrehm8320 yup
@fubbernuckin
@fubbernuckin 3 ай бұрын
sebastian lague and posy are some of my favorite youtubers. always a good time.
@tomnewsom9124
@tomnewsom9124 3 ай бұрын
Freya Holmér - beautiful videos about splines, beziers and plenty more
@Simat_0
@Simat_0 3 ай бұрын
@@tomnewsom9124 just realizing I've seen plenty of her videos and never actually subscribe because KZbin just kept recommending them, I'm'a correct that right now.
@matzibeater
@matzibeater 3 ай бұрын
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.
@erictheepic5019
@erictheepic5019 3 ай бұрын
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.
@4.0.4
@4.0.4 3 ай бұрын
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.
@R.B.
@R.B. 3 ай бұрын
​@@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.
@timschulz9563
@timschulz9563 3 ай бұрын
Or change the boundary conditions to not reflect but absorb the waves.
@thesenamesaretaken
@thesenamesaretaken 2 ай бұрын
​@@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.
@rarelycomments
@rarelycomments 3 ай бұрын
The FFT is seriously clever and enabled a lot of modern technology. It deserves an entire video tbh
@stickguy9109
@stickguy9109 3 ай бұрын
Veritasium has an entire video on it
@rarelycomments
@rarelycomments 3 ай бұрын
But not about coding it.
@washieman2445
@washieman2445 3 ай бұрын
@@rarelycomments Reducible has a great video on it.
@JonahNelson7
@JonahNelson7 3 ай бұрын
Fuck modern technology!
@lbgstzockt8493
@lbgstzockt8493 3 ай бұрын
It may be the most important algorithm of the modern age.
@vrawl5461
@vrawl5461 3 ай бұрын
Just did a Fourier transform exam last week Sebastian always blows my mind while making me feel like a bad programmer
@feldamar2
@feldamar2 3 ай бұрын
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.
@quickpert1382
@quickpert1382 3 ай бұрын
try be very good at something (just a single domain, either is game dev, web designer, machine learning) and you'll feel better.
@GabrielPettier
@GabrielPettier 3 ай бұрын
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.
@feldamar2
@feldamar2 3 ай бұрын
@@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?"
@quickpert1382
@quickpert1382 3 ай бұрын
@@GabrielPettier right, every good piece of content requires hard work, debugging and curiosity.
@PocinTheTech
@PocinTheTech 3 ай бұрын
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
@kurushimee
@kurushimee 3 ай бұрын
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
@sleepy-monax
@sleepy-monax 3 ай бұрын
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
@uhrguhrguhrg 3 ай бұрын
any big project can be divided into smaller solveable projects start small, experiment, prototype, and you'll learn as you go
@kurushimee
@kurushimee 3 ай бұрын
@@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.
@craftycactus7735
@craftycactus7735 3 ай бұрын
​@@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.
@uhrguhrguhrg
@uhrguhrguhrg 3 ай бұрын
@@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.
@MrHalfLoaf
@MrHalfLoaf 3 ай бұрын
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.
@nankinink
@nankinink 3 ай бұрын
I would add Reducible as well!! The trio for maths and programming!
@nikal8437
@nikal8437 3 ай бұрын
This actually sounds like a pretty interesting video idea!
@2xKTfc
@2xKTfc 3 ай бұрын
Have a look at braintruffle. His most recent video on orbital mechanics was extremely mind-blowing to me.
@abbasuccess3155
@abbasuccess3155 3 ай бұрын
​@@nankinink For real! The first time I watched a Reducible video, I spent the whole video wondering why 3b1b was sounding different 😂😂
@justkirou
@justkirou 3 ай бұрын
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 KZbin for a while now
@ertiikus
@ertiikus Ай бұрын
You're me except you actually tried, I've been thinking of making my own plugins for years haha
@ismailalsaad5481
@ismailalsaad5481 3 ай бұрын
18:00 Sebastian was the cat all along
@EvenTheDogAgrees
@EvenTheDogAgrees 3 ай бұрын
18:04: What??? I never knew you were a cat! I was already impressed, but now you completely blew my mind!
@aaschulz
@aaschulz 3 ай бұрын
we went from watching cat videos to watching videos made by cats !😀
@XandaPanda42
@XandaPanda42 3 ай бұрын
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.
@98ahni
@98ahni 3 ай бұрын
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!
@MandoRick1978
@MandoRick1978 3 ай бұрын
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.
@OtisLaundon
@OtisLaundon 3 ай бұрын
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
@Sillybowler
@Sillybowler 3 ай бұрын
I hope you know how much joy seeing a Sebastian Lague upload brings!
@qwjd8s693pt4kaun
@qwjd8s693pt4kaun 3 ай бұрын
*gaping mouth* I f*cking love science!!!!
@zmania101
@zmania101 3 ай бұрын
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!
@Quazlyy
@Quazlyy 3 ай бұрын
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!
@ahmetenesbulguru2985
@ahmetenesbulguru2985 3 ай бұрын
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!
@Jangoora
@Jangoora 2 ай бұрын
I am a Senior, graduating from college next year. Since the Junior Dev market has been so bad here in the US, I find myself struggling to keep going at it. Thanks to you Seb. I just watch one of your videos and feel motivated to keep studying and grinding. Really re-energizes my curiously and drive.
@haydenwhite8350
@haydenwhite8350 3 ай бұрын
"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!
@agentscott8329
@agentscott8329 3 ай бұрын
As a German I thought this sounded a lot like Danish.
@PKMartin
@PKMartin 3 ай бұрын
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"
@MichaelFlambe
@MichaelFlambe 3 ай бұрын
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!!!
@_rr_-qm5og
@_rr_-qm5og 3 ай бұрын
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.
@akaHarvesteR
@akaHarvesteR 3 ай бұрын
Thanks! I was wondering about that here.
@lev7509
@lev7509 3 ай бұрын
Yep, as someone who knows a bit, i was gonna point out, thanks for doing that! ^^
@refreshfr
@refreshfr 3 ай бұрын
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.
@malbacato91
@malbacato91 3 ай бұрын
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.
@Laiserball8
@Laiserball8 3 ай бұрын
@@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!
@dojohansen123
@dojohansen123 3 ай бұрын
@@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
@fakeaccount6694
@fakeaccount6694 3 ай бұрын
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
@atomictraveller
@atomictraveller 3 ай бұрын
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.
@SomebodyHere-cm8dj
@SomebodyHere-cm8dj 3 ай бұрын
thanks for the description, I'll stay on the lookout​@@atomictraveller
@bobmarley2658
@bobmarley2658 3 ай бұрын
@@atomictraveller huh
@Alexander_Grant
@Alexander_Grant 3 ай бұрын
@@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.
@atomictraveller
@atomictraveller 3 ай бұрын
@@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.
@andreiiosup6622
@andreiiosup6622 Ай бұрын
Your videos helped rediscover my passion for coding.
@Zolbat
@Zolbat 3 ай бұрын
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
@gammapunkgamingproductions6199
@gammapunkgamingproductions6199 3 ай бұрын
11:41 "sounds pretty normal" Bro that sounded like a demon mimicking human speech 😭
@Optimus97
@Optimus97 3 ай бұрын
11:34 you mean?
@nebylet
@nebylet 3 ай бұрын
Lol
@gammapunkgamingproductions6199
@gammapunkgamingproductions6199 3 ай бұрын
​@@Optimus97 yea, lol
@TheyBroughtBackStupidHandles
@TheyBroughtBackStupidHandles 3 ай бұрын
It kinda sounded like a German accent
@lockaltube
@lockaltube 3 ай бұрын
sounds like German. Hallo Ävelon, noch Ich bin wißt so lauf
@IRLtwigstan
@IRLtwigstan 3 ай бұрын
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!
@eltonbergruh8339
@eltonbergruh8339 3 ай бұрын
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.
@SongStudios
@SongStudios 3 ай бұрын
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!!
@Rockittyy
@Rockittyy 2 күн бұрын
HOW CONVINIENT! I've been reasearching about digital audio for a fun project, and bam, when the world needed the most, he did not vanished
@Gwilo
@Gwilo 3 ай бұрын
that cos and sin spinny thingy was everything i always wanted to understand but never did. blew my mind so casually
@atomictraveller
@atomictraveller 3 ай бұрын
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.
@General12th
@General12th 3 ай бұрын
@@atomictraveller There's a point there. I can feel it.
@atomictraveller
@atomictraveller 3 ай бұрын
@@General12th you know ufeelit
@seamuskills
@seamuskills 3 ай бұрын
I love coding adventures because this dude just calmly explains how to do the most complicated things ever as if it is just everyday knowledge. This man is what I want to be one day as a programmer.
@justputitdown
@justputitdown 3 ай бұрын
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.
@Ouvii
@Ouvii 2 ай бұрын
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.
@AjinGixtas
@AjinGixtas 3 ай бұрын
Just finished the video. Thank you for teaching me about sounds. Excited for the next video!
@ImecWarriors
@ImecWarriors 2 ай бұрын
As an predictive maintenance engineer, interpreting vibration patterns of bearings and other rotating equipment (FFT for days)... this was amazing.
@MiniePixie
@MiniePixie 3 ай бұрын
Best explanation of the nyquist theorem ive ever seen, that visual changed how i think of it
@vulcanfeline
@vulcanfeline 3 ай бұрын
as a retired programmer, i really enjoy watching you code even when the subject isn't something i'd even think of being interested in. thank you for your work
@hsvfanjan17
@hsvfanjan17 3 ай бұрын
Love watching these tech adventures accompanied with Sebastian's happy voice, it's almost soothing for the soul!
@adamrushford
@adamrushford 3 ай бұрын
unless you're me, then it's enraging
@average6317
@average6317 3 ай бұрын
@@adamrushford Right? It sounds like he's forcing a smile the entire video, it gives me uncomfortable goosebumps
@adamrushford
@adamrushford 3 ай бұрын
@@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
@adamrushford
@adamrushford 3 ай бұрын
@@average6317 for me I can't stand anyone who deliberately acts nice or bubbly, it's removed from reality AND their true emotions
@Yosef_Marks
@Yosef_Marks 3 ай бұрын
I love when he talks about something I've learnt about before. It makes me kinda happy to see how my education has made me a more knowledgable person.
@theparawarrior
@theparawarrior 3 ай бұрын
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.
@kierkegaard54
@kierkegaard54 3 ай бұрын
This is by far my favorite KZbin voice
@CloudPhase
@CloudPhase 3 ай бұрын
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!
@slaeh2225
@slaeh2225 3 ай бұрын
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
@RealTwiner
@RealTwiner 3 ай бұрын
Ah, good morning indeed! Always a good day when a new coding adventure drops.
@warmoverdrive
@warmoverdrive 3 ай бұрын
This is great! I'd been hoping you'd cover audio, DSP, and DFT/FFT someday, and this was a great video to come home from work to!
@abellematheux7632
@abellematheux7632 3 ай бұрын
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.
@Solanaar
@Solanaar 3 ай бұрын
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.
@RoyalArthurio
@RoyalArthurio 3 ай бұрын
​@@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.
@royalninja2823
@royalninja2823 3 ай бұрын
I love your clear explanations for what you're doing and why you're doing it and the math involved, I love your voice, I love your cat.
@LetsSmiley
@LetsSmiley 3 ай бұрын
Thats a phenomenal start into the day. Thanks
@JackTheFoxOtter
@JackTheFoxOtter 3 ай бұрын
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! :)
@nom21304
@nom21304 3 ай бұрын
no wayy I was watching your videos all week and was sad I've seen the last one 😂 I love it 🤩
@98Vuk
@98Vuk 3 ай бұрын
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 ❤
@4547466
@4547466 3 ай бұрын
"Hello everyone, welcome back to another episode of coding adventures" In that buttery smooth voice gets me every time.
@ОлегПасатецкий
@ОлегПасатецкий 3 ай бұрын
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
@mariandev
@mariandev 3 ай бұрын
Great video as always. Keep up the good work 🎉
@SebastianLague
@SebastianLague 3 ай бұрын
@@mariandev Thank you!
@lycor
@lycor 3 ай бұрын
How is this posted 14 hrs ago... when the video was uploaded 45 mins ago!
@GabrielPettier
@GabrielPettier 3 ай бұрын
@@lycor surely patreons get access to it before it's public.
@lycor
@lycor 3 ай бұрын
You're right!
@9Syren9
@9Syren9 3 ай бұрын
A Sebastian Lague video about audio programming? Is it my birthday? Incredible video, and I’d love to see more stuff like this in the audio space as someone with aspirations of creating audio software.
@ninojamestan8895
@ninojamestan8895 3 ай бұрын
Imagine having a bad day then you saw Sebastian uploaded a new video.
@ThePicklish
@ThePicklish 2 ай бұрын
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
@blazen_gaming3290
@blazen_gaming3290 3 ай бұрын
i get so happy whenever i see any of your videos on my recommended :D
@tamrat_assefa
@tamrat_assefa 3 ай бұрын
As always... got lost when Fourier Transforms came into play... Its just incredible how much information is packed in your videos. So good!
@lucbloom
@lucbloom 3 ай бұрын
Sorry kids, I know we’re on vacation, but daddy’s gonna take 43:31 minutes to relax.
@gold_apple_vn4657
@gold_apple_vn4657 3 ай бұрын
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??
@metashrew
@metashrew 3 ай бұрын
Oh my god a video about sound. I've been waiting for this
@uniqueflowsnake
@uniqueflowsnake 3 ай бұрын
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
@ninjacodertech
@ninjacodertech 3 ай бұрын
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.
@chriskaprys
@chriskaprys 2 ай бұрын
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.
@levb258
@levb258 3 ай бұрын
Sebastian Lague is actually the cat.
@JoshBrak
@JoshBrak 3 ай бұрын
Still mesmerized by your ability to make topics that are incomprehensible to me so fascinating and riveting to watch.
@The_master_of_frogs
@The_master_of_frogs 3 ай бұрын
It's a good day when Sebastian blesses us with another god tier video
@adamrushford
@adamrushford 3 ай бұрын
you need to get out more
@frechesbienchen4720
@frechesbienchen4720 3 ай бұрын
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.
@benmolitor1519
@benmolitor1519 3 ай бұрын
Lools like Sebastian is a Tau person lol. Good to see other chronically online math nerds are out there
@just_Ro
@just_Ro 3 ай бұрын
This video was delightfull. And this is coming from a guy who already had boring college classes that taught this. Congratulations on the incredible explanation! I love your channel for these!
@ImLoLGamer1002
@ImLoLGamer1002 3 ай бұрын
im here 45 SECONDS after upload, and somehow 94 people were here before me. This is insane, and very deserved
@darklord3176
@darklord3176 3 ай бұрын
Same😂
@danisanchez1737
@danisanchez1737 3 ай бұрын
4min after XD, i love this guy, if i see him instaly hit his video, youtube knows so he recomends right after upluoad
@GameBacardi
@GameBacardi 3 ай бұрын
...bots
@HalirouHabib
@HalirouHabib 3 ай бұрын
after 6minutes 1400 😂😂
@stevenmathews7621
@stevenmathews7621 3 ай бұрын
Exactly what I was thinking, Lague is the shizzle
@mylesbuckley9675
@mylesbuckley9675 3 ай бұрын
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 ☺️☺️
@bronsoncarder2491
@bronsoncarder2491 3 ай бұрын
I really hope you see this comment! So, this is actually something I've been thinking about for a long time. I'm a music producer, and aspiring video game programmer, and I've been thinking for a while how there hasn't ever really been any huge advancements in realistic live soundstaging technology, and if someone did it they could revolutionize gaming. ...But, frankly, I'm not a great programmer, so I haven't gotten anywhere close to the point of doing the research to make this a reality... Anyway, here's my idea, that I think might actually have just become possible with the research you've just done: In music production, there are things called Impulses. Frankly, I don't know exactly how they work, but basically you record a simple sound in an area, and then you can use that sound as an impulse, to create a reverb effect. Any sound you play through this reverb effect will sound like it was recorded in the same location as the impulse. And I've thought for a long time now, that if you could take impulses of computer generated spaces, you could create an accurate soundstage of that space. Imagine firing a gun in a tunnel, and actually listening to the sound of it reverberate down that entire space. Or something shifts in the distance, and you can hear it, and know accurately where it is, just the same as you could in real life. Or take advantage of the acoustics of an area, bounce a sound off of a wall to make it sound like it's coming from a different direction. All of this would theoretically be possible if we could take live impulses of computer generated spaces... And that's basically exactly what you've just programmed. I never thought to simulate the air itself. That's actually genius.
@soviut303
@soviut303 3 ай бұрын
Your visualizations for these concepts are really good. This should be required viewing for anyone getting into audio programming.
@siomek101
@siomek101 3 ай бұрын
babe wake up sebastian uploaded
@cazza358
@cazza358 3 ай бұрын
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 KZbin.
@PadPalon
@PadPalon 3 ай бұрын
Only just started the video, but can't get over the frightening teeth at 0:18
@Mhrn.Bzrafkn
@Mhrn.Bzrafkn 3 ай бұрын
It was amazing! You visually presented everything I learned in my university Signals and Systems course, making the concepts much more understandable for those who find them difficult to grasp.
@lominero5
@lominero5 3 ай бұрын
Today is a great day! 🎉
@michelepinato1158
@michelepinato1158 3 ай бұрын
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
@outoftime9071
@outoftime9071 3 ай бұрын
Is the cat coding and making all the videos? ARE YOU THE CATTTT?
@aubryoakes7108
@aubryoakes7108 3 ай бұрын
I love messing with fourier transforms, but you transmitting sound within a fluid sim is probably my favorite part of the video. it sounded like an old-timey gramophone recording!
@EshaanKataria-qx8rp
@EshaanKataria-qx8rp 3 ай бұрын
vote for who want how do computers work series back
@P4INKiller
@P4INKiller 3 ай бұрын
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!
@Shlaboza
@Shlaboza 3 ай бұрын
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
@donotoliver
@donotoliver 3 ай бұрын
nah u trippin balls
@Shlaboza
@Shlaboza 3 ай бұрын
@@donotoliver you can literally see the waves rebounding and hitting the mic again when he visualised it
@atomictraveller
@atomictraveller 3 ай бұрын
you could fft(log10(fft())) cepstrum them away to magical not here land just liek where masons send people who can actually do anything
@donotoliver
@donotoliver 3 ай бұрын
@@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
@bobmcbob4399
@bobmcbob4399 3 ай бұрын
In his refined voice, I would like Sebastian Lague narrate the exact word by word script of a DankPods video. That would be something to behold.
@igonorant2583
@igonorant2583 3 ай бұрын
Incredible video! When working in automobile industry R&D, we had a rule of "sample at least 10 times the maximum frequency you want to observe". Even that is true sampling a little above Nyquist frequency to ensure no frequency information is lost, some amplitude data of the waves can be lost. There was a table with those results (I could not find it sadly), but sampling at Nyquist we could ensure like we kept 50% of the average amplitude. With 10 times the maximum signal frequency (5 times Nyquist's), if I remember correctly, the sampled signal preserves around 95% of the average amplitude. The amplitude were very significant for vehicle R&D, we were usually interested up to 50Hz, so we sampled at 512-1024 Hz (just to be safe). For audio, I think it is ok some kind of loss in higher frequencies, that's probably why standard samples are 44-48 kHz. Just wanted to share how FFT impact places we not even imagine, thanks again for the great content!
@olhoTron
@olhoTron 3 ай бұрын
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
@DaminGamerMC
@DaminGamerMC 3 ай бұрын
I stopped understanding the video at 00:00 but still keep watching because you are really fun
@a52productions
@a52productions 3 ай бұрын
I love how you answer your own question in this video! At the beginning you wonder "How can we store something as complex as an audio signal with so few samples", and by the end you're covering the Nyquist Shannon theorem. Signal processing and audio is one of my favorite fields, and it's always great seeing someone else discover it -- especially with your beautiful animations!
@AkioJunichiro
@AkioJunichiro 3 ай бұрын
Always a pleasure to see your take on a topic. Here since Platformer2D with raycast collision.
@Luzgar
@Luzgar 3 ай бұрын
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.
@bluemond100
@bluemond100 3 ай бұрын
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
@bluemond100
@bluemond100 3 ай бұрын
I did mess around with the FT at some point to try to make a sound denoiser. FT is mad powerful
@zix2421
@zix2421 3 ай бұрын
Oh my, sound exist! Interesting theme, thank you
Coding Adventure: Optimizing a Ray Tracer (by building a BVH)
52:13
Sebastian Lague
Рет қаралды 457 М.
Coding Adventure: Rendering Text
1:10:54
Sebastian Lague
Рет қаралды 743 М.
Ice Cream or Surprise Trip Around the World?
00:31
Hungry FAM
Рет қаралды 20 МЛН
How Much Tape To Stop A Lamborghini?
00:15
MrBeast
Рет қаралды 202 МЛН
FOREVER BUNNY
00:14
Natan por Aí
Рет қаралды 21 МЛН
I Tried Making A Particle System
35:33
Acerola
Рет қаралды 272 М.
How on Earth does ^.?$|^(..+?)\1+$ produce primes?
18:37
Stand-up Maths
Рет қаралды 408 М.
Better Mountain Generators That Aren't Perlin Noise or Erosion
18:09
Josh's Channel
Рет қаралды 415 М.
Coding Adventure: Simulating Fluids
47:52
Sebastian Lague
Рет қаралды 1,9 МЛН
The moment we stopped understanding AI [AlexNet]
17:38
Welch Labs
Рет қаралды 1,3 МЛН
Why 4d geometry makes me sad
29:42
3Blue1Brown
Рет қаралды 916 М.
Adding Mechanical Sound Simulation to My Audio Engine
18:50
AngeTheGreat
Рет қаралды 200 М.
Coding Adventure: Solar System
12:12
Sebastian Lague
Рет қаралды 864 М.
Ice Cream or Surprise Trip Around the World?
00:31
Hungry FAM
Рет қаралды 20 МЛН