weird things about square waves.
Вставка
- Опубліковано 4 лип 2024
- 00:00 square wave that isn't a square wave
00:23 how I made it + phase rotation
00:35 why it's a problem
01:09 correcting asymmetrical vocal waveforms
01:37 subtractive EQ increasing peak level
02:06 Groove3
02:21 squares don't look like squares
02:35 antialiasing
03:25 Gibbs phenomenon
03:56 squares that look perfect
Groove3: www.groove3.com
My EQ course on Groove3: www.groove3.com/tutorials/Ele...
Ableton courses on Groove3: www.groove3.com/browse/by-cat...
multiplier.audio - Audio samples for electronic music.
How I Make Money in the Music Industry: multipliermusic.com/products/...
If you have any questions or corrections, email me directly at multiplier@multiplier.audio
Multiplier music coaching/Skype lessons. Email multiplier@multipliermusic.com for info and pricing.
‘No Hidden Magic’ Mastering: multiplier.audio/mastering
multiplier.audio featured products:
HUMAN HIHATS - multiplier.audio/store/human-...
SOFT KICKS - multiplier.audio/store/soft-k...
FUTURE CLAPS - multiplier.audio/store/future...
MAGIC CRACKLES - multiplier.audio/store/magic-...
WHERE'S THAT SNARE - multiplier.audio/store/wheres...
the other 24 products in our store - multiplier.audio/store
Loopmasters sample packs I made:
Serum Trap Presets - www.loopmasters.com/genres/94...
Massive Trap Presets - www.loopmasters.com/product/d...
Space FX - www.loopmasters.com/genres/46...
Ghosts Evolving Massive Presets - www.loopmasters.com/genres/46...
1000 Weird Little One Shots - www.loopmasters.com/genres/46...
Sign up to the multiplier.audio email newsletter to receive free samples, tips, tricks, and tutorials - every Friday.
Either send an email to signup@multiplier.audio or use the form at the bottom of the homepage multiplier.audio
Multiplier on the web:
/ multipliermusic
/ multiplier
/ multiplier
www.beatport.com/artist/multip...
multipliermusic.com
And his label, Relentik Records:
/ relentik-records
www.beatport.com/label/relenti...
Multiplier's old podcast BLOUNCE:
itunes.apple.com/gb/podcast/bl...
/ blounce
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.
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.
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.
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.)
This was fascinating. I think it's fundamental to know how audio is processed digitally , great execution on the video!
Man, what a trip. Thank you for making this.
hey, new video this'll improve my day!
This guy just multiplied my knowledge of square waves
He exponentially grew my knowledge
really interesting and fun format. Thanks Multiplier!
Nicely put! I like how you were able to put a complicated topic like this into a concise 4 and a half minutes!
This was such a good video, I'm defintiely doing more research into this
Great to have you back on the scene, man 🙌
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?
Great information!!
This is so coooool!!! More like this please!!!
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
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. :)
Cool video, glad UA-cam recommended it.
The non-vertical rolloff makes it sound better in most applications, especially that low
I'm glad to know more about this! Also I found it interesting that all the "wrong" square waves sounded better to me
This was very informative. Thanks for this :)
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!
This is actually pretty interesting❤
Nice insight ! Thanks
this guy is more like a genius in music sciences
Congrats on 100k
awesome
video!
Dude you're like a legend in the producing world you taught alot of new producers including me..
bro is back!
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.
Nice video, I learned something ✔️
Makes sense. Air molecules can't teleport back and forth.
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 :)
Thank you
Now it makes sense why jump-up usually goes for square or square-like basses. They’re the loudest.
The outro made me a subscriber.
filters often cut below the frequency but will boost the frequency at what you're cutting
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!
That was actually useful
I did want to know exactly this.
Very interesting
Awesome ad for your course! Well done!
I really like this
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
Bandlimited synthesis of square (sawtooth, triangle, etc.) waves is surprisingly involved - could be an interesting rabbit-hole for a future vid. :)
1:47 I've always wondered why that happened. Now I know!
Well that explains the level issue when removing frequencies.
hmmmm this was really informative... i don't know how i will use it pratically but i know this will come in handy
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
Anybody else notices this Gibbs Phenomenon is very similar to the Mould Effect in how the wave jumps up right before a drop?
the best sounding squarewave comes from Korg MS-series synths, the waveshape is pretty much in the WTF-territory on those :)
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).
Whoaahh what phase rotation plugin was that? I need this.
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.
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.
interesting man
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.
I see a square wave with over/undershoots, my first thought goes to PID tuning of a servo
Same lmao also bode plots
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.
I'd like to see an animation of the waveform while you phase shift the partials over an entire 2π.
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...
:-)
2:04 ok now whats the explanation for the increased loudness?
Could an abundance of aliasing artifacts negatively affect a mix? Maybe make it too harsh?
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.
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...
1:05 what do you mean when you imply frequency effects loudness?
He means phase
wow!
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.
This was interesting and I'm glad I don't have to understand it
a square is also possible in fm synthesis
i remember seeing this stuff when i zoomed in all the way on audacity
Bro....🥀🔥🤘❗
For sin waves:
ΣSin(xn+b)/n
You can guess what goes in the blanks if you know what any of this means
Hey this one is interesting
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.
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.
So you have to completely control one note to mix it well with another. Sluice box.
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.
Is a true square possible given that the speaker itself needs time to travel, stop, and reverse direction?
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???
multiplier's voice feels like a warm hot chocolate and a shower after a hike in the rain
Wow!!!
3:20 I feel like I should be pressing the clicker for my hearing test
liked the video before watching cause you slap
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
This all 2 db over my head
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!
At some frequencies square samples can be perfect and produce no aliasing.
This video should be sponsored by Squarespace.
woow cool
Sn76489 making beeping sounds
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.
just scrolling through waiting for the ad to finish...
How did he get through those two minutes without saying Fourier transform once
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.