Physics graduate here. Those ripples on the corners of the square wave are an artifact which results from the fact that since the square wave is a periodic function you can write it as an infinite sum of sines (or cosines depending on the phase) with appropriate coefficients which is called a Fourier Series, BUT since it also has a discontinuity any FINITE sum of the terms of said series is bound to produce a little jump at the two extremities of the discontinuities. Since PC's are real machines which can't produce and overlay an infinite amount of sines, the results is those ripples, which as Multiplier correctly said, are called "Gibbs Phenomenon". That's the math behind it :)
A Fourier decomposition of a periodic function is an infinite series of sine and cosine terms, not or. Since the sum of a sine and cosine wave of the same frequency is a third wave of the same frequency phase shifted. The ratio between the amplitudes of the sine and cosine Fourier coefficients determine the phase shift of the various frequencies contained in the spectrum.
Well said. But what I didn't find explained in the video or in your comment was that are DACs actually using sine waves or Fourier in the analog conversion? I don't think that makes sense, so I don't think Gibbs is strictly the name of the phenomenon that happens to the audio signal at any stage unless you're visualizing it somehow. The signal probably does undergo wibblywobbly over and undershoots though, when outputting the analog signal and by latest when the speaker element is wobbling around. EDIT: OK! Apparently you have to do low pass filtering when doing the analog conversion to avoid aliasing from frequencies above nyquist that arise from discrete samples. That low passing probably means some sort of fourier thing is happening at that stage as well so Gibbs will also happen. See en.wikipedia.org/wiki/Ringing_artifacts or www.head-fi.org/threads/why-do-dacs-need-filters.899028/ if interested. Interesting!
I read somewhere too that even in 'real' applications, the time required to change from one frequency to another is the limiting factor that helps to produce the Gibb's phenomena
If you think about it, playing a perfect square wave out of a speaker isn't physically possible, the cone simply can't jump between a position of 0 & 1. it has to gradually, physically go forward to 1 and back to zero (the lower the frequency, the more the movement is visible) hence, the trajectory has to be curved.
Bingo. I scrolled down here hoping someone had said this. I feel the video entirely misses the point that a square wave is not physically possible, and seeing/thinking of a wave as square is a useful abstraction at best. No matter how fast anything moves, the slope can approach vertical, but never get there.
The square wave is filtered (in the systems and signal sense, not like an EQ or a synth), so yeah it doesn't instantly move from 0 to 1, but this shouldn't be dependent on the frequency. The lower the frequency the more movement is actually visible because you can't see the movement and instead see the gaps where it doesn't move. Try it for yourself (physically or in a daw): generate a 100Hz square wave and filter it at 10k or something. If you increase the frequency of the square wave to 300Hz but keep the filter the same. The curves where the square waves goes from 0 to 1 are about the same slope.
but the waveform isnt showing the position of the cone, right? isnt it showing the air pressure? so the cone doesn't have to jump between a position of -1 and 1, it has to jump between a velocity of -1 and 1.
I'm taking a class right now on communication theory, it goes into all the crazy math of stuff like this and it baffles my mind that in these classes no one has an intuitive grasp of stuff like this. They look at me like I'm nuts when I open FL and try to show them why the equations actually matter. It's so layered in the muck of math and how its taught in a fire hose way that the "art" of it gets lost. I am always so happy to the results made easy to understand.
What's interesting is if you hook up a real oscilloscope to a square wave being produced by an analog oscillator circuit and zoom in to the leading or trailing edge corners, you see the same "wibbles and wobbles". In the electronics world it's called (component) ringing. It's frequency is completely independent of the signal frequency, and, believe it or not, is caused by the inertia of the electrons moving through the traces of the PC board, the leads of the components in the circuit and even inside the semiconductors (transistors) themselves. Two identical circuits will ring with different frequencies and different fall-off intervals; ringing is extremely difficult to filter out because it's at such low db levels to begin with; and a single circuit will ring with the exact same parameters for ever, as long as no changes are made to the physical components in the circuit. This is a key fact in modern electronic warfare, but you will have to use your imagination to figure out how.
I was brought up in the analog days and was very familiar with the "ringing" of a square wave so I naturally assumed this was the same case when talking digital. But to find out it's the sampling and math that causes it. I'm still a bit perplexed that both analog and digital suffer from basically the same issue but for different reasons.
LC ringing occurs only on the top of the rising edge and the bottom of the falling edge in analog circuits, rather than on all corners like in a digitally synthesized square Really neat how that LC ringing comes about even when you don’t design it, from all that parasitic effects you mentioned
@@TwskiTV ... used in over the horizon identification. Not to seem dramatic, but the specifics are classified. ... but all radar, whether navigation or missile guidance works by emitting electromagnetic, square wave pulses and that's true no matter who's military you are talking about. The "ringing" in the pulse is detectable.
The math required to reconstruct a wave from a set of discrete samples is called the "sinc interpolation" formula and it's the single concept that made everything click for me when it comes to digital audio. Incidentally, it's also the formula that made me snap out of my audiophool phase that once persuaded me to chase recordings with impractically high sampling rates.
Not completely. This interpolation is what is used to show signals on screen. To reconstruct it to analog signals it's more just a simple "stair-stepped wave" (okay not really as that is impossible, more a stair sloped wave) ran through an analog filter. Because of Fourier analysis this then returns the original signal (given that the original signal was filtered at the Nyquist Shannon frequency to begin with).
Easiest thing to understand is that in digital audio only points are stored, without connection lines. An attempt to figure out how exactly points should be connected to make analog signal will lead to information about interpolation, Nyquist-Shannon theorem etc.
@@JoQeZzZ The interpolation process is not only used for visual representation, but also mathematical reconstruction. The D/A conversion process you're describing only applies to older Non-Oversamplisng designs which are very rare to find these days. These days, almost all DACs would use oversampling because, while mathematically less intuitive, is actually much more cost-effective to implement in hardware while resulting in better objective output measurements. The sinc filter is the golden standard for oversampling digital signals, but its main problem is that the actual computation introduces a lot of latency in the chain. There are many other oversampling techniques used in actual hardware designs that are quicker but the Nyquist theorem and the sinc interpolation techniques remain proof that no audible and relevant resolution is really lost from a 48 kHz source. One can always oversample in software with the actual sinc filter itself anyways if it's an option.
@@Goodmanperson55 I had the same revelations. :) And the further realisation that the amplitude of the interpolated analog signal from a DAC might exceed digital full-scale, so you should leave some headroom. IMO, too many introductions to audio sampling show jaggy, rectangular waveforms, and in the graphics world there's generally no post-DAC filtering, so we're used to the (spatially and temporally) aliased look of computer displays.
This is one of the better videos explaining aliasing. Last time I looked it up I got hit with a bunch of jargon and math terminology that kind of killed it for me, so as far as I'm concerned, you nailed it my man! Great video!
The fundamental (or essential) waves from which all other waves are constructed here are sinusoids (sine waves). One needs to go all the way to infinity to make true square (or triangular, or many many other) waves out of the sine waves. One does not have that luxury. For details, see Fourier series.
The math is actually quite simple: a perfect square needs an infinite amount of frequencies! The magnitude of each higher frequency tampers off compared to the previous one, but in order to have a perfect square shape in your waveform, all you need (in theory) is that your series of harmonics goes on for infinity. This also explains the “wobbly bits”, as they are called in this video, as well as the aliasing, quite easily: because you can only represent a finite amount of frequencies (due to your sampling rate, see Nyquist theorem) you simply cannot put all the necessary frequencies into your waveform that are needed to make it a perfectly square wave. So you have two options: (1) generate a perfect square wave anyway. This, though, produces all the frequencies above the Nyquist limit. What happens to these frequencies above that limit is that they are aliased back into the representable frequency range (e.g. 0-24k Hz using 48kHz sampling rate). You can imagine this like a mirror but for frequencies. Also, this does not result in a perfect square wave anyway, since the originally infinite series of harmonics is now distorted downwards. The other option is (2), where you low pass filter you generated square wave around the Nyquist limit. This prevents aliasing, since all the frequencies that would be aliased are now filtered out. However, because you don’t have all frequencies of the necessary infinite series present, you square wave is not “complete” and, thus, exhibits “wobbly bits”. Imagine that each harmonic in the series reduces the “wobble” just a tad more. So it’s all about missing frequencies, that you very likely don’t even hear anyway, since we’re taking about frequencies above the general hearing limit. You can imagine that, should a perfect square wave be emitted for you to hear, what arrives in your brain is a wave akin to the wobbly one in the video anyway - because you’re missing the upper frequencies of the infinite series since your hearing will always have some type of limit anyway. Fourier is a hell of drug!
That last paragraph you wrote is very interesting actually - true, even if we approximate the square wave better and better using the later terms of the infinite series (ie the higher frequencies) we will be adding frequencies that are above human hearing... so I guess we can't even experience a true square wave 🤔🤔🤔🤔
@@diabl2master "... in theory, the square wave can be represented by an infinite sum of sine waves, which is true." No, it isn't true! I admit, it does sound intuitive that it might be true but it is not even in theory. That is what Gibbs found. He said that it does not matter how high a frequency you use there will always be that ringing overshoot effect at the corners. Do a search on Gibbs Phenomenon and check for yourself. Yes, you are right about not being able to hear a true square wave. Mathematicians see a square wave as having two flat lines and a single point halfway between them so, mathematically, there is no leading edge or trailing edge because if there were then the function would be multi-valued at that point. Engineers have a lot of trouble with mathematicians! The other point is that, in real life, everything has limited bandwidth so those high frequencies will always be lost somewhere along the way.
@@T0NYD1CK Square waves can be perfectly represented by an infinite sum of sine waves. This is in accordance to a theorem that says that any periodic real function can be represented exactly by a Fourier series (assuming you buy into the mathematics of real analysis). Gibbs Phenomenon specifically limits itself to finite partial sums, hence the discrepancy. Arbitrarily large finite sums do not always behave the same as infinite sums. (Example irrational numbers can be expressed as an infinite sum of rationals, yet no partial sum of such series is irrational, no matter how far you finitely sum along it.)
I remember discovering this as well and being fascinated. That spiky phase rotated square has the same phase relationships as a triangle wave, but it still has the harmonic levels of a square wave. You can also phase rotate a triangle wave into a rounded square wave.
When i make music, i pay very close attention to my waveforms. Especially the square ones. Also i think this video is interesting cause even small changes in the sound matters very much. Congrats on your 100k subs.
Something weird happens at 3:18 when using AirPods Pro... The frequency/frequencies played messes with some stuff relating to the AirPods Pro's noise cancelling feature. I've watched this section like 10 times now and noticed that sometimes one AirPod goes into noise cancelling and the other doesn't. If you pause the video the noise cancelling feature 'fades' back to normal. Can anyone else try this out?
The subtleties they don’t teach you in recording school….. great video! I really enjoy making “graphic pulses” with 4-8 step voltage sequencers. Setting all of the odd steps to maximum, and leaving the even steps at 0. Clocking the sequencer at audio rates creates very rich square waves, with somewhat-adjustable harmonics! This is in the analog realm, mind you. I’m fairly sure that in the digital realm, the results would fall back to exactly what this video is covering. Edit for spelling
that phase rotation thing for asymmetrical audio is neat! I'm working on a close miked cover of Eleanor Rigby and I was wondering why some of the takes of the violin audio were distorted even though they werent clipping. I'm not using those takes but I'll run them thru rx to see if it helps
Used to love playing around with old LS JK Flip Flop chips to generate octave down square waves from whatever audio I shoved in via a Schmidt trigger... then messing about with the edge rise/fall times and putting it through an active full wave rectifier :)
Even though I doubt I will ever have much practical use for this information, I was pleasantly surprised to learn this. Your explanations are wonderfully explained to a point in which someone with minimal understanding of sound design (Me lol) was able to comprehend everything being said.
Thumbs up for the explanation. However, I have to say that, yes, you DO need to know this stuff if you're even an amateur Sound or Electronics Engineer. Knowing this is the first step of isolating a problem before diagnosing, then fixing it. As you touched on, in Sound Engineering, the true shape often has to do with sample rates, clipping, etc. In Electronics it has a lot more to do with the hardware; mostly tolerances and leakages/interference. Bored me out of my skull because I've been into and studied Electronics Engineering since Kindergarten, and took a college course in it. But all that means is that it was an excellent explanation. I've seen ones that confused me, some that left enough out or got enough wrong to irritate me, but this did neither. Note: Boredom does not mean lack of interest. I wasn't able to stop watching because I love the subject and was curious how you would explain it. You did a better job than two of my five professors in the college EET course(one of whom was an idiot who didn't believe in microwave power transmission and was extremely skeptical of the newfangled, at the time, wireless charging. LOL).
I don't get how that phase rotated square looked so different. Were some frequencies rotated and others not? Cause surly rotating the whole wave would have no effect on the sound or wave form other than to move it to the left or right.
@Firstname Lastname Thanks, Not sure I have completely understood the significance of that particular mathematical operation, but I at least get the basic idea, that the frequencies have be shifted by different amounts, allowing a wave with the same frequency content while looking completely different.
the waveform charts the motion of the speaker diaphragm over time. a vertical line would be the speaker diaphragm moving some distance in zero time, which would require infinite energy.
Gibb's phenomenon. Basically, you just can't have jump discontinuities when constructing a wave with a Fourier series (a combination of sine and cosine waves), i.e. no vertical jumps like in square waves and sawtooth waves.
phase rotation is different than phase shift. I'm trying to discover and find out how to shift an audio wave without changing it's shape, for the very reason that you showed in this video. I have been trying to figure it out since 2017
@@lightningmcqueen1577 ahhh, you're using desmos. nice. i don't know the math behind it, but it does shift sine waves, however, it destroys square waves. like the video showed. I think it's called the hilbert transform.
someone needs to explain why the Casio WK-1800 has a square wave that when played through an oscilloscope, DSP effects off, direct from stereo line out, to a stereo scope (one wave for the left, and right channels respectively), Resembles a sine wave, but it isn't...
Allow me to introduce a new unit of measurement for sound volume, which I call vovol* (abbreviated: volume voltage). THIS IS HOW IT WORKS: You use two pre-stages, one with positive volume values, and the other negative. For example, so has the pre-step with positive values a measurement from +0 decibels up to +20, while the one with negative values, has from -0 decibels down to -20 decibels. The highest voltage occurs when the value is +20 and -20 decibels (or: 20 vovol), while there is low voltage, when the value is on +0 and -0 decibels (or: 0 vovol). You can possibly also combine two different values with each other, by adjusting the value to +10 -20 vovol, which gives a crisper effect. Have experimented with this myself at work and at home. The adjustment can of course be set to taste, but the purpose of vovol for me is to equalize the sound volume, so that you better hear weak sounds and at the same time avoid high deafening sound levels (loudness war's). Thank you for reading this! Take care of your hearing... :-)
There is a youtube claiming that digital sound is inaccurate because he generates a square wave then takes a spectrum in some program and claims there are aliasing frequencies below the fundamental. While that sounds wrong and makes me suspect the implementation of the spectral analyzer (poorly windowed maybe?), I did point out that he didn't prove that digitally sampled sound has aliasing frequencies, because he didn't digitally sample sound, he generated it. And if he wanted to generate a square wave with a brick wall roll off at 20 kHz and therefor no way for a bad filtering process to reflect the > 20 kHz harmonics down, he'd have to generate a square wave with gibbs phenomena. Easy to do, just build it out of sine waves and don't use any of the harmonics over 20 kHz.
I forgot what low frequency squarewaves sound like and so for half this video it felt like I was being gas-lighted into thinking squarewaves sound like sawtooth.
To explain the Gibbs phenomenon to those who are not that familiar with that topic: In theory, every periodic waveform (for example a square wave, sawtooth etc.) can be replicated by using particular sine waves with different frequencies, amplitudes and phase shifts (If you take a look on your audio analyzer, this is what you might call "harmonics" when for example distorting/saturating the signal). In Fourier's theory, you would need infinite different sine waves to get a very pure square wave out of sine waves. Practically this is not possible, since you cant use "infinite" sine waves. Or to explain it from another perspective. A pure square would mean that your signal had to travel from -1 to 1 in a period of 0 seconds (let the x-axis be the time and the y-axis the amplitude). But by just using pure sine waves you won't reach that "infinitly steep" rising edge or falling edge of a square wave signal. So you are just able to approximate it.
As a student who studied physics, and thus wave mechanics, this is the right answer. For anyone wanting to understand where Gibbs Phenomenon comes from, you'll first have to understand what Fourier Series are.
Great video. But I have one bone to pick. On steady state signals phase rotation is (generally) not audible (providing no nonlinearities creep in). But, adaptive phase rotation on non-steady-state signals can absolutely be audible. There was a recent video by a reputable company where a mastering engineer said he always starts by applying phase rotation and doesn't even listen to the results. That is horrifying. Please, no one do this. Phase rotation can absolutely be useful, but we should always listen to the results of what we're doing.
Nature doesn’t have two values for the derivative of a single point of any function of time. This limits perfect square waves to the domain of mathematics. In other words, nature smooths things out.
what? There are not two values, the derivative of a square wave at the jump singularity is just a dirac function. That said, dirac functions are merely a theoretical construct but could be approximated to a high degree even in nature.
What about not using it over time and more like a frequency domain similar to when you can hear audio slowed down and have no pitch change. It’s seems more like the values are being cut and paste closer or further apart making more frames in a sense than stretching.
How I like to explain Gibb's Phenomenon: imagine the waveform line represents the vertical position of a speaker cone when viewed from the side, where the middle line is where the cone rests when there's no signal. In this case, it's clear that the speaker cone can't be physically snapped instantaneously from one position to another: it takes some time to move. The cone itself is also no ideal: it has mass. So when you do try to move it, it has momentum, and changing the signal from one height to another will make it bounce, like a spring, until it settles on that height. This is an awful explanation from a signal analysis perspective, and makes it hard to grasp why making the waveform "more square" produces artifacts, but it works for a lot of people.
mate, ive used a sample from this video in a song and i would like to put that song on an ep. is it okay if i use it. i will credit you. and if i ever make any money off it i will compensate you what is fair!
make more video like this. It is kind of silly to say that I just know the reason why my low cut filter makes my audio louder on the meter in this video. i just never thought that the phase shifting problem cause that much.
God I'm so envious of your microphones 😂❤️ Edit: Ok I'm also very envious of your vast knowledge and will binge watch all your content now to start working in filling that gap 😂
Me an armchair calculus enthusiast: What if you amplified the Square Wave and the Pointy Thing until they each marked out the same area above and below the middle point?
as whene i know actually better for your speaker a fake square wave like a pure cause your speaker dish fallow the curve and this is huge movement and big energy investment: sharp pull and need to keep same level the freq and pull back qickly.speaker will be much more sustainable and more lifetime with fake or breaked signal.but i think if you play with context is not problem ,like live act with many sound cause mixed the signal other freq so try avoid a loud long solo
Not trying to correct anything but I think of it as like a tube instead of height depth more like a tube of water and how cold or hot is the water hot water can move around a lot and be pushed together more and sound a lot louder than water which is completely cold and doesn't move around a lot at all so you think of it that way how hot do you want your water to be and how much can you too get take this way I look at it the loudness level thing because sometimes you want that tube to sound full lots of water but only a tiny bit of heat minimal... Or it's Splash tube which has very little water but a lot going on friction wise friction wise but in certain places and that's why it's fun these things translate through all things I've find these days it's fun your videos are dope man sorry about the ears i .ildly understand.. hut have beej protectijng the left as hbest as can
Physics graduate here. Those ripples on the corners of the square wave are an artifact which results from the fact that since the square wave is a periodic function you can write it as an infinite sum of sines (or cosines depending on the phase) with appropriate coefficients which is called a Fourier Series, BUT since it also has a discontinuity any FINITE sum of the terms of said series is bound to produce a little jump at the two extremities of the discontinuities. Since PC's are real machines which can't produce and overlay an infinite amount of sines, the results is those ripples, which as Multiplier correctly said, are called "Gibbs Phenomenon". That's the math behind it :)
Nice. I like physics also. Is this music class, or math class ... Electronic music uses a lot of those mathematical waveforms. :)
Yeah I think from what I remember when the functions discontinuous the series takes the average value of the discontinuous points
A Fourier decomposition of a periodic function is an infinite series of sine and cosine terms, not or. Since the sum of a sine and cosine wave of the same frequency is a third wave of the same frequency phase shifted. The ratio between the amplitudes of the sine and cosine Fourier coefficients determine the phase shift of the various frequencies contained in the spectrum.
Well said. But what I didn't find explained in the video or in your comment was that are DACs actually using sine waves or Fourier in the analog conversion? I don't think that makes sense, so I don't think Gibbs is strictly the name of the phenomenon that happens to the audio signal at any stage unless you're visualizing it somehow. The signal probably does undergo wibblywobbly over and undershoots though, when outputting the analog signal and by latest when the speaker element is wobbling around.
EDIT: OK! Apparently you have to do low pass filtering when doing the analog conversion to avoid aliasing from frequencies above nyquist that arise from discrete samples. That low passing probably means some sort of fourier thing is happening at that stage as well so Gibbs will also happen. See en.wikipedia.org/wiki/Ringing_artifacts or www.head-fi.org/threads/why-do-dacs-need-filters.899028/ if interested.
Interesting!
I read somewhere too that even in 'real' applications, the time required to change from one frequency to another is the limiting factor that helps to produce the Gibb's phenomena
If you think about it, playing a perfect square wave out of a speaker isn't physically possible, the cone simply can't jump between a position of 0 & 1. it has to gradually, physically go forward to 1 and back to zero (the lower the frequency, the more the movement is visible) hence, the trajectory has to be curved.
Bingo. I scrolled down here hoping someone had said this. I feel the video entirely misses the point that a square wave is not physically possible, and seeing/thinking of a wave as square is a useful abstraction at best. No matter how fast anything moves, the slope can approach vertical, but never get there.
@@k54ltyd28 and that’s where the calculus class comes in
The square wave is filtered (in the systems and signal sense, not like an EQ or a synth), so yeah it doesn't instantly move from 0 to 1, but this shouldn't be dependent on the frequency. The lower the frequency the more movement is actually visible because you can't see the movement and instead see the gaps where it doesn't move.
Try it for yourself (physically or in a daw): generate a 100Hz square wave and filter it at 10k or something. If you increase the frequency of the square wave to 300Hz but keep the filter the same. The curves where the square waves goes from 0 to 1 are about the same slope.
@@chrislaurentmusic let's goooo
but the waveform isnt showing the position of the cone, right? isnt it showing the air pressure? so the cone doesn't have to jump between a position of -1 and 1, it has to jump between a velocity of -1 and 1.
I'm taking a class right now on communication theory, it goes into all the crazy math of stuff like this and it baffles my mind that in these classes no one has an intuitive grasp of stuff like this. They look at me like I'm nuts when I open FL and try to show them why the equations actually matter. It's so layered in the muck of math and how its taught in a fire hose way that the "art" of it gets lost. I am always so happy to the results made easy to understand.
right. not many teachers have the ability to show the true art of signals and systems
your channel is amazing
Huh?
Anyone reading this Check about Composing Gloves tremendous YT channel!!
Reminds me of listening to my dad talk about skiing and I'm just like "yep, vectors and phasing and waves, oh my!"
What's interesting is if you hook up a real oscilloscope to a square wave being produced by an analog oscillator circuit and zoom in to the leading or trailing edge corners, you see the same "wibbles and wobbles". In the electronics world it's called (component) ringing. It's frequency is completely independent of the signal frequency, and, believe it or not, is caused by the inertia of the electrons moving through the traces of the PC board, the leads of the components in the circuit and even inside the semiconductors (transistors) themselves. Two identical circuits will ring with different frequencies and different fall-off intervals; ringing is extremely difficult to filter out because it's at such low db levels to begin with; and a single circuit will ring with the exact same parameters for ever, as long as no changes are made to the physical components in the circuit. This is a key fact in modern electronic warfare, but you will have to use your imagination to figure out how.
I was brought up in the analog days and was very familiar with the "ringing" of a square wave so I naturally assumed this was the same case when talking digital. But to find out it's the sampling and math that causes it. I'm still a bit perplexed that both analog and digital suffer from basically the same issue but for different reasons.
LC ringing occurs only on the top of the rising edge and the bottom of the falling edge in analog circuits, rather than on all corners like in a digitally synthesized square
Really neat how that LC ringing comes about even when you don’t design it, from all that parasitic effects you mentioned
@@derivativ3 You explain it better than I did on where it occurs.
About the electronic warfare, is that phenomenon used to check if equipment has been tampered with?
@@TwskiTV ... used in over the horizon identification. Not to seem dramatic, but the specifics are classified. ... but all radar, whether navigation or missile guidance works by emitting electromagnetic, square wave pulses and that's true no matter who's military you are talking about. The "ringing" in the pulse is detectable.
The math required to reconstruct a wave from a set of discrete samples is called the "sinc interpolation" formula and it's the single concept that made everything click for me when it comes to digital audio. Incidentally, it's also the formula that made me snap out of my audiophool phase that once persuaded me to chase recordings with impractically high sampling rates.
Not completely. This interpolation is what is used to show signals on screen. To reconstruct it to analog signals it's more just a simple "stair-stepped wave" (okay not really as that is impossible, more a stair sloped wave) ran through an analog filter. Because of Fourier analysis this then returns the original signal (given that the original signal was filtered at the Nyquist Shannon frequency to begin with).
Easiest thing to understand is that in digital audio only points are stored, without connection lines.
An attempt to figure out how exactly points should be connected to make analog signal will lead to information about interpolation, Nyquist-Shannon theorem etc.
@@JoQeZzZ
The interpolation process is not only used for visual representation, but also mathematical reconstruction. The D/A conversion process you're describing only applies to older Non-Oversamplisng designs which are very rare to find these days. These days, almost all DACs would use oversampling because, while mathematically less intuitive, is actually much more cost-effective to implement in hardware while resulting in better objective output measurements. The sinc filter is the golden standard for oversampling digital signals, but its main problem is that the actual computation introduces a lot of latency in the chain. There are many other oversampling techniques used in actual hardware designs that are quicker but the Nyquist theorem and the sinc interpolation techniques remain proof that no audible and relevant resolution is really lost from a 48 kHz source. One can always oversample in software with the actual sinc filter itself anyways if it's an option.
@@Goodmanperson55 I had the same revelations. :) And the further realisation that the amplitude of the interpolated analog signal from a DAC might exceed digital full-scale, so you should leave some headroom. IMO, too many introductions to audio sampling show jaggy, rectangular waveforms, and in the graphics world there's generally no post-DAC filtering, so we're used to the (spatially and temporally) aliased look of computer displays.
This was fascinating. I think it's fundamental to know how audio is processed digitally , great execution on the video!
This is one of the better videos explaining aliasing. Last time I looked it up I got hit with a bunch of jargon and math terminology that kind of killed it for me, so as far as I'm concerned, you nailed it my man! Great video!
The fundamental (or essential) waves from which all other waves are constructed here are sinusoids (sine waves). One needs to go all the way to infinity to make true square (or triangular, or many many other) waves out of the sine waves. One does not have that luxury.
For details, see Fourier series.
Even if you go to infinity, the Gibbs Phenoenon still shows that ringing effect.
The math is actually quite simple: a perfect square needs an infinite amount of frequencies! The magnitude of each higher frequency tampers off compared to the previous one, but in order to have a perfect square shape in your waveform, all you need (in theory) is that your series of harmonics goes on for infinity.
This also explains the “wobbly bits”, as they are called in this video, as well as the aliasing, quite easily: because you can only represent a finite amount of frequencies (due to your sampling rate, see Nyquist theorem) you simply cannot put all the necessary frequencies into your waveform that are needed to make it a perfectly square wave. So you have two options: (1) generate a perfect square wave anyway. This, though, produces all the frequencies above the Nyquist limit. What happens to these frequencies above that limit is that they are aliased back into the representable frequency range (e.g. 0-24k Hz using 48kHz sampling rate). You can imagine this like a mirror but for frequencies. Also, this does not result in a perfect square wave anyway, since the originally infinite series of harmonics is now distorted downwards. The other option is (2), where you low pass filter you generated square wave around the Nyquist limit. This prevents aliasing, since all the frequencies that would be aliased are now filtered out. However, because you don’t have all frequencies of the necessary infinite series present, you square wave is not “complete” and, thus, exhibits “wobbly bits”. Imagine that each harmonic in the series reduces the “wobble” just a tad more.
So it’s all about missing frequencies, that you very likely don’t even hear anyway, since we’re taking about frequencies above the general hearing limit. You can imagine that, should a perfect square wave be emitted for you to hear, what arrives in your brain is a wave akin to the wobbly one in the video anyway - because you’re missing the upper frequencies of the infinite series since your hearing will always have some type of limit anyway.
Fourier is a hell of drug!
Not quite. Even with an infinite set of frequencies the Gibbs Phenomenon persists. That is what makes it a phenomenon.
@@T0NYD1CK I think he's saying that in theory, the square wave can be represented by an infinite sum of sine waves, which is true.
That last paragraph you wrote is very interesting actually - true, even if we approximate the square wave better and better using the later terms of the infinite series (ie the higher frequencies) we will be adding frequencies that are above human hearing... so I guess we can't even experience a true square wave 🤔🤔🤔🤔
@@diabl2master "... in theory, the square wave can be represented by an infinite sum of sine waves, which is true."
No, it isn't true! I admit, it does sound intuitive that it might be true but it is not even in theory. That is what Gibbs found. He said that it does not matter how high a frequency you use there will always be that ringing overshoot effect at the corners. Do a search on Gibbs Phenomenon and check for yourself.
Yes, you are right about not being able to hear a true square wave. Mathematicians see a square wave as having two flat lines and a single point halfway between them so, mathematically, there is no leading edge or trailing edge because if there were then the function would be multi-valued at that point. Engineers have a lot of trouble with mathematicians!
The other point is that, in real life, everything has limited bandwidth so those high frequencies will always be lost somewhere along the way.
@@T0NYD1CK Square waves can be perfectly represented by an infinite sum of sine waves. This is in accordance to a theorem that says that any periodic real function can be represented exactly by a Fourier series (assuming you buy into the mathematics of real analysis). Gibbs Phenomenon specifically limits itself to finite partial sums, hence the discrepancy. Arbitrarily large finite sums do not always behave the same as infinite sums. (Example irrational numbers can be expressed as an infinite sum of rationals, yet no partial sum of such series is irrational, no matter how far you finitely sum along it.)
I remember discovering this as well and being fascinated. That spiky phase rotated square has the same phase relationships as a triangle wave, but it still has the harmonic levels of a square wave. You can also phase rotate a triangle wave into a rounded square wave.
Great to have you back on the scene, man 🙌
This guy just multiplied my knowledge of square waves
He exponentially grew my knowledge
hey, new video this'll improve my day!
Man, what a trip. Thank you for making this.
When i make music, i pay very close attention to my waveforms. Especially the square ones. Also i think this video is interesting cause even small changes in the sound matters very much. Congrats on your 100k subs.
I am intrested to know if i make a random wave form , how it will sound ,any software for it
@@VimlaDevi-ud2qo like noise. a random waveform is exactly what noise is.
Doesn't the future house subgenre use square wave basslines/synths? I love the sound of square waves in electronic music. :)
Something weird happens at 3:18 when using AirPods Pro... The frequency/frequencies played messes with some stuff relating to the AirPods Pro's noise cancelling feature. I've watched this section like 10 times now and noticed that sometimes one AirPod goes into noise cancelling and the other doesn't. If you pause the video the noise cancelling feature 'fades' back to normal. Can anyone else try this out?
This was such a good video, I'm defintiely doing more research into this
this guy is more like a genius in music sciences
I'm glad to know more about this! Also I found it interesting that all the "wrong" square waves sounded better to me
Nicely put! I like how you were able to put a complicated topic like this into a concise 4 and a half minutes!
straigh to the point, interesting and usefull information, easy to understand, and all of that in under 5 minutes, this video is fantastic!!
He really listens cuz I remember how much hate used to get lol
Dude you're like a legend in the producing world you taught alot of new producers including me..
The subtleties they don’t teach you in recording school….. great video!
I really enjoy making “graphic pulses” with 4-8 step voltage sequencers. Setting all of the odd steps to maximum, and leaving the even steps at 0. Clocking the sequencer at audio rates creates very rich square waves, with somewhat-adjustable harmonics! This is in the analog realm, mind you. I’m fairly sure that in the digital realm, the results would fall back to exactly what this video is covering. Edit for spelling
that phase rotation thing for asymmetrical audio is neat! I'm working on a close miked cover of Eleanor Rigby and I was wondering why some of the takes of the violin audio were distorted even though they werent clipping. I'm not using those takes but I'll run them thru rx to see if it helps
The non-vertical rolloff makes it sound better in most applications, especially that low
really interesting and fun format. Thanks Multiplier!
Used to love playing around with old LS JK Flip Flop chips to generate octave down square waves from whatever audio I shoved in via a Schmidt trigger... then messing about with the edge rise/fall times and putting it through an active full wave rectifier :)
Even though I doubt I will ever have much practical use for this information, I was pleasantly surprised to learn this. Your explanations are wonderfully explained to a point in which someone with minimal understanding of sound design (Me lol) was able to comprehend everything being said.
Cool video, glad TH-cam recommended it.
filters often cut below the frequency but will boost the frequency at what you're cutting
Now it makes sense why jump-up usually goes for square or square-like basses. They’re the loudest.
This is so coooool!!! More like this please!!!
Thumbs up for the explanation. However, I have to say that, yes, you DO need to know this stuff if you're even an amateur Sound or Electronics Engineer. Knowing this is the first step of isolating a problem before diagnosing, then fixing it. As you touched on, in Sound Engineering, the true shape often has to do with sample rates, clipping, etc. In Electronics it has a lot more to do with the hardware; mostly tolerances and leakages/interference.
Bored me out of my skull because I've been into and studied Electronics Engineering since Kindergarten, and took a college course in it. But all that means is that it was an excellent explanation. I've seen ones that confused me, some that left enough out or got enough wrong to irritate me, but this did neither.
Note: Boredom does not mean lack of interest. I wasn't able to stop watching because I love the subject and was curious how you would explain it. You did a better job than two of my five professors in the college EET course(one of whom was an idiot who didn't believe in microwave power transmission and was extremely skeptical of the newfangled, at the time, wireless charging. LOL).
1:05 what do you mean when you imply frequency effects loudness?
He means phase
I don't get how that phase rotated square looked so different. Were some frequencies rotated and others not? Cause surly rotating the whole wave would have no effect on the sound or wave form other than to move it to the left or right.
@Firstname Lastname Thanks, Not sure I have completely understood the significance of that particular mathematical operation, but I at least get the basic idea, that the frequencies have be shifted by different amounts, allowing a wave with the same frequency content while looking completely different.
the waveform charts the motion of the speaker diaphragm over time. a vertical line would be the speaker diaphragm moving some distance in zero time, which would require infinite energy.
Gibb's phenomenon. Basically, you just can't have jump discontinuities when constructing a wave with a Fourier series (a combination of sine and cosine waves), i.e. no vertical jumps like in square waves and sawtooth waves.
Whoaahh what phase rotation plugin was that? I need this.
Apart from Izotope RX are there any other VST plugins/DAW built-ins that solve the adaptive phase correction? Looks waaaay too useful to me.
the best sounding squarewave comes from Korg MS-series synths, the waveshape is pretty much in the WTF-territory on those :)
phase rotation is different than phase shift. I'm trying to discover and find out how to shift an audio wave without changing it's shape, for the very reason that you showed in this video. I have been trying to figure it out since 2017
How can you rotate phase that will change the entire function
You can go to desmos and plot for sinx and 1/sinx and then you may see some kind of rotation effect
@@lightningmcqueen1577 ahhh, you're using desmos. nice. i don't know the math behind it, but it does shift sine waves, however, it destroys square waves. like the video showed. I think it's called the hilbert transform.
I don't know anything about this topic and don't really need to, but for some reason, it was super interesting, keep up the great work!
Anybody else notices this Gibbs Phenomenon is very similar to the Mould Effect in how the wave jumps up right before a drop?
This is actually pretty interesting❤
I see a square wave with over/undershoots, my first thought goes to PID tuning of a servo
Same lmao also bode plots
2:04 ok now whats the explanation for the increased loudness?
Bandlimited synthesis of square (sawtooth, triangle, etc.) waves is surprisingly involved - could be an interesting rabbit-hole for a future vid. :)
A mean prank to play on your sound engineer is to have a distorted 50 (or 60) Hz tone playing quietly on your equipment during soundcheck.
someone needs to explain why the Casio WK-1800 has a square wave that when played through an oscilloscope, DSP effects off, direct from stereo line out, to a stereo scope (one wave for the left, and right channels respectively), Resembles a sine wave, but it isn't...
The outro made me a subscriber.
Allow me to introduce a new unit of measurement for sound volume,
which I call vovol* (abbreviated: volume voltage).
THIS IS HOW IT WORKS: You use two pre-stages, one with positive volume values, and the other negative.
For example, so has the pre-step with positive values
a measurement from +0 decibels up to +20, while the one with negative values, has from -0 decibels down to -20 decibels.
The highest voltage occurs when the value is
+20 and -20 decibels (or: 20 vovol),
while there is low voltage, when the value is on
+0 and -0 decibels (or: 0 vovol).
You can possibly also combine two different values with each other, by adjusting the value to +10 -20 vovol, which gives a crisper effect. Have experimented with this myself at work and at home.
The adjustment can of course be set to taste, but the purpose of vovol for me is to equalize the sound volume, so that you better hear weak sounds and at the same time avoid high deafening sound levels (loudness war's).
Thank you for reading this!
Take care of your hearing...
:-)
Congrats on 100k
There is a youtube claiming that digital sound is inaccurate because he generates a square wave then takes a spectrum in some program and claims there are aliasing frequencies below the fundamental.
While that sounds wrong and makes me suspect the implementation of the spectral analyzer (poorly windowed maybe?), I did point out that he didn't prove that digitally sampled sound has aliasing frequencies, because he didn't digitally sample sound, he generated it. And if he wanted to generate a square wave with a brick wall roll off at 20 kHz and therefor no way for a bad filtering process to reflect the > 20 kHz harmonics down, he'd have to generate a square wave with gibbs phenomena.
Easy to do, just build it out of sine waves and don't use any of the harmonics over 20 kHz.
I forgot what low frequency squarewaves sound like and so for half this video it felt like I was being gas-lighted into thinking squarewaves sound like sawtooth.
multiplier's voice feels like a warm hot chocolate and a shower after a hike in the rain
bro is back!
Great information!!
Makes sense. Air molecules can't teleport back and forth.
This was very informative. Thanks for this :)
To explain the Gibbs phenomenon to those who are not that familiar with that topic: In theory, every periodic waveform (for example a square wave, sawtooth etc.) can be replicated by using particular sine waves with different frequencies, amplitudes and phase shifts (If you take a look on your audio analyzer, this is what you might call "harmonics" when for example distorting/saturating the signal). In Fourier's theory, you would need infinite different sine waves to get a very pure square wave out of sine waves. Practically this is not possible, since you cant use "infinite" sine waves. Or to explain it from another perspective. A pure square would mean that your signal had to travel from -1 to 1 in a period of 0 seconds (let the x-axis be the time and the y-axis the amplitude). But by just using pure sine waves you won't reach that "infinitly steep" rising edge or falling edge of a square wave signal. So you are just able to approximate it.
As a student who studied physics, and thus wave mechanics, this is the right answer. For anyone wanting to understand where Gibbs Phenomenon comes from, you'll first have to understand what Fourier Series are.
1:47 I've always wondered why that happened. Now I know!
Great video. But I have one bone to pick. On steady state signals phase rotation is (generally) not audible (providing no nonlinearities creep in). But, adaptive phase rotation on non-steady-state signals can absolutely be audible. There was a recent video by a reputable company where a mastering engineer said he always starts by applying phase rotation and doesn't even listen to the results. That is horrifying. Please, no one do this. Phase rotation can absolutely be useful, but we should always listen to the results of what we're doing.
Nature doesn’t have two values for the derivative of a single point of any function of time. This limits perfect square waves to the domain of mathematics. In other words, nature smooths things out.
what? There are not two values, the derivative of a square wave at the jump singularity is just a dirac function. That said, dirac functions are merely a theoretical construct but could be approximated to a high degree even in nature.
What about not using it over time and more like a frequency domain similar to when you can hear audio slowed down and have no pitch change. It’s seems more like the values are being cut and paste closer or further apart making more frames in a sense than stretching.
How I like to explain Gibb's Phenomenon: imagine the waveform line represents the vertical position of a speaker cone when viewed from the side, where the middle line is where the cone rests when there's no signal.
In this case, it's clear that the speaker cone can't be physically snapped instantaneously from one position to another: it takes some time to move.
The cone itself is also no ideal: it has mass. So when you do try to move it, it has momentum, and changing the signal from one height to another will make it bounce, like a spring, until it settles on that height.
This is an awful explanation from a signal analysis perspective, and makes it hard to grasp why making the waveform "more square" produces artifacts, but it works for a lot of people.
Could an abundance of aliasing artifacts negatively affect a mix? Maybe make it too harsh?
I'd like to see an animation of the waveform while you phase shift the partials over an entire 2π.
Awesome ad for your course! Well done!
Well that explains the level issue when removing frequencies.
So you have to completely control one note to mix it well with another. Sluice box.
I did want to know exactly this.
hmmmm this was really informative... i don't know how i will use it pratically but i know this will come in handy
Nice insight ! Thanks
There's a person in Finland I saw that looks just like you so I just wanted to make sure, are you in Finand at the moment???
mate, ive used a sample from this video in a song and i would like to put that song on an ep. is it okay if i use it. i will credit you. and if i ever make any money off it i will compensate you what is fair!
make more video like this.
It is kind of silly to say that I just know the reason why my low cut filter makes my audio louder on the meter in this video.
i just never thought that the phase shifting problem cause that much.
How did he get through those two minutes without saying Fourier transform once
Nice video, I learned something ✔️
Is a true square possible given that the speaker itself needs time to travel, stop, and reverse direction?
This video should be sponsored by Squarespace.
You know what, I’m just gonna subscribe atp
God I'm so envious of your microphones 😂❤️
Edit:
Ok I'm also very envious of your vast knowledge and will binge watch all your content now to start working in filling that gap 😂
Nice pic
Thank you
a square is also possible in fm synthesis
At some frequencies square samples can be perfect and produce no aliasing.
3:20 I feel like I should be pressing the clicker for my hearing test
You should also note that analog generated square waves look even less square... maybe even look a bit rounded.
Allpass filters warp the waveshape but don't necessarily change the tone. The waveshape is a nice fairy story for children.
awesome
video!
i dont get why phase rotating it made it look so weird in the first example...
Me an armchair calculus enthusiast: What if you amplified the Square Wave and the Pointy Thing until they each marked out the same area above and below the middle point?
as whene i know actually better for your speaker a fake square wave like a pure cause your speaker dish fallow the curve and this is huge movement and big energy investment: sharp pull and need to keep same level the freq and pull back qickly.speaker will be much more sustainable and more lifetime with fake or breaked signal.but i think if you play with context is not problem ,like live act with many sound cause mixed the signal other freq so try avoid a loud long solo
That was actually useful
Ngl I don't make beats. I only watch this dude because he's good looking.
my earphones aux fell on the floor which had water right before I opened the video, got scared that I ruined both my phone and earphones lol
I really like this
liked the video before watching cause you slap
i remember seeing this stuff when i zoomed in all the way on audacity
just scrolling through waiting for the ad to finish...
This was interesting and I'm glad I don't have to understand it
Not trying to correct anything but I think of it as like a tube instead of height depth more like a tube of water and how cold or hot is the water hot water can move around a lot and be pushed together more and sound a lot louder than water which is completely cold and doesn't move around a lot at all so you think of it that way how hot do you want your water to be and how much can you too get take this way I look at it the loudness level thing because sometimes you want that tube to sound full lots of water but only a tiny bit of heat minimal... Or it's Splash tube which has very little water but a lot going on friction wise friction wise but in certain places and that's why it's fun these things translate through all things I've find these days it's fun your videos are dope man sorry about the ears i .ildly understand.. hut have beej protectijng the left as hbest as can